...
|
...
|
@@ -13,49 +13,51 @@ Page({ |
|
|
area: '',
|
|
|
address: '',
|
|
|
cover_type: false,
|
|
|
total:'',
|
|
|
info:{
|
|
|
address:{
|
|
|
address:'',
|
|
|
area:'',
|
|
|
id:'',
|
|
|
tel:'',
|
|
|
name:'',
|
|
|
goods:[]
|
|
|
}
|
|
|
total: '',
|
|
|
info: {
|
|
|
address: {
|
|
|
address: '',
|
|
|
area: '',
|
|
|
id: '',
|
|
|
tel: '',
|
|
|
name: '',
|
|
|
goods: []
|
|
|
},
|
|
|
totalnum:'',
|
|
|
datak:1,
|
|
|
car_ids:[],
|
|
|
user_ticket_id2:'',
|
|
|
user_ticket_id1:'',
|
|
|
coupon:'',
|
|
|
couponone:'',
|
|
|
nouse:'',
|
|
|
obj:'',
|
|
|
type:0,
|
|
|
combo_id:'',
|
|
|
entrance_type:''
|
|
|
goods: {}
|
|
|
},
|
|
|
totalnum: '',
|
|
|
datak: 1,
|
|
|
car_ids: [],
|
|
|
user_ticket_id2: '',
|
|
|
user_ticket_id1: '',
|
|
|
coupon: '',
|
|
|
couponone: '',
|
|
|
nouse: '',
|
|
|
obj: '',
|
|
|
type: 0,
|
|
|
combo_id: '',
|
|
|
entrance_type: '',
|
|
|
copyaddress: '',
|
|
|
},
|
|
|
|
|
|
// 选择优惠券
|
|
|
selectcoupon(e){
|
|
|
let goods=this.data.info.goods;
|
|
|
selectcoupon(e) {
|
|
|
let goods = this.data.info.goods;
|
|
|
console.log(goods)
|
|
|
let arr=[]
|
|
|
goods.forEach(function(value,index,array){
|
|
|
let arr = []
|
|
|
goods.forEach(function (value, index, array) {
|
|
|
arr.push(value.id)
|
|
|
})
|
|
|
let couponid=e.currentTarget.dataset.id;
|
|
|
let couponid = e.currentTarget.dataset.id;
|
|
|
console.log(couponid)
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/lingqucoupon/lingqucoupon?type='+couponid+'&total='+this.data.info.real_total +'&goods_ids='+JSON.stringify(arr)
|
|
|
url: '/pages/lingqucoupon/lingqucoupon?type=' + couponid + '&total=' + this.data.info.real_total + '&goods_ids=' + JSON.stringify(arr)
|
|
|
})
|
|
|
},
|
|
|
// 领取优惠券
|
|
|
lingqucoupon(){
|
|
|
lingqucoupon() {
|
|
|
wx.navigateTo({
|
|
|
url:'/pages/coupon/coupon?type='+2
|
|
|
url: '/pages/coupon/coupon?type=' + 2
|
|
|
})
|
|
|
},
|
|
|
//加减商品数量
|
...
|
...
|
@@ -96,7 +98,7 @@ Page({ |
|
|
for (let obj of coudan_arr) {
|
|
|
console.log(obj)
|
|
|
console.log(obj.price2)
|
|
|
if (obj.price2!= null) {
|
|
|
if (obj.price2 != null) {
|
|
|
console.log(111)
|
|
|
choudan_money = (obj.price2 * 100 * obj.num) / 100 + choudan_money
|
|
|
} else {
|
...
|
...
|
@@ -107,7 +109,7 @@ Page({ |
|
|
console.log(typeof (choudan_money))
|
|
|
console.log(choudan_money)
|
|
|
this.setData({
|
|
|
choudan_money: choudan_money*100
|
|
|
choudan_money: choudan_money * 100
|
|
|
// choudan_money: Math.floor(choudan_money* 100) / 100
|
|
|
})
|
|
|
},
|
...
|
...
|
@@ -171,7 +173,7 @@ Page({ |
|
|
id: id,
|
|
|
num: num,
|
|
|
price: Number(price),
|
|
|
price2:Number(price2)
|
|
|
price2: Number(price2)
|
|
|
})
|
|
|
}
|
|
|
that.setData({
|
...
|
...
|
@@ -182,10 +184,10 @@ Page({ |
|
|
that.get_choudan()
|
|
|
},
|
|
|
//获取页面信息
|
|
|
get_info(combo_id,data,address_id,user_ticket_id1,user_ticket_id2) {
|
|
|
get_info(combo_id, data, address_id, user_ticket_id1, user_ticket_id2) {
|
|
|
let that = this
|
|
|
let url = that.data.type == 4 ? app.interface.prev_pay : that.data.type == 3?app.interface.now_prev_pay:'/order/affirm';
|
|
|
if(that.data.type == 3 || that.data.type == 4){
|
|
|
let url = that.data.type == 4 ? app.interface.prev_pay : that.data.type == 3 ? app.interface.now_prev_pay : '/order/affirm';
|
|
|
if (that.data.type == 3 || that.data.type == 4) {
|
|
|
let params = {
|
|
|
info: that.data.params,
|
|
|
address_id: address_id
|
...
|
...
|
@@ -199,44 +201,57 @@ Page({ |
|
|
|
|
|
that.setData({
|
|
|
info: res.msg,
|
|
|
total:total
|
|
|
total: total
|
|
|
|
|
|
})
|
|
|
|
|
|
console.log('9988756', that.data.info)
|
|
|
|
|
|
})
|
|
|
}else{
|
|
|
} else {
|
|
|
let params = {
|
|
|
combo_id:combo_id,
|
|
|
data:data,
|
|
|
address_id:address_id,
|
|
|
user_ticket_id1:user_ticket_id1,
|
|
|
user_ticket_id2:user_ticket_id2
|
|
|
combo_id: combo_id,
|
|
|
data: data,
|
|
|
address_id: address_id,
|
|
|
user_ticket_id1: user_ticket_id1,
|
|
|
user_ticket_id2: user_ticket_id2
|
|
|
}
|
|
|
app.postk(url, params).then((res) => {
|
|
|
console.log('99999', res, Number(res.data.total))
|
|
|
let coupon=wx.getStorageSync('coupon');
|
|
|
if(coupon!=''){
|
|
|
let coupon = wx.getStorageSync('coupon');
|
|
|
if (coupon != '') {
|
|
|
this.setData({
|
|
|
coupon:wx.getStorageSync('coupon')
|
|
|
coupon: wx.getStorageSync('coupon')
|
|
|
})
|
|
|
}
|
|
|
let couponone=wx.getStorageSync('couponone');
|
|
|
if(couponone!=''){
|
|
|
let couponone = wx.getStorageSync('couponone');
|
|
|
if (couponone != '') {
|
|
|
this.setData({
|
|
|
couponone:wx.getStorageSync('couponone')
|
|
|
couponone: wx.getStorageSync('couponone')
|
|
|
})
|
|
|
}
|
|
|
console.log(this.data.couponone)
|
|
|
res.data.total = Number(res.data.total * 100)/100
|
|
|
res.data.freight = Number(res.data.freight * 100)/100
|
|
|
res.data.sum_goods_total= Number(res.data.sum_goods_total * 100)/100
|
|
|
res.data.total = Number(res.data.total * 100) / 100
|
|
|
res.data.freight = Number(res.data.freight * 100) / 100
|
|
|
res.data.sum_goods_total = Number(res.data.sum_goods_total * 100) / 100
|
|
|
// let total = (res.msg.total + res.data.yunfei).toFixed("1");
|
|
|
console.log(res.data)
|
|
|
that.setData({
|
|
|
info: res.data,
|
|
|
totalnum:res.data.goods.length
|
|
|
totalnum: res.data.goods.length,
|
|
|
})
|
|
|
let info = that.data.info
|
|
|
console.log(info)
|
|
|
info.address = {}
|
|
|
info.address.address = that.data.copyaddress.address
|
|
|
info.address.area = that.data.copyaddress.area
|
|
|
info.address.id = that.data.copyaddress.id
|
|
|
info.address.tel = that.data.copyaddress.tel
|
|
|
info.address.name = that.data.copyaddress.name
|
|
|
that.setData({
|
|
|
info
|
|
|
})
|
|
|
console.log(info)
|
|
|
console.log('9988756', that.data.info.goods)
|
|
|
}).catch(function (err) {
|
|
|
console.log(err);
|
...
|
...
|
@@ -270,34 +285,34 @@ Page({ |
|
|
|
|
|
// })
|
|
|
// },
|
|
|
get_info1(combo_id,data,address_id,user_ticket_id1,user_ticket_id2) {
|
|
|
get_info1(combo_id, data, address_id, user_ticket_id1, user_ticket_id2) {
|
|
|
let that = this
|
|
|
// let url='/order/affirm'
|
|
|
// 判断进入入口
|
|
|
|
|
|
let url = type == 3 ? app.interface.now_prev_pay : app.interface.prev_pay
|
|
|
let params = {
|
|
|
combo_id:combo_id,
|
|
|
data:data,
|
|
|
address_id:address_id,
|
|
|
user_ticket_id1:user_ticket_id1,
|
|
|
user_ticket_id2:user_ticket_id2,
|
|
|
combo_id: combo_id,
|
|
|
data: data,
|
|
|
address_id: address_id,
|
|
|
user_ticket_id1: user_ticket_id1,
|
|
|
user_ticket_id2: user_ticket_id2,
|
|
|
}
|
|
|
app.postk(url, params).then((res) => {
|
|
|
let couponone=wx.getStorageSync('couponone');
|
|
|
if(couponone!=''){
|
|
|
let couponone = wx.getStorageSync('couponone');
|
|
|
if (couponone != '') {
|
|
|
this.setData({
|
|
|
couponone:wx.getStorageSync('couponone')
|
|
|
couponone: wx.getStorageSync('couponone')
|
|
|
})
|
|
|
}
|
|
|
console.log(this.data.couponone)
|
|
|
res.data.total = Number(res.data.total * 100)/100
|
|
|
res.data.freight = Number(res.data.freight * 100)/100
|
|
|
res.data.sum_goods_total= Number(res.data.sum_goods_total * 100)/100
|
|
|
res.data.total = Number(res.data.total * 100) / 100
|
|
|
res.data.freight = Number(res.data.freight * 100) / 100
|
|
|
res.data.sum_goods_total = Number(res.data.sum_goods_total * 100) / 100
|
|
|
// let total = (res.msg.total + res.data.yunfei).toFixed("1");
|
|
|
that.setData({
|
|
|
info: res.data,
|
|
|
totalnum:res.data.goods.length
|
|
|
totalnum: res.data.goods.length
|
|
|
})
|
|
|
console.log('9988756', that.data.info.goods)
|
|
|
}).catch(function (err) {
|
...
|
...
|
@@ -314,7 +329,7 @@ Page({ |
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
that.setData({
|
|
|
"info.yunfei": Number(res.msg.yunfei)*100
|
|
|
"info.yunfei": Number(res.msg.yunfei) * 100
|
|
|
})
|
|
|
})
|
|
|
},
|
...
|
...
|
@@ -344,19 +359,19 @@ Page({ |
|
|
if (coudan && coudan.length > 0) {
|
|
|
info = info.concat(coudan)
|
|
|
}
|
|
|
let arr=[];
|
|
|
let arr = [];
|
|
|
arr.push(that.data.obj)
|
|
|
let url = '/order/create_order';
|
|
|
console.log('9998887755',that.data.datak)
|
|
|
let data=that.data.datak
|
|
|
console.log('9998887755', that.data.datak)
|
|
|
let data = that.data.datak
|
|
|
let params = {
|
|
|
combo_id: that.data.combo_id,
|
|
|
data:that.data.datak,
|
|
|
car_ids:that.data.car_ids.join(","),
|
|
|
data: that.data.datak,
|
|
|
car_ids: that.data.car_ids.join(","),
|
|
|
// info: JSON.stringify(info),
|
|
|
address_id:that.data.info.address.id,
|
|
|
user_ticket_id1:that.data.user_ticket_id1,
|
|
|
user_ticket_id2:that.data.user_ticket_id2,
|
|
|
address_id: that.data.info.address.id,
|
|
|
user_ticket_id1: that.data.user_ticket_id1,
|
|
|
user_ticket_id2: that.data.user_ticket_id2,
|
|
|
// data:JSON.stringify(arr),
|
|
|
}
|
|
|
console.log(params)
|
...
|
...
|
@@ -371,8 +386,8 @@ Page({ |
|
|
// }
|
|
|
|
|
|
},
|
|
|
//点击支付
|
|
|
submit_score() {
|
|
|
//点击支付
|
|
|
submit_score() {
|
|
|
let that = this;
|
|
|
let list = that.data.info.products
|
|
|
let coudan = that.data.coudan
|
...
|
...
|
@@ -407,10 +422,10 @@ submit_score() { |
|
|
})
|
|
|
that.order_pay_score(res.msg)
|
|
|
})
|
|
|
},
|
|
|
},
|
|
|
|
|
|
//积分商城订单支付
|
|
|
order_pay_score(order_odd) {
|
|
|
//积分商城订单支付
|
|
|
order_pay_score(order_odd) {
|
|
|
let url = app.interface.order_pay
|
|
|
let params = {
|
|
|
order_odd: order_odd
|
...
|
...
|
@@ -429,11 +444,11 @@ order_pay_score(order_odd) { |
|
|
})
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
},
|
|
|
|
|
|
//开放订单支付
|
|
|
order_pay(order_odd) {
|
|
|
let that=this;
|
|
|
let that = this;
|
|
|
let url = '/order/pay'
|
|
|
let params = {
|
|
|
order_id: order_odd
|
...
|
...
|
@@ -453,13 +468,13 @@ order_pay_score(order_odd) { |
|
|
package: res.package,
|
|
|
signType: res.signType,
|
|
|
paySign: res.paySign,
|
|
|
success: function(res) {
|
|
|
success: function (res) {
|
|
|
console.log(res)
|
|
|
wx.redirectTo({
|
|
|
url: '/pages/order/order_list/order_list?type=' +1+'&statusk='+2,
|
|
|
url: '/pages/order/order_list/order_list?type=' + 1 + '&statusk=' + 2,
|
|
|
})
|
|
|
},
|
|
|
fail: function(res) {
|
|
|
fail: function (res) {
|
|
|
console.log(123);
|
|
|
console.log(res);
|
|
|
}
|
...
|
...
|
@@ -468,43 +483,44 @@ order_pay_score(order_odd) { |
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function(options) {
|
|
|
onLoad: function (options) {
|
|
|
|
|
|
if(options.obj){
|
|
|
if (options.obj) {
|
|
|
this.setData({
|
|
|
obj:JSON.parse(options.obj)
|
|
|
obj: JSON.parse(options.obj)
|
|
|
})
|
|
|
}
|
|
|
this.setData({
|
|
|
type: options.type,
|
|
|
entrance_type:wx.getStorageSync('entrance_type'),
|
|
|
entrance_type: wx.getStorageSync('entrance_type'),
|
|
|
params: options.info,
|
|
|
datak:options.info,
|
|
|
datak: options.info,
|
|
|
})
|
|
|
if(options.car_id){
|
|
|
if (options.car_id) {
|
|
|
this.setData({
|
|
|
car_ids:JSON.parse(options.car_id)
|
|
|
car_ids: JSON.parse(options.car_id)
|
|
|
})
|
|
|
}
|
|
|
console.log('343购物车id',this.data.car_ids)
|
|
|
this.get_info('', options.info, '','','')
|
|
|
console.log('343购物车id', this.data.car_ids)
|
|
|
this.get_info('', options.info, '', '', '')
|
|
|
},
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
|
onReady: function() {
|
|
|
onReady: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function() {
|
|
|
onShow: function () {
|
|
|
let pages = getCurrentPages();
|
|
|
let currPage = pages[pages.length - 1]
|
|
|
console.log('887766554',this.data.params)
|
|
|
console.log('887766554', this.data.params)
|
|
|
console.log(currPage.data)
|
|
|
if (currPage.data.id) {
|
|
|
this.setData({
|
|
|
"info.address.address": currPage.data.address,
|
...
|
...
|
@@ -512,16 +528,23 @@ order_pay_score(order_odd) { |
|
|
"info.address.id": currPage.data.id,
|
|
|
"info.address.tel": currPage.data.tel,
|
|
|
"info.address.name": currPage.data.name,
|
|
|
copyaddress: {
|
|
|
address: currPage.data.address,
|
|
|
area: currPage.data.area,
|
|
|
id: currPage.data.id,
|
|
|
tel: currPage.data.tel,
|
|
|
name: currPage.data.name,
|
|
|
}
|
|
|
})
|
|
|
// this.get_youfei(currPage.data.user_ticket_id1)
|
|
|
}
|
|
|
|
|
|
|
|
|
console.log(this.data.info.address.address)
|
|
|
this.setData({
|
|
|
user_ticket_id1:currPage.data.user_ticket_id1
|
|
|
user_ticket_id1: currPage.data.user_ticket_id1
|
|
|
})
|
|
|
|
|
|
this.get_info('', this.data.params, currPage.data.id,currPage.data.user_ticket_id1,currPage.data.user_ticket_id2)
|
|
|
this.get_info('', this.data.params, currPage.data.id, currPage.data.user_ticket_id1, currPage.data.user_ticket_id2)
|
|
|
|
|
|
// if (currPage.data.user_ticket_id2) {
|
|
|
// console.log(66666,this.data.params)
|
...
|
...
|
@@ -541,35 +564,35 @@ order_pay_score(order_odd) { |
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
onHide: function() {
|
|
|
onHide: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
onUnload: function() {
|
|
|
onUnload: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
*/
|
|
|
onPullDownRefresh: function() {
|
|
|
onPullDownRefresh: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
onReachBottom: function() {
|
|
|
onReachBottom: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 用户点击右上角分享
|
|
|
*/
|
|
|
onShareAppMessage: function() {
|
|
|
onShareAppMessage: function () {
|
|
|
|
|
|
}
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|