Browse Source

多规格购买

master
caichunsheng 4 years ago
parent
commit
9142bc1945
  1. 11
      pages/info/sceneProductInfo/index.js
  2. 2
      pages/info/sceneProductInfo/index.wxml
  3. 14
      pages/order/scene/index.js

11
pages/info/sceneProductInfo/index.js

@ -98,9 +98,9 @@ Page({
info: res.data
})
var arr = []
console.log(this.data.info);
res.data.product.forEach(item => {
res.data.product.forEach((item,index) => {
item.sku.forEach(itemB=>{
itemB.proIndex = index
arr.push(itemB)
})
});
@ -269,16 +269,12 @@ Page({
app.globalData.retailId = this.data.retailId;
// let sku = e.currentTarget.dataset.sku,product = e.currentTarget.dataset.product;
// let sku = {sku:e.currentTarget.dataset.product.sku[this.data.skuIndex]},product = {product: e.currentTarget.dataset.product}
let sku = {sku:this.data.skuList[this.data.skuIndex]},product = {product: e.currentTarget.dataset.product}
let sku = {sku:this.data.skuList[this.data.skuIndex]},product = {product:this.data.info.product[this.data.skuList[this.data.skuIndex].proIndex]}
app.globalData.product = {...sku,...product}
console.log(this.data.skuIndex);
console.log(app.globalData.product);
// app.globalData.product = e.currentTarget.dataset;
wx.navigateTo({
url: '/pages/order/scene/index',
})
}else {
console.log('111');
commonApi.user_post("cart/add_sku", {
sku_id: this.data.skuList[this.data.skuIndex].id,
num: this.data.producNum
@ -372,7 +368,6 @@ Page({
})
},
complete(res) {
console.log(res);
/* 这里判断一下如果没有授权重新打开设置选项 */
wx.getSetting({
success(res) {

2
pages/info/sceneProductInfo/index.wxml

@ -115,7 +115,7 @@
<view class="mask-content">
<view class="iconfont icon-close" bindtap="hideSku"></view>
<view class="sku-info-box">
<image id="skuImg" src="{{info.headimg}}" mode="aspectFill"></image>
<image id="skuImg" src="{{skuList[skuIndex].headimg}}" mode="aspectFill"></image>
<view class="sku-info">
<view class="sku-price">{{skuList[skuIndex].price/100}}
<view class="allowance" wx:if="{{allowance_data}}">

14
pages/order/scene/index.js

@ -93,6 +93,13 @@ Page({
this.changePrice()
},
add: function () {
if (this.data.productNum==undefined) {
wx.showToast({
title: '请先添加出行人',
icon: 'none'
})
return
}
if (this.data.product.sku.sku_model.traveller_limit_num != 0 && this.data.productNum == this.data.product.sku.sku_model.traveller_limit_num) {
wx.showToast({
title: '出行人限购' + this.data.product.sku.sku_model.traveller_limit_num + "份",
@ -107,6 +114,13 @@ Page({
this.changePrice()
},
minus: function () {
if (this.data.productNum==undefined) {
wx.showToast({
title: '请先添加出行人',
icon: 'none'
})
return
}
if (this.data.productNum == 1) return;
if (this.data.coupon) {
wx.showToast({

Loading…
Cancel
Save