...
|
...
|
@@ -10,7 +10,7 @@ Page({ |
|
|
addressIndex: 0,
|
|
|
address: {},
|
|
|
address_List: [],
|
|
|
address__id: 4,
|
|
|
address__id: null,
|
|
|
chooseFlagAddress: false,
|
|
|
timedat: '',
|
|
|
showad: false,
|
...
|
...
|
@@ -66,7 +66,10 @@ Page({ |
|
|
optionsproId: '',
|
|
|
optionspackId: '',
|
|
|
optionscart: '',
|
|
|
timeflags:false
|
|
|
timeflags:false,
|
|
|
addd:null,
|
|
|
aamount: null,
|
|
|
dingdanid:null
|
|
|
},
|
|
|
//changeTime
|
|
|
changeTime() {
|
...
|
...
|
@@ -76,16 +79,25 @@ Page({ |
|
|
},
|
|
|
//检测选择时间的picker
|
|
|
bindMultiPickerChange(e) {
|
|
|
if(this.data.panduan){
|
|
|
var addressId = this.data.deliverTimeId
|
|
|
} else {
|
|
|
var addressId = this.data.addd
|
|
|
}
|
|
|
this.setData({
|
|
|
multiIndex: e.detail.value,
|
|
|
timeflag:false
|
|
|
timeflag:false,
|
|
|
deliverTimeId: addressId,
|
|
|
})
|
|
|
},
|
|
|
//检测picker改变
|
|
|
bindMultiPickerColumnChange(e) {
|
|
|
if (this.data.timeflags){
|
|
|
// if (this.data.timeflags){
|
|
|
this.setData({
|
|
|
panduan: true
|
|
|
})
|
|
|
let that = this
|
|
|
var deliveryTimeId = that.data.deliverTimeId
|
|
|
var deliveryTimeId = null
|
|
|
let column = e.detail.column
|
|
|
let data = {
|
|
|
multiIndex: that.data.multiIndex,
|
...
|
...
|
@@ -93,6 +105,7 @@ Page({ |
|
|
timeDataArray: that.data.timeDataArray
|
|
|
}
|
|
|
data.multiIndex[column] = e.detail.value;
|
|
|
console.log(e.detail.value+'shijiyaya')
|
|
|
switch (column) {
|
|
|
case 0:
|
|
|
data.multiArray[1] = that.data.week_two[e.detail.value]
|
...
|
...
|
@@ -107,14 +120,6 @@ Page({ |
|
|
if (e == c) {
|
|
|
ele.children.forEach(function (eles, indexs) {
|
|
|
if (eles.disabled) {
|
|
|
if (b == eles.label) {
|
|
|
deliveryTimeId = eles.value
|
|
|
}
|
|
|
that.setData({
|
|
|
timeflag: false
|
|
|
})
|
|
|
} else {
|
|
|
console.log(909090)
|
|
|
wx.showToast({
|
|
|
title: '亲,该时间段已排满咯~',
|
|
|
icon: 'none'
|
...
|
...
|
@@ -122,8 +127,16 @@ Page({ |
|
|
that.setData({
|
|
|
timeflag: true
|
|
|
})
|
|
|
deliveryTimeId = deliveryTimeId
|
|
|
return
|
|
|
} else {
|
|
|
if (b == eles.label) {
|
|
|
console.log('b')
|
|
|
deliveryTimeId = eles.value
|
|
|
console.log('时间id'+eles.value)
|
|
|
}
|
|
|
that.setData({
|
|
|
timeflag: false
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
}
|
...
|
...
|
@@ -132,7 +145,7 @@ Page({ |
|
|
that.setData({
|
|
|
deliverTimeId: deliveryTimeId
|
|
|
})
|
|
|
}
|
|
|
// }
|
|
|
},
|
|
|
//判断星期几
|
|
|
getWeek() {
|
...
|
...
|
@@ -158,35 +171,42 @@ Page({ |
|
|
week_arr.push(ele.label)
|
|
|
week_right.push(ele.arr)
|
|
|
});
|
|
|
week_right.splice(count, 1)
|
|
|
let foo = week_arr.indexOf(week)
|
|
|
if (foo > -1) {
|
|
|
week_arr.splice(foo, 1);
|
|
|
}
|
|
|
// weeks[0] = week_arr
|
|
|
// weeks[1] = week_right
|
|
|
// weeks[1] = ["13.00-15.00","15.00-17.00"]
|
|
|
var weeks_two = week_right
|
|
|
console.log('000')
|
|
|
var i = null
|
|
|
week_right.forEach(function (elee,indexe) {
|
|
|
if (elee.length == 0) {
|
|
|
i=indexe
|
|
|
week_arr.splice(indexe, 1)
|
|
|
}
|
|
|
})
|
|
|
week_right.splice(i,1)
|
|
|
console.log(week_right)
|
|
|
console.log(week_arr)
|
|
|
console.log(1414)
|
|
|
// week_right.splice(count, 1)
|
|
|
// let foo = week_arr.indexOf(week)
|
|
|
// console.log(foo)
|
|
|
// if (foo >= -1) {
|
|
|
// week_arr.splice(count, 1);
|
|
|
// }else{
|
|
|
|
|
|
// }
|
|
|
var weeks_two = week_right
|
|
|
this.setData({
|
|
|
timeDataArray: canlda,
|
|
|
week_arr: week_arr,
|
|
|
multiArray: weeks,
|
|
|
week_two: weeks_two
|
|
|
});
|
|
|
console.log('3232')
|
|
|
console.log(this.data.week_two)
|
|
|
this.start()
|
|
|
},
|
|
|
start() {
|
|
|
let arr1 = this.data.week_two
|
|
|
let week_arr = this.data.week_arr
|
|
|
console.log(arr1)
|
|
|
console.log(week_arr)
|
|
|
this.setData({
|
|
|
multiArray: [week_arr, arr1[0]]
|
|
|
})
|
|
|
console.log(111)
|
|
|
console.log([week_arr, arr1[0]])
|
|
|
},
|
|
|
//返回
|
|
|
get_my() {
|
...
|
...
|
@@ -244,32 +264,43 @@ Page({ |
|
|
app.post(url, params).then(r => {
|
|
|
console.log(r)
|
|
|
var list = r.data.list;
|
|
|
var addid = null
|
|
|
r.data.vips.forEach(function(ele, index) {
|
|
|
ele.t = false
|
|
|
});
|
|
|
var n = 0
|
|
|
r.data.timeDataArray.forEach(function(ele, index) {
|
|
|
if(index==0){
|
|
|
ele.children.forEach(function(e,i){
|
|
|
if(!e.disabled){
|
|
|
n++
|
|
|
if (n == 1) {
|
|
|
addid = ele.children[0].value
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
var new_arr = []
|
|
|
for (let i = 0; i < ele.children.length; i++) {
|
|
|
if (ele.children[i].disabled){
|
|
|
|
|
|
} else {
|
|
|
new_arr.push(ele.children[i].label)
|
|
|
}
|
|
|
}
|
|
|
ele.arr = new_arr
|
|
|
})
|
|
|
var amount = that.data.amount + r.data.priceData.shipment_price
|
|
|
that.setData({
|
|
|
vip: r.data,
|
|
|
goodsList: r.data.list,
|
|
|
addressList: r.data.address,
|
|
|
address: r.data.address[0],
|
|
|
address__id:r.data.address[0].id,
|
|
|
vipList: r.data.vips,
|
|
|
timeDataArray: [],
|
|
|
timeDataArray: r.data.timeDataArray,
|
|
|
deliverList: r.data.timeDataArray,
|
|
|
addressList: r.data.address,
|
|
|
amount: that.data.amount,
|
|
|
addressId:addid
|
|
|
amount:amount,
|
|
|
addd:addid
|
|
|
});
|
|
|
console.log(addid+'刚进来')
|
|
|
if (that.data.num == 0) {
|
...
|
...
|
@@ -291,30 +322,43 @@ Page({ |
|
|
app.post(url, params).then(r => {
|
|
|
if (r.code == 1) {
|
|
|
var list = r.data.list;
|
|
|
var n = 0
|
|
|
r.data.timeDataArray.forEach(function (ele, index) {
|
|
|
if (index == 0) {
|
|
|
ele.children.forEach(function (e, i) {
|
|
|
if (!e.disabled) {
|
|
|
n++
|
|
|
if (n == 1) {
|
|
|
addid = ele.children[0].value
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
var new_arr = []
|
|
|
for (let i = 0; i < ele.children.length; i++) {
|
|
|
if (ele.children[i].disabled) {
|
|
|
|
|
|
} else {
|
|
|
new_arr.push(ele.children[i].label)
|
|
|
}
|
|
|
}
|
|
|
ele.arr = new_arr
|
|
|
})
|
|
|
that.setData({
|
|
|
vip: r.data,
|
|
|
goodsList: r.data.list,
|
|
|
addressList: r.data.address,
|
|
|
address: r.data.address[0],
|
|
|
address__id: r.data.address[0].id,
|
|
|
vipList: r.data.vips,
|
|
|
timeDataArray: r.data.timeDataArray,
|
|
|
deliverList: r.data.timeDataArray,
|
|
|
ship_ment_price: r.data.priceData.shipment_price,
|
|
|
addressId:addid
|
|
|
addd:addid
|
|
|
});
|
|
|
// that.fetchAmount();
|
|
|
that.amount()
|
|
|
that.getWeek();
|
|
|
} else {
|
|
|
console.log(3333333333)
|
|
|
wx.showToast({
|
|
|
title: r.msg,
|
|
|
icon: 'none'
|
...
|
...
|
@@ -338,11 +382,14 @@ Page({ |
|
|
vip: r.data,
|
|
|
goodsList: r.data.list,
|
|
|
addressList: r.data.address,
|
|
|
address: r.data.address[0],
|
|
|
address__id: r.data.address[0].id,
|
|
|
vipList: r.data.vips,
|
|
|
ship_ment_price: r.data.priceData.shipment_price
|
|
|
});
|
|
|
that.amount();
|
|
|
} else {
|
|
|
console.log(11111111)
|
|
|
wx.showToast({
|
|
|
title: r.msg,
|
|
|
icon: 'none',
|
...
|
...
|
@@ -366,25 +413,37 @@ Page({ |
|
|
var totalPrice = that.data.totalPrice
|
|
|
app.post(url, params).then(r => {
|
|
|
if (r.code == 1) {
|
|
|
var n = 0
|
|
|
r.data.timeDataArray.forEach(function (ele, index) {
|
|
|
if (index == 0) {
|
|
|
ele.children.forEach(function (e, i) {
|
|
|
if (!e.disabled) {
|
|
|
n++
|
|
|
if (n == 1) {
|
|
|
addid = ele.children[0].value
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
var new_arr = []
|
|
|
for (let i = 0; i < ele.children.length; i++) {
|
|
|
if (ele.children[i].disabled) {
|
|
|
|
|
|
} else {
|
|
|
new_arr.push(ele.children[i].label)
|
|
|
}
|
|
|
}
|
|
|
ele.arr = new_arr
|
|
|
})
|
|
|
this.setData({
|
|
|
vip: r.data,
|
|
|
goodsList: r.data.list,
|
|
|
addressList: r.data.address,
|
|
|
address: r.data.address[0],
|
|
|
address__id: r.data.address[0].id,
|
|
|
vipList: r.data.vips,
|
|
|
timeDataArray: r.data.timeDataArray,
|
|
|
deliverList: r.data.timeDataArray,
|
|
|
ship_ment_price: r.data.priceData.shipment_price,
|
|
|
addressId:addid
|
|
|
addd:addid
|
|
|
})
|
|
|
this.getWeek();
|
|
|
}
|
...
|
...
|
@@ -434,14 +493,24 @@ Page({ |
|
|
app.post(url, params).then(r => {
|
|
|
if (r.code == 1) {
|
|
|
console.log(r)
|
|
|
var n = 0
|
|
|
r.data.timeDataArray.forEach(function (ele, index) {
|
|
|
if (index == 0) {
|
|
|
ele.children.forEach(function (e, i) {
|
|
|
if (!e.disabled) {
|
|
|
n++
|
|
|
if (n == 1) {
|
|
|
addid = ele.children[0].value
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
var new_arr = []
|
|
|
for (let i = 0; i < ele.children.length; i++) {
|
|
|
if (ele.children[i].disabled) {
|
|
|
|
|
|
} else {
|
|
|
new_arr.push(ele.children[i].label)
|
|
|
}
|
|
|
}
|
|
|
ele.arr = new_arr
|
|
|
})
|
|
|
r.data.list.forEach(function(ele, index) {
|
...
|
...
|
@@ -454,6 +523,8 @@ Page({ |
|
|
vip: r.data,
|
|
|
goodsList: r.data.list,
|
|
|
addressList: r.data.address,
|
|
|
address: r.data.address[0],
|
|
|
address__id: r.data.address[0].id,
|
|
|
vipList: r.data.vips,
|
|
|
timeDataArray: r.data.timeDataArray,
|
|
|
deliverList: r.data.timeDataArray,
|
...
|
...
|
@@ -461,7 +532,7 @@ Page({ |
|
|
amount: price,
|
|
|
goodsTotalPrice: price,
|
|
|
last_total_price: price,
|
|
|
addressId: addid
|
|
|
addd: addid
|
|
|
});
|
|
|
this.getWeek();
|
|
|
}
|
...
|
...
|
@@ -515,6 +586,14 @@ Page({ |
|
|
} else {
|
|
|
url = '/wxapp/cart/confirm2'
|
|
|
}
|
|
|
console.log(that.data.deliverTimeId + "配送时间ids")
|
|
|
if (that.data.deliverTimeId==undefined){
|
|
|
wx.showToast({
|
|
|
title: '请选择配送时间',
|
|
|
icon:'none'
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
if (that.data.num != 0 && that.data.is_group == 0) {
|
|
|
console.log("商品直接购买")
|
|
|
if (index != -1) {
|
...
|
...
|
@@ -786,26 +865,29 @@ Page({ |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
console.log(params.delivery_time + "配送时间id")
|
|
|
if (that.data.last_total_price > 0) {
|
|
|
// if (that.data.amount > 0) {
|
|
|
if (that.data.is_group == 0) {
|
|
|
if (that.data.addressFlag) {
|
|
|
wx.showToast({
|
|
|
title: '请选择收货地址',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
} else if (params.delivery_time == 0) {
|
|
|
wx.showToast({
|
|
|
title: '请选择配送时间',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
} else {
|
|
|
// if (that.data.addressFlag) {
|
|
|
// wx.showToast({
|
|
|
// title: '请选择收货地址',
|
|
|
// icon: 'none'
|
|
|
// })
|
|
|
// } else if (params.delivery_time == 0) {
|
|
|
// wx.showToast({
|
|
|
// title: '请选择配送时间',
|
|
|
// icon: 'none'
|
|
|
// })
|
|
|
// } else {
|
|
|
app.post(url, params).then(res => {
|
|
|
if (res.code == 1) {
|
|
|
var order_sn = res.data.order_sn
|
|
|
var amount = res.data.amount
|
|
|
var dingdanid = res.data.order_id
|
|
|
that.setData({
|
|
|
order_sn: order_sn
|
|
|
order_sn: order_sn,
|
|
|
aamount: amount,
|
|
|
dingdanid:dingdanid
|
|
|
});
|
|
|
let url = '/wxapp/pay/index?order_sn=' + order_sn
|
|
|
app.post(url).then(r => {
|
...
|
...
|
@@ -825,6 +907,9 @@ Page({ |
|
|
that.setData({
|
|
|
showad: true
|
|
|
})
|
|
|
wx.navigateTo({
|
|
|
url: '../paySuccess/paySuccess?order='+dingdanid+'&amount='+that.data.aamount,
|
|
|
})
|
|
|
console.log(showad+"真假值")
|
|
|
},
|
|
|
fail(res) {
|
...
|
...
|
@@ -841,6 +926,9 @@ Page({ |
|
|
title: '支付成功',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
wx.navigateTo({
|
|
|
url: '../paySuccess/paySuccess?order=' + dingdanid + '&amount=' + that.data.aamount,
|
|
|
})
|
|
|
wx.switchTab({
|
|
|
url: '../../index/index',
|
|
|
})
|
...
|
...
|
@@ -854,6 +942,9 @@ Page({ |
|
|
paySign: r.data.jsApiParameters.paySign,
|
|
|
success(res) {
|
|
|
console.log(res);
|
|
|
wx.navigateTo({
|
|
|
url: '../paySuccess/paySuccess?order=' + dingdanid + '&amount=' + that.data.aamount,
|
|
|
})
|
|
|
},
|
|
|
fail(res) {
|
|
|
wx.navigateTo({
|
...
|
...
|
@@ -885,14 +976,14 @@ Page({ |
|
|
return
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
} else {
|
|
|
if (that.data.addressFlag) {
|
|
|
wx.showToast({
|
|
|
title: '请选择收货地址',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
// }
|
|
|
} else {
|
|
|
// if (that.data.addressFlag) {
|
|
|
// wx.showToast({
|
|
|
// title: '请选择收货地址',
|
|
|
// icon: 'none'
|
|
|
// })
|
|
|
// } else {
|
|
|
app.post(url, params).then(res => {
|
|
|
if (res.code == 1) {
|
|
|
var order_sn = res.data.order_sn
|
...
|
...
|
@@ -961,6 +1052,7 @@ Page({ |
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
console.log(2222222222)
|
|
|
wx.showToast({
|
|
|
title: r.msg,
|
|
|
icon: 'none'
|
...
|
...
|
@@ -969,7 +1061,7 @@ Page({ |
|
|
});
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
// }
|
|
|
}
|
|
|
} else {
|
|
|
wx.showToast({
|
...
|
...
|
|