@@ -21,6 +21,7 @@ export const exchange = function (data) { | |||
return request({ | |||
url: '/goods/exchange', | |||
method: 'POST', | |||
showLoading: false, | |||
data | |||
}) | |||
} |
@@ -10,7 +10,7 @@ | |||
<view class="status_tab" wx:else style="color: #EB6100;background-color: rgba(235, 97, 0, 0.2);" >未核销</view> | |||
</view> | |||
<text class="info_item">{{item.goods.goodsSpec}}</text> | |||
<view class="points_box">实付:<text style="color: #2D84E4;">{{item.goods.goodsPoints}}</text> 积分</view> | |||
<view class="points_box">实付:<text style="color: #2D84E4;">{{item.goods.goodsPoints * item.goodsCount}}</text> 积分</view> | |||
</view> | |||
</view> | |||
<!-- 店铺信息 --> |
@@ -79,21 +79,24 @@ Page({ | |||
}, | |||
// 兑换 | |||
exchangeGoods() { | |||
wx.showLoading() | |||
let params = {} | |||
params.goodsId = this.data.detail.id | |||
params.goodsCount = this.data.numbers | |||
params.openid = wx.getStorageSync('openid') | |||
exchange(params).then(res=> { | |||
wx.hideLoading() | |||
if(res.code === 0) { | |||
// 成功跳转页面 | |||
wx.navigateTo({ | |||
url: '/package_A/pages/exchange-success/index?data=' + encodeURIComponent(JSON.stringify(this.data.storeDetail)) | |||
}) | |||
} else { | |||
wx.showToast({ | |||
icon: 'error', | |||
title: res.msg, | |||
duration: 2000 | |||
}) | |||
} | |||
}).catch((e)=> { | |||
wx.hideLoading() | |||
wx.showToast({ | |||
icon: 'error', | |||
title: e.msg, |
@@ -72,12 +72,10 @@ Page({ | |||
}, | |||
getIsApply(){ | |||
const {tenantId} = wx.getStorageSync('tenant') | |||
const openid = wx.getStorageSync('openid') | |||
const data = { openid } | |||
api_getIsApply(data).then(res=>{ | |||
console.log(res); | |||
this.data.status = res.data | |||
this.data.status = res.data | |||
}) | |||
}, | |||
goPage(e){ |
@@ -20,6 +20,9 @@ export const request = function(params) { | |||
wx.request({ | |||
...params, | |||
success: function(res) { | |||
if(params.showLoading) { | |||
wx.hideLoading() | |||
} | |||
// 处理请求 | |||
if(params.url === baseurl+'/aliyunOss/getSecurityToken') { | |||
resolve(res.data) | |||
@@ -32,17 +35,15 @@ export const request = function(params) { | |||
} | |||
}, | |||
fail: function (error) { | |||
reject(error) | |||
}, | |||
complete: function () { | |||
if (params.showLoading) { | |||
if(params.showLoading) { | |||
wx.hideLoading() | |||
} | |||
reject(error) | |||
} | |||
}) | |||
}).catch(e => { | |||
wx.showToast({ | |||
icon: "error", | |||
icon: "none", | |||
title: e || '系统错误', | |||
duration: 2000 | |||
}) |