调整配送方式

This commit is contained in:
唐明明
2023-10-11 15:03:27 +08:00
parent 4faf065c96
commit edb08b4f83
7 changed files with 37 additions and 13 deletions

View File

@@ -19,10 +19,12 @@ Page({
freight : '', // 运费
weight : '', // 重量
distribution : [
{ type: 2, title: "请选择配送方式" },
{ type: 0, title: "快递" },
{ type: 1, title: "自提" },
],
distributionIndex: 0
distributionIndex: 0,
distributionType : 2,
},
/**
@@ -42,7 +44,8 @@ Page({
distributionChange(e){
if(e.detail.value === this.data.distributionIndex) return
this.setData({
distributionIndex: e.detail.value
distributionIndex : e.detail.value,
distributionType : this.data.distribution[e.detail.value].type
})
this.placeInfo(this.data.skuId, this.data.goodsQty);
},
@@ -80,6 +83,13 @@ Page({
* 商品确认下单
*/
buyTap() {
if(this.data.distributionIndex == 0){
wx.showToast({
title: '请选择配送方式',
icon : 'none'
})
return
}
wx.showLoading({
title: '下单中...',
mask : true
@@ -88,7 +98,7 @@ Page({
goods_sku_id : this.data.skuId,
qty : this.data.goodsQty,
address_id : this.data.address.address_id,
delivery_type : this.data.distributionIndex
delivery_type : this.data.distributionType
}).then(res => {
wx.redirectTo({
url: '/pages/pay/index?params=' + encodeURIComponent(JSON.stringify(res.data))

View File

@@ -1,5 +1,5 @@
<!-- 地址 -->
<view class="address" wx:if="{{distributionIndex == 0}}">
<view class="address" wx:if="{{distributionIndex == 1}}">
<navigator hover-class="none" url="/pages/site/index?type=goodsAddress&skuid={{skuId}}&qty={{goodsQty}}" class="address-cont" wx:if="{{address}}">
<view class="address-top">
<view class="address-area">