|
@@ -175,8 +175,26 @@
|
|
|
<text style="color: #3385FF;width:100%;">到店自取,没有配送费</text>
|
|
<text style="color: #3385FF;width:100%;">到店自取,没有配送费</text>
|
|
|
</view>
|
|
</view>
|
|
|
<view v-if="form.sendType == 2">
|
|
<view v-if="form.sendType == 2">
|
|
|
- <text style="color: #3385FF;width:100%;" v-if="ghsInfo.openIntraCity == 1">有跑腿费</text>
|
|
|
|
|
- <text style="color: #3385FF;width:100%;" v-else>运费自理或到付(请联系客服)</text>
|
|
|
|
|
|
|
+ <text style="color: #3385FF;width:100%;">各平台跑腿费</text>
|
|
|
|
|
+ <!-- 跑腿平台报价列表 -->
|
|
|
|
|
+ <view v-if="deliveryQuotes.length > 0" class="delivery-quotes-container">
|
|
|
|
|
+ <view class="delivery-quotes-grid">
|
|
|
|
|
+ <view
|
|
|
|
|
+ v-for="(item, index) in deliveryQuotes"
|
|
|
|
|
+ :key="index"
|
|
|
|
|
+ class="delivery-quote-item"
|
|
|
|
|
+ :class="{ 'active': selectedDeliveryIndex === index, 'disabled': !item.isAble }"
|
|
|
|
|
+ @click="selectDelivery(item, index)"
|
|
|
|
|
+ >
|
|
|
|
|
+ <view class="platform-name">{{ item.displayName || item.name }}</view>
|
|
|
|
|
+ <view class="platform-price">{{ item.priceText }}元</view>
|
|
|
|
|
+ <view v-if="item.type" class="platform-type">{{ item.type }}</view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view v-else-if="deliveryQuotesLoading" style="text-align: center; padding: 20upx 0; color: #999;">
|
|
|
|
|
+ 正在获取报价...
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
<view v-if="form.sendType == 3">
|
|
<view v-if="form.sendType == 3">
|
|
|
<text style="color: #3385FF;width:100%;">运费到付</text>
|
|
<text style="color: #3385FF;width:100%;">运费到付</text>
|
|
@@ -300,6 +318,7 @@ import { freight,createOrder } from "@/api/purchase";
|
|
|
import { mapActions, mapGetters } from "vuex";
|
|
import { mapActions, mapGetters } from "vuex";
|
|
|
import { shopHouponHas } from '@/api/coupon'
|
|
import { shopHouponHas } from '@/api/coupon'
|
|
|
import {currentShop} from "@/api/shop"
|
|
import {currentShop} from "@/api/shop"
|
|
|
|
|
+import { allDeliveryQuotes } from "@/api/express/delivery";
|
|
|
import ModalModule from "@/components/plugin/modal";
|
|
import ModalModule from "@/components/plugin/modal";
|
|
|
export default {
|
|
export default {
|
|
|
name: "affirmGhs",
|
|
name: "affirmGhs",
|
|
@@ -372,7 +391,11 @@ export default {
|
|
|
needAddPackCost:false,
|
|
needAddPackCost:false,
|
|
|
transCost:[],
|
|
transCost:[],
|
|
|
lackList:[],
|
|
lackList:[],
|
|
|
- showDistance:0
|
|
|
|
|
|
|
+ showDistance:0,
|
|
|
|
|
+ deliveryQuotes: [], // 跑腿平台报价列表
|
|
|
|
|
+ selectedDeliveryIndex: -1, // 选中的报价索引
|
|
|
|
|
+ deliveryQuotesLoading: false, // 报价加载状态
|
|
|
|
|
+ selectedDeliveryData: null // 选中的报价数据
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
onLoad() {
|
|
onLoad() {
|
|
@@ -387,7 +410,10 @@ export default {
|
|
|
}
|
|
}
|
|
|
if(this.form.sendType == 2){
|
|
if(this.form.sendType == 2){
|
|
|
//计算运费
|
|
//计算运费
|
|
|
- this.calcFreight()
|
|
|
|
|
|
|
+ //this.calcFreight()
|
|
|
|
|
+
|
|
|
|
|
+ //各跑腿平台报价
|
|
|
|
|
+ this.getDeliveryQuotes()
|
|
|
}
|
|
}
|
|
|
//修改地址更新
|
|
//修改地址更新
|
|
|
this.getCurrentShop()
|
|
this.getCurrentShop()
|
|
@@ -513,9 +539,86 @@ export default {
|
|
|
this.form.sendType = num
|
|
this.form.sendType = num
|
|
|
if(num == 2){
|
|
if(num == 2){
|
|
|
//计算运费
|
|
//计算运费
|
|
|
- this.calcFreight()
|
|
|
|
|
|
|
+ //this.calcFreight()
|
|
|
|
|
+
|
|
|
|
|
+ //各跑腿平台报价
|
|
|
|
|
+ this.getDeliveryQuotes()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 切换到其他配送方式时清空报价数据
|
|
|
|
|
+ this.deliveryQuotes = []
|
|
|
|
|
+ this.selectedDeliveryIndex = -1
|
|
|
|
|
+ this.selectedDeliveryData = null
|
|
|
|
|
+ this.form.sendCost = 0
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ // 获取跑腿平台报价
|
|
|
|
|
+ getDeliveryQuotes() {
|
|
|
|
|
+ this.deliveryQuotesLoading = true
|
|
|
|
|
+ this.deliveryQuotes = []
|
|
|
|
|
+ this.selectedDeliveryIndex = -1
|
|
|
|
|
+ this.selectedDeliveryData = null
|
|
|
|
|
+
|
|
|
|
|
+ allDeliveryQuotes({
|
|
|
|
|
+ ghsId: this.option.id,
|
|
|
|
|
+ weight: this.allCountFun.weight,
|
|
|
|
|
+ selectList: this.selectList,
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ this.deliveryQuotesLoading = false
|
|
|
|
|
+ if (res.code === 1 && res.data && res.data.deliveryList) {
|
|
|
|
|
+ // 处理报价数据
|
|
|
|
|
+ this.deliveryQuotes = res.data.deliveryList.map(item => {
|
|
|
|
|
+ // 价格从分转换为元
|
|
|
|
|
+ const price = item.price ? (item.price / 100).toFixed(1) : '0.0'
|
|
|
|
|
+
|
|
|
|
|
+ // 提取平台名称(去掉括号内的内容)
|
|
|
|
|
+ let displayName = item.name
|
|
|
|
|
+ if (displayName && displayName.includes('(')) {
|
|
|
|
|
+ displayName = displayName.split('(')[0].trim()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...item,
|
|
|
|
|
+ displayName: displayName,
|
|
|
|
|
+ priceText: price,
|
|
|
|
|
+ priceNumber: parseFloat(price)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ // 自动选中第一个可用的报价
|
|
|
|
|
+ const firstAvailableIndex = this.deliveryQuotes.findIndex(item => item.isAble)
|
|
|
|
|
+ if (firstAvailableIndex !== -1) {
|
|
|
|
|
+ this.selectDelivery(this.deliveryQuotes[firstAvailableIndex], firstAvailableIndex)
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '暂无可用的配送平台',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(err => {
|
|
|
|
|
+ this.deliveryQuotesLoading = false
|
|
|
|
|
+ console.error('获取跑腿报价失败:', err)
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '获取报价失败',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ // 选择跑腿平台
|
|
|
|
|
+ selectDelivery(item, index) {
|
|
|
|
|
+ if (!item.isAble) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '该平台暂不可用',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ })
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.selectedDeliveryIndex = index
|
|
|
|
|
+ this.selectedDeliveryData = item
|
|
|
|
|
+ this.form.sendCost = item.priceNumber
|
|
|
|
|
+ this.showDistance = item.distance || 0
|
|
|
|
|
+ },
|
|
|
modifyAddress(){
|
|
modifyAddress(){
|
|
|
this.$util.pageTo({ url: '/admin/shop/add?id='+this.getLoginInfo.admin.currentShopId})
|
|
this.$util.pageTo({ url: '/admin/shop/add?id='+this.getLoginInfo.admin.currentShopId})
|
|
|
},
|
|
},
|
|
@@ -1126,4 +1229,100 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+/* 跑腿平台报价样式 */
|
|
|
|
|
+.delivery-quotes-container {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ margin-top: 20upx;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.delivery-quotes-grid {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
|
+ justify-content: space-between;
|
|
|
|
|
+ padding: 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.delivery-quote-item {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-direction: column;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ width: 31%;
|
|
|
|
|
+ min-height: 140upx;
|
|
|
|
|
+ padding: 16upx 10upx;
|
|
|
|
|
+ margin-bottom: 15upx;
|
|
|
|
|
+ background: #FFFFFF;
|
|
|
|
|
+ border: 2upx solid #DDDDDD;
|
|
|
|
|
+ border-radius: 8upx;
|
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
|
+ transition: all 0.3s;
|
|
|
|
|
+
|
|
|
|
|
+ .platform-name {
|
|
|
|
|
+ font-size: 26upx;
|
|
|
|
|
+ color: #333;
|
|
|
|
|
+ font-weight: bold;
|
|
|
|
|
+ margin-bottom: 8upx;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ line-height: 1.3;
|
|
|
|
|
+ max-width: 100%;
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ text-overflow: ellipsis;
|
|
|
|
|
+ display: -webkit-box;
|
|
|
|
|
+ -webkit-line-clamp: 2;
|
|
|
|
|
+ line-clamp: 2;
|
|
|
|
|
+ -webkit-box-orient: vertical;
|
|
|
|
|
+ word-break: break-all;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .platform-price {
|
|
|
|
|
+ font-size: 30upx;
|
|
|
|
|
+ color: #333;
|
|
|
|
|
+ font-weight: bold;
|
|
|
|
|
+ margin-bottom: 4upx;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .platform-type {
|
|
|
|
|
+ font-size: 20upx;
|
|
|
|
|
+ color: #868686;
|
|
|
|
|
+ margin-top: 4upx;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ line-height: 1.3;
|
|
|
|
|
+ max-width: 100%;
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ text-overflow: ellipsis;
|
|
|
|
|
+ display: -webkit-box;
|
|
|
|
|
+ -webkit-line-clamp: 2;
|
|
|
|
|
+ line-clamp: 2;
|
|
|
|
|
+ -webkit-box-orient: vertical;
|
|
|
|
|
+ word-break: break-all;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 选中状态
|
|
|
|
|
+ &.active {
|
|
|
|
|
+ background: #09C567;
|
|
|
|
|
+ border-color: #09C567;
|
|
|
|
|
+
|
|
|
|
|
+ .platform-name,
|
|
|
|
|
+ .platform-price {
|
|
|
|
|
+ color: #FFFFFF;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .platform-type {
|
|
|
|
|
+ color: rgba(255, 255, 255, 0.85);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 不可用状态
|
|
|
|
|
+ &.disabled {
|
|
|
|
|
+ opacity: 0.5;
|
|
|
|
|
+ background: #F5F5F5;
|
|
|
|
|
+
|
|
|
|
|
+ .platform-name,
|
|
|
|
|
+ .platform-price,
|
|
|
|
|
+ .platform-type {
|
|
|
|
|
+ color: #CCCCCC;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|