调整配送方式

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

@@ -7,9 +7,9 @@ import { errInfo } from './err'
import { updToken } from './updateToken' import { updToken } from './updateToken'
// 正式地址 // 正式地址
// const api = "https://api.xuanhuojk.com/api/" const api = "https://api.xuanhuojk.com/api/"
// 测试地址 // 测试地址
const api = "https://api.xhtest.douhuofalv.com/api/" // const api = "https://api.xhtest.douhuofalv.com/api/"
const header = { const header = {
"Accept" : "application/json" "Accept" : "application/json"
} }

View File

@@ -61,6 +61,7 @@
<block wx:else> <block wx:else>
<!-- 用户未登录 --> <!-- 用户未登录 -->
<view class="pack-center pages-loding auth-login"> <view class="pack-center pages-loding auth-login">
<image src="/static/icons/carnull_icon.png"></image>
<view>您还未登录,无法查看您的购物车信息</view> <view>您还未登录,无法查看您的购物车信息</view>
<navigator class="auth-btn" url="/pages/login/index">登录</navigator> <navigator class="auth-btn" url="/pages/login/index">登录</navigator>
</view> </view>

View File

@@ -110,5 +110,6 @@
.checkbox checkbox .wx-checkbox-input.wx-checkbox-input-checked:before{ top: 18rpx; right: 5rpx; color: white; line-height: 34rpx; text-align: center; width: 36rpx; height: 36rpx; font-size:36rpx; } .checkbox checkbox .wx-checkbox-input.wx-checkbox-input-checked:before{ top: 18rpx; right: 5rpx; color: white; line-height: 34rpx; text-align: center; width: 36rpx; height: 36rpx; font-size:36rpx; }
/* 未登录 */ /* 未登录 */
.auth-login{ text-align: center; font-size: 28rpx; color: gray; } .auth-login{ text-align: center; font-size: 28rpx; color: gray; background: white; }
.auth-login image{ width: 218rpx; height: 218rpx; margin-bottom: 30rpx; }
.auth-btn{ background: #da2b54; display: inline-block; width: 240rpx; height: 80rpx; line-height: 80rpx; border-radius: 40rpx; font-size: 32rpx; color: white; margin-top: 100rpx; } .auth-btn{ background: #da2b54; display: inline-block; width: 240rpx; height: 80rpx; line-height: 80rpx; border-radius: 40rpx; font-size: 32rpx; color: white; margin-top: 100rpx; }

View File

@@ -18,11 +18,12 @@ Page({
freight : '', // 运费 freight : '', // 运费
weight : '', // 重量 weight : '', // 重量
distribution : [ distribution : [
{ type: 0, title: "选择配送方式" }, { type: 2, title: "选择配送方式" },
{ type: 1, title: "快递" }, { type: 0, title: "快递" },
{ type: 2, title: "自提" }, { type: 1, title: "自提" },
], ],
distributionIndex: 0 distributionIndex: 0,
distributionType : 2
}, },
/** /**
@@ -42,7 +43,8 @@ Page({
distributionChange(e){ distributionChange(e){
if(e.detail.value === this.data.distributionIndex) return if(e.detail.value === this.data.distributionIndex) return
this.setData({ this.setData({
distributionIndex: e.detail.value distributionIndex : e.detail.value,
distributionType : this.data.distribution[e.detail.value].type
}) })
this.placeInfo(this.data.skuId); this.placeInfo(this.data.skuId);
}, },
@@ -94,7 +96,7 @@ Page({
cart_ids : this.data.skuId, cart_ids : this.data.skuId,
address_id : this.data.address.address_id, address_id : this.data.address.address_id,
remark : '', remark : '',
delivery_type : this.data.distributionIndex delivery_type : this.data.distributionType
}).then(res => { }).then(res => {
wx.redirectTo({ wx.redirectTo({
url: '/pages/pay/index?params=' + encodeURIComponent(JSON.stringify(res.data)) url: '/pages/pay/index?params=' + encodeURIComponent(JSON.stringify(res.data))

View File

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

View File

@@ -296,6 +296,16 @@ Page({
}) })
return return
} }
// 是否有推荐人
if(!this.data.goodsData.has_parent) {
this.setData({
isParent : true,
goodsSize : false
})
return
}
wx.showLoading({ wx.showLoading({
title: '加载中...', title: '加载中...',
mask : true mask : true