mirror of
https://gitee.com/gz-yami/mall4m.git
synced 2026-03-22 09:47:16 +08:00
增加订单详情加入购物车功能
This commit is contained in:
@@ -17,7 +17,7 @@ Page({
|
||||
productTotalAmount: '',
|
||||
transfee: '',
|
||||
reduceAmount: '',
|
||||
actualTotal: '',
|
||||
shopId: '',
|
||||
prodid: ''
|
||||
},
|
||||
|
||||
@@ -29,6 +29,44 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 加入购物车
|
||||
*/
|
||||
addToCart: function(event) {
|
||||
let index = event.currentTarget.dataset.index
|
||||
// if (!this.orderItemDtos) {
|
||||
// console.log(1213)
|
||||
// return;
|
||||
// }
|
||||
var ths = this;
|
||||
wx.showLoading({
|
||||
mask: true
|
||||
});
|
||||
var params = {
|
||||
url: "/p/shopCart/changeItem",
|
||||
method: "POST",
|
||||
data: {
|
||||
basketId: 0,
|
||||
count: this.data.orderItemDtos[index].prodCount,
|
||||
prodId: this.data.orderItemDtos[index].prodId,
|
||||
shopId: this.data.shopId,
|
||||
skuId: this.data.orderItemDtos[index].skuId
|
||||
},
|
||||
callBack: function(res) {
|
||||
//console.log(res);
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
title: "加入购物车成功",
|
||||
icon: "none"
|
||||
})
|
||||
wx.switchTab({
|
||||
url: '/pages/basket/basket',
|
||||
})
|
||||
}
|
||||
};
|
||||
http.request(params);
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
@@ -62,6 +100,7 @@ Page({
|
||||
transfee: res.transfee,
|
||||
reduceAmount: res.reduceAmount,
|
||||
actualTotal: res.actualTotal,
|
||||
shopId: res.shopId
|
||||
});
|
||||
wx.hideLoading();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<text class="order-sts gray">{{status}}</text>
|
||||
</view>
|
||||
</view> -->
|
||||
<block wx:for="{{orderItemDtos}}" wx:key=''>
|
||||
<block wx:for="{{orderItemDtos}}" wx:for-index="index" wx:key='index'>
|
||||
<view class='item-cont' bindtap='toProdPage' data-prodid="{{item.prodId}}">
|
||||
<view class='prod-pic'>
|
||||
<image src='{{item.pic}}'></image>
|
||||
@@ -39,7 +39,7 @@
|
||||
<text class='small-num'>.{{wxs.parsePrice(item.price)[1]}}</text></text>
|
||||
<view class='btn-box'>
|
||||
<text class='btn' wx:if="{{item.status!=1}}">申请售后</text>
|
||||
<text class='btn'>加购物车</text>
|
||||
<text class='btn' data-index='{{index}}' catchtap='addToCart'>加购物车</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user