|
|
@@ -11,31 +11,6 @@
|
|
|
{{ ghsInfo.fullAddress }}
|
|
|
</view>
|
|
|
</view>
|
|
|
- <!-- 公告轮播 -->
|
|
|
- <view class="ghs-notice-wrap" v-if="ghsNoticeList.length">
|
|
|
- <view class="ghs-notice-bar" @click.stop="openGhsNoticeDetail()">
|
|
|
- <swiper
|
|
|
- class="ghs-notice-swiper"
|
|
|
- :key="'ghs-notice-' + ghsNoticeList.length"
|
|
|
- vertical
|
|
|
- :autoplay="ghsNoticeList.length > 1"
|
|
|
- :circular="ghsNoticeList.length > 1"
|
|
|
- :interval="4000"
|
|
|
- :duration="400"
|
|
|
- :skip-hidden-item-layout="true"
|
|
|
- @change="onGhsNoticeChange"
|
|
|
- >
|
|
|
- <swiper-item v-for="item in ghsNoticeList" :key="item.id" class="ghs-notice-slide">
|
|
|
- <view class="ghs-notice-item">
|
|
|
- <text class="ghs-notice-summary">【公告】{{ item.summary }}</text>
|
|
|
- </view>
|
|
|
- </swiper-item>
|
|
|
- </swiper>
|
|
|
- <view class="ghs-notice-arrow-wrap">
|
|
|
- <text class="ghs-notice-arrow">›</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
<view class="module-com">
|
|
|
<view class="commodity-view">
|
|
|
<view class="commodity-list">
|
|
|
@@ -310,12 +285,12 @@
|
|
|
<!-- 跑腿平台报价列表 -->
|
|
|
<view v-if="ghsInfo.openIntraCity == 1 && deliveryQuotes.length > 0" class="delivery-quotes-container">
|
|
|
<view class="delivery-quotes-grid">
|
|
|
- <view
|
|
|
- v-for="(item, index) in deliveryQuotes"
|
|
|
+ <view
|
|
|
+ v-for="(item, index) in deliveryQuotes"
|
|
|
:key="index"
|
|
|
class="delivery-quote-item"
|
|
|
- :class="{
|
|
|
- 'active': selectedDeliveryIndex === index,
|
|
|
+ :class="{
|
|
|
+ 'active': selectedDeliveryIndex === index,
|
|
|
'disabled': !item.isAble,
|
|
|
'fixed-width': deliveryQuotes.length <= 2
|
|
|
}"
|
|
|
@@ -425,7 +400,7 @@ import appFormSend from "@/components/app-form-send";
|
|
|
import appSendTime from "@/components/app-send-time";
|
|
|
const formUtil = require("@/utils/formValidation.js");
|
|
|
import AppDatePicker from "@/components/app-date-picker";
|
|
|
-import { getGhsDataApi, getWlList, ghsCommonInfo } from "@/api/ghs";
|
|
|
+import { getGhsDataApi,getWlList } from "@/api/ghs";
|
|
|
import { freight,createOrder } from "@/api/purchase";
|
|
|
import { mapActions, mapGetters } from "vuex";
|
|
|
import { shopHouponHas } from '@/api/coupon'
|
|
|
@@ -511,9 +486,7 @@ export default {
|
|
|
selectedDeliveryIndex: -1, // 选中的报价索引
|
|
|
selectedDeliveryData: null, // 选中的报价数据
|
|
|
deliveryPolicyList: [], // 包配送政策列表
|
|
|
- validAddress:false,
|
|
|
- ghsNoticeList: [],
|
|
|
- currentNoticeIndex: 0
|
|
|
+ validAddress:false
|
|
|
};
|
|
|
},
|
|
|
onLoad() {
|
|
|
@@ -590,12 +563,12 @@ export default {
|
|
|
// showDistance单位是米,hcFreeKm单位是千米
|
|
|
const distanceInMeters = Number(this.showDistance) || 0
|
|
|
const freeKmInMeters = (Number(this.ghsInfo.hcFreeKm) || 0) * 1000
|
|
|
-
|
|
|
+
|
|
|
// 如果距离小于免费公里数,则免运费
|
|
|
if(distanceInMeters < freeKmInMeters){
|
|
|
return true
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 条件2: 如果距离大于免费公里数,判断hcMap
|
|
|
if(distanceInMeters > freeKmInMeters){
|
|
|
if(this.ghsInfo.hcMap && typeof this.ghsInfo.hcMap == 'string'){
|
|
|
@@ -607,13 +580,13 @@ export default {
|
|
|
// 获取花材数量和总价
|
|
|
const flowerCount = this.allCountFun.bigLength || 0
|
|
|
const flowerPrice = this.allPriceFun || 0
|
|
|
-
|
|
|
+
|
|
|
// 遍历hcMap,检查是否满足免运费条件
|
|
|
for(const rule of this.ghsInfo.hcMap){
|
|
|
const ruleNum = Number(rule.num) || 0
|
|
|
const rulePrice = Number(rule.price) || 0
|
|
|
const ruleDistance = (Number(rule.distance) || 0) * 1000 // 转换为米
|
|
|
-
|
|
|
+
|
|
|
// 如果花材数量大于num,花材总价大于price,距离小于distance,则免运费
|
|
|
if(flowerCount >= ruleNum && flowerPrice >= rulePrice && distanceInMeters <= ruleDistance){
|
|
|
console.log('满足免运费条件:',flowerCount,ruleNum,flowerPrice,rulePrice,distanceInMeters,ruleDistance)
|
|
|
@@ -625,12 +598,12 @@ export default {
|
|
|
console.log('hcMap数据为空')
|
|
|
return false
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
console.log('this.ghsInfo.hcMap: ',this.ghsInfo.hcMap)
|
|
|
console.log('hcMap数据格式出问题了')
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return false
|
|
|
},
|
|
|
/**
|
|
|
@@ -638,10 +611,10 @@ export default {
|
|
|
*/
|
|
|
showDeliveryPolicy() {
|
|
|
if (!this.ghsInfo) return false
|
|
|
-
|
|
|
+
|
|
|
// 检查 hcFreeKm
|
|
|
const hasFreeKm = this.ghsInfo.hcFreeKm ?Number(this.ghsInfo.hcFreeKm):0
|
|
|
-
|
|
|
+
|
|
|
// 检查 hcMap
|
|
|
let hasPolicy = false
|
|
|
let mapData = this.ghsInfo.hcMap
|
|
|
@@ -710,12 +683,12 @@ export default {
|
|
|
// 展示包配送政策弹窗
|
|
|
showDeliveryPolicyModal() {
|
|
|
this.deliveryPolicyList = []
|
|
|
-
|
|
|
+
|
|
|
// 1. hcFreeKm 规则
|
|
|
if (this.ghsInfo.hcFreeKm && Number(this.ghsInfo.hcFreeKm) > 0) {
|
|
|
this.deliveryPolicyList.push(`${Number(this.ghsInfo.hcFreeKm)}公里内免费配送`)
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 2. hcMap 规则
|
|
|
let mapData = this.ghsInfo.hcMap
|
|
|
if(mapData && typeof mapData == 'string'){
|
|
|
@@ -730,11 +703,11 @@ export default {
|
|
|
const num = Number(rule.num) || 0
|
|
|
const price = Number(rule.price) || 0
|
|
|
const distance = Number(rule.distance) || 0
|
|
|
-
|
|
|
+
|
|
|
this.deliveryPolicyList.push(`满${num}扎${price}元,${distance}公里内免费配送`)
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (this.deliveryPolicyList.length === 0) {
|
|
|
uni.showToast({
|
|
|
title: '暂无详细配送政策',
|
|
|
@@ -742,7 +715,7 @@ export default {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
this.$refs.deliveryPolicyPopup.open()
|
|
|
},
|
|
|
closeDeliveryPolicy() {
|
|
|
@@ -826,7 +799,7 @@ export default {
|
|
|
this.deliveryQuotes = []
|
|
|
this.selectedDeliveryIndex = -1
|
|
|
this.selectedDeliveryData = null
|
|
|
-
|
|
|
+
|
|
|
allDeliveryQuotes({
|
|
|
ghsId: this.option.id,
|
|
|
totalPrice: this.allPriceFun,
|
|
|
@@ -842,7 +815,7 @@ export default {
|
|
|
.map(item => {
|
|
|
// 价格从分转换为元
|
|
|
const price = item.price ? (item.price / 100).toFixed(1) : '0.0'
|
|
|
-
|
|
|
+
|
|
|
// 提取平台名称(去掉括号内的内容)
|
|
|
let displayName = item.name
|
|
|
let bracketContent = ''
|
|
|
@@ -855,7 +828,7 @@ export default {
|
|
|
if(item.en_name == 'didi' && bracketContent != ''){
|
|
|
item.type = bracketContent
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return {
|
|
|
...item,
|
|
|
displayName: displayName,
|
|
|
@@ -864,7 +837,7 @@ export default {
|
|
|
bracketContent: bracketContent
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
// 自动选中第一个可用的报价
|
|
|
const firstAvailableIndex = this.deliveryQuotes.findIndex(item => item.isAble)
|
|
|
if (firstAvailableIndex !== -1) {
|
|
|
@@ -1112,32 +1085,8 @@ export default {
|
|
|
this.changeTransType(4)
|
|
|
}
|
|
|
|
|
|
- that.fetchGhsNoticeList()
|
|
|
});
|
|
|
},
|
|
|
- onGhsNoticeChange(e) {
|
|
|
- this.currentNoticeIndex = e.detail.current || 0
|
|
|
- },
|
|
|
- openGhsNoticeDetail() {
|
|
|
- const item = this.ghsNoticeList[this.currentNoticeIndex]
|
|
|
- if (!item || !item.id) return
|
|
|
- this.$util.pageTo({ url: `/pagesPurchase/ghsNoticeDetail?id=${item.id}` })
|
|
|
- },
|
|
|
- fetchGhsNoticeList() {
|
|
|
- const ghsId = this.option.id ? Number(this.option.id) : 0
|
|
|
- if (ghsId <= 0) {
|
|
|
- this.ghsNoticeList = []
|
|
|
- return
|
|
|
- }
|
|
|
- ghsCommonInfo({ ghsId }).then(res => {
|
|
|
- const allList = (res.data && res.data.ghsNoticeList) ? res.data.ghsNoticeList : []
|
|
|
- // 订单提交:positions 含 2
|
|
|
- this.ghsNoticeList = allList.filter(item => (item.positions || []).includes(2))
|
|
|
- this.currentNoticeIndex = 0
|
|
|
- }).catch(() => {
|
|
|
- this.ghsNoticeList = []
|
|
|
- })
|
|
|
- },
|
|
|
countAllPrices(e){
|
|
|
this.allPrices = this.allPrices+Number(this.form.sendCost)
|
|
|
},
|
|
|
@@ -1194,7 +1143,7 @@ export default {
|
|
|
version:10,
|
|
|
direct:direct
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 如果选择了跑腿配送并且有选中的平台数据,则添加配送平台信息
|
|
|
if (this.form.sendType == 2 && this.selectedDeliveryData) {
|
|
|
params.deliveryPlatform = this.selectedDeliveryData.en_name // 平台名称
|
|
|
@@ -1271,9 +1220,9 @@ export default {
|
|
|
}
|
|
|
try {
|
|
|
r2 = arg2.toString().split(".")[1].length
|
|
|
- } catch (e) {
|
|
|
- r2 = 0
|
|
|
- }
|
|
|
+ } catch (e) {
|
|
|
+ r2 = 0
|
|
|
+ }
|
|
|
m = Math.pow(10, Math.max(r1, r2))
|
|
|
n = (r1 >= r2) ? r1 : r2;
|
|
|
return ((arg1 * m + arg2 * m) / m).toFixed(n);
|
|
|
@@ -1290,7 +1239,7 @@ export default {
|
|
|
} catch (e) {
|
|
|
re2 = 0;
|
|
|
}
|
|
|
- m = Math.pow(10, Math.max(re1, re2));
|
|
|
+ m = Math.pow(10, Math.max(re1, re2));
|
|
|
n = (re1 >= re2) ? re1 : re2;
|
|
|
return ((arg1 * m - arg2 * m) / m).toFixed(n);
|
|
|
},
|
|
|
@@ -1649,13 +1598,13 @@ export default {
|
|
|
border-radius: 8upx;
|
|
|
box-sizing: border-box;
|
|
|
transition: all 0.3s;
|
|
|
-
|
|
|
+
|
|
|
// 当只有1-2项时使用固定宽度
|
|
|
&.fixed-width {
|
|
|
flex: 0 0 220rpx;
|
|
|
width: 220rpx;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.platform-name {
|
|
|
font-size: 26upx;
|
|
|
color: #333;
|
|
|
@@ -1672,14 +1621,14 @@ export default {
|
|
|
-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;
|
|
|
@@ -1695,27 +1644,27 @@ export default {
|
|
|
-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 {
|
|
|
@@ -1795,74 +1744,4 @@ export default {
|
|
|
font-size: 32upx;
|
|
|
border-radius: 40upx;
|
|
|
}
|
|
|
-
|
|
|
-.ghs-notice-wrap {
|
|
|
- margin-bottom: 20upx;
|
|
|
-}
|
|
|
-
|
|
|
-.ghs-notice-bar {
|
|
|
- padding: 0 0 0 20upx;
|
|
|
- height: 168upx;
|
|
|
- background: #3385FF;
|
|
|
- border-radius: 10upx;
|
|
|
- box-shadow: 0upx 4upx 12upx rgba(51, 133, 255, 0.2);
|
|
|
- box-sizing: border-box;
|
|
|
- display: flex;
|
|
|
- align-items: stretch;
|
|
|
- overflow: hidden;
|
|
|
-}
|
|
|
-
|
|
|
-.ghs-notice-swiper {
|
|
|
- flex: 1;
|
|
|
- width: 0;
|
|
|
- height: 168upx;
|
|
|
- min-width: 0;
|
|
|
- background: transparent;
|
|
|
-}
|
|
|
-
|
|
|
-.ghs-notice-slide,
|
|
|
-.ghs-notice-item {
|
|
|
- height: 168upx;
|
|
|
- width: 100%;
|
|
|
- background: transparent;
|
|
|
- overflow: hidden;
|
|
|
-}
|
|
|
-
|
|
|
-.ghs-notice-item {
|
|
|
- display: flex;
|
|
|
- align-items: flex-start;
|
|
|
- padding: 12upx 0;
|
|
|
- box-sizing: border-box;
|
|
|
-}
|
|
|
-
|
|
|
-.ghs-notice-arrow-wrap {
|
|
|
- flex-shrink: 0;
|
|
|
- width: 52upx;
|
|
|
- height: 168upx;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- background: #3385FF;
|
|
|
-}
|
|
|
-
|
|
|
-.ghs-notice-arrow {
|
|
|
- font-size: 56upx;
|
|
|
- color: #ffffff;
|
|
|
- line-height: 1;
|
|
|
- opacity: 0.9;
|
|
|
-}
|
|
|
-
|
|
|
-.ghs-notice-summary {
|
|
|
- display: block;
|
|
|
- width: 100%;
|
|
|
- font-size: 30upx;
|
|
|
- color: #ffffff;
|
|
|
- line-height: 1.6;
|
|
|
- text-align: left;
|
|
|
- font-weight: 540;
|
|
|
- word-break: break-word;
|
|
|
- white-space: pre-line;
|
|
|
- max-height: 144upx;
|
|
|
- overflow: hidden;
|
|
|
-}
|
|
|
-</style>
|
|
|
+</style>
|