Browse Source

部分页面交互优化

yufei
余菲 9 months ago
parent
commit
452295efc1
5 changed files with 15 additions and 12 deletions
  1. +1
    -0
      api/goods.js
  2. +1
    -1
      components/exchangeInfo/index.wxml
  3. +6
    -3
      package_A/pages/goods-detail/index.js
  4. +1
    -3
      package_first/pages/AttentionMethod/index.js
  5. +6
    -5
      request/index.js

+ 1
- 0
api/goods.js View File

return request({ return request({
url: '/goods/exchange', url: '/goods/exchange',
method: 'POST', method: 'POST',
showLoading: false,
data data
}) })
} }

+ 1
- 1
components/exchangeInfo/index.wxml View File

<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>
<!-- 店铺信息 --> <!-- 店铺信息 -->

+ 6
- 3
package_A/pages/goods-detail/index.js View File

}, },
// 兑换 // 兑换
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,

+ 1
- 3
package_first/pages/AttentionMethod/index.js View File



}, },
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){

+ 6
- 5
request/index.js View File

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
}) })

Loading…
Cancel
Save