分享朋友圈调整
This commit is contained in:
@@ -9,16 +9,20 @@ Page({
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
disabled : true,//按钮
|
||||
disabled : true, //按钮
|
||||
skuId : '',
|
||||
goodsQty : '', // 产品数量
|
||||
address : '', // 地址
|
||||
addressId : '', // 地址id
|
||||
goodskData : '', // 数据
|
||||
amount : '', // 商品总金额
|
||||
total : '', // 支付金额
|
||||
freight : '', // 运费
|
||||
weight : '', // 重量
|
||||
goodsQty : '', // 产品数量
|
||||
address : '', // 地址
|
||||
goodskData : '', // 数据
|
||||
amount : '', // 商品总金额
|
||||
total : '', // 支付金额
|
||||
freight : '', // 运费
|
||||
weight : '', // 重量
|
||||
distribution : [
|
||||
{ type: 0, title: "快递" },
|
||||
{ type: 1, title: "自提" },
|
||||
],
|
||||
distributionIndex: 0
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -32,30 +36,43 @@ Page({
|
||||
// 获取商品下单信息
|
||||
this.placeInfo(options.skuId, options.qty);
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
* 配送方式选择
|
||||
*/
|
||||
onShow() {},
|
||||
|
||||
distributionChange(e){
|
||||
if(e.detail.value === this.data.distributionIndex) return
|
||||
this.setData({
|
||||
distributionIndex: e.detail.value
|
||||
})
|
||||
this.placeInfo(this.data.skuId, this.data.goodsQty);
|
||||
},
|
||||
/**
|
||||
* 商品下单信息
|
||||
*/
|
||||
placeInfo(skuid, qty) {
|
||||
placeInfo(skuid, qty, type) {
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
mask : true
|
||||
})
|
||||
wx.$api.mall.place({
|
||||
goods_sku_id:skuid,
|
||||
qty: qty,
|
||||
address_id: this.data.addressId
|
||||
goods_sku_id : skuid,
|
||||
qty : qty,
|
||||
address_id : this.data.address.address_id || '',
|
||||
delivery_type: this.data.distributionIndex
|
||||
}).then(res => {
|
||||
if(type != 'chooseAdd'){
|
||||
this.setData({
|
||||
address: res.data.address,
|
||||
})
|
||||
}
|
||||
this.setData({
|
||||
address : res.data.address,
|
||||
addressId : res.data.address.address_id,
|
||||
goodskData: res.data.detail,
|
||||
amount : res.data.amount,
|
||||
total : res.data.total,
|
||||
freight : res.data.freight,
|
||||
weight : res.data.weight
|
||||
})
|
||||
wx.hideLoading()
|
||||
}).catch(err =>{})
|
||||
},
|
||||
|
||||
@@ -70,16 +87,13 @@ Page({
|
||||
wx.$api.mall.placeTrue({
|
||||
goods_sku_id : this.data.skuId,
|
||||
qty : this.data.goodsQty,
|
||||
address_id : this.data.addressId
|
||||
address_id : this.data.address.address_id,
|
||||
delivery_type : this.data.distributionIndex
|
||||
}).then(res => {
|
||||
|
||||
console.log(res)
|
||||
|
||||
wx.redirectTo({
|
||||
url: '/pages/pay/index?params=' + encodeURIComponent(JSON.stringify(res.data))
|
||||
})
|
||||
}).catch(() =>{}).finally(() => {
|
||||
wx.hideLoading()
|
||||
})
|
||||
}).catch(() =>{}).finally(() => {})
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user