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