|
|
@@ -6,7 +6,7 @@
|
|
|
<view class="commodity-view">
|
|
|
<view class="commodity-list">
|
|
|
<view class="commodity-item" v-for="(item, index) in list" :key="index">
|
|
|
- <image class="item-icon" :src="item.cover" alt="" />
|
|
|
+ <image class="item-icon" :src="item.cover" />
|
|
|
<view class="item-info">
|
|
|
<view class="info-line">
|
|
|
<text class="item-name">{{ item.name }}</text>
|
|
|
@@ -103,20 +103,20 @@
|
|
|
<tui-list-cell class="line-cell" :hover="false" :arrow="true">
|
|
|
<view class="tui-title ">配送日期</view>
|
|
|
<picker mode="date" :value="form.reachDate" @change="selTimeFn" class="tui-input">
|
|
|
- <div v-if="form.reachDate">{{ form.reachDate }}</div>
|
|
|
- <div v-else style="color:#CCCCCC;">请选日期,默认当天</div>
|
|
|
+ <view v-if="form.reachDate">{{ form.reachDate }}</view>
|
|
|
+ <view v-else style="color:#CCCCCC;">请选日期,默认当天</view>
|
|
|
</picker>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false" :arrow="true">
|
|
|
- <div class="tui-title">配送时间</div>
|
|
|
- <picker mode="multiSelector" :value="form.reachPeriod" :range="timeOptions" @change="bindTimeChange">
|
|
|
+ <view class="tui-title">配送时间</view>
|
|
|
+ <picker mode="multiSelector" :range="timeOptions" @change="bindTimeChange">
|
|
|
<view class="uni-input" style="width:450upx;">{{form.reachPeriod}}<text style="margin-left:10upx;">前</text></view>
|
|
|
</picker>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
<tui-list-cell class="line-cell" :hover="false" :arrow="false">
|
|
|
- <textarea style="height: 100upx" v-model="form.remark" placeholder="这里写备注"/>
|
|
|
+ <textarea style="height: 100upx" v-model="form.remark" placeholder="这里写备注"></textarea>
|
|
|
</tui-list-cell>
|
|
|
|
|
|
</view>
|
|
|
@@ -137,7 +137,7 @@ import TuiListCell from "@/components/plugin/list-cell";
|
|
|
import productMins from "@/mixins/cgProduct";
|
|
|
import { buyItem,freight } from "@/api/order"
|
|
|
import { currentInfo } from "@/api/user"
|
|
|
-import { mapActions, mapGetters } from "vuex";
|
|
|
+// import { mapActions, mapGetters } from "vuex";
|
|
|
export default {
|
|
|
name: "affirmGhs",
|
|
|
components: {
|
|
|
@@ -148,9 +148,6 @@ export default {
|
|
|
return {
|
|
|
pageType: "cg",
|
|
|
list:[],
|
|
|
- autoLoad: false,
|
|
|
- ghsInfo:'',
|
|
|
- sendTimeWant:'',
|
|
|
form: {
|
|
|
reachDate: "",
|
|
|
reachPeriod: "12:00",
|
|
|
@@ -167,9 +164,6 @@ export default {
|
|
|
showAddress:'',
|
|
|
hasMap:0
|
|
|
},
|
|
|
- showCustomer: false,
|
|
|
- today:'',
|
|
|
- monthLater:'',
|
|
|
userInfo:{
|
|
|
lat:'',
|
|
|
long:'',
|
|
|
@@ -185,22 +179,17 @@ export default {
|
|
|
},
|
|
|
onShow() {
|
|
|
let selectList = this.$util.copyObject(this.selectList);
|
|
|
+ let mergedMap = {};
|
|
|
let list = [];
|
|
|
- for (let i=0;i<selectList.length;i++){
|
|
|
- if(list==''){
|
|
|
- list.push(selectList[i])
|
|
|
- }else{
|
|
|
- let has = false
|
|
|
- list.map(res=>{
|
|
|
- if(res.id == selectList[i].id){
|
|
|
- res.bigCount = (res.bigCount+selectList[i].bigCount)
|
|
|
- res.smallCount = (res.smallCount+selectList[i].smallCount)
|
|
|
- has = true
|
|
|
- }
|
|
|
- })
|
|
|
- if(has == false){
|
|
|
- list.push(selectList[i])
|
|
|
- }
|
|
|
+ for (let i = 0; i < selectList.length; i++) {
|
|
|
+ const item = selectList[i];
|
|
|
+ const key = item.id;
|
|
|
+ if (mergedMap[key]) {
|
|
|
+ mergedMap[key].bigCount = mergedMap[key].bigCount + item.bigCount;
|
|
|
+ mergedMap[key].smallCount = mergedMap[key].smallCount + item.smallCount;
|
|
|
+ } else {
|
|
|
+ mergedMap[key] = this.$util.copyObject(item);
|
|
|
+ list.push(mergedMap[key]);
|
|
|
}
|
|
|
}
|
|
|
this.list = list
|
|
|
@@ -208,19 +197,19 @@ export default {
|
|
|
this.getUserInfo()
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapGetters(["getLoginInfo"]),
|
|
|
+ // removed unused getLoginInfo
|
|
|
modifyPrice(){
|
|
|
- let price = this.allPrice.toFixed(2)
|
|
|
+ let price = Number(this.allPrice) || 0
|
|
|
if(this.form.sendType == 2){
|
|
|
- let sendCost = parseFloat(Number(this.form.sendCost))
|
|
|
- price = Number(price) + Number(sendCost)
|
|
|
+ price = price + Number(this.form.sendCost || 0) + Number(this.form.packCost || 0)
|
|
|
+ } else if (this.form.sendType == 0){
|
|
|
+ price = price + Number(this.form.packCost || 0)
|
|
|
}
|
|
|
- price = parseFloat(price)
|
|
|
- return price
|
|
|
+ return parseFloat(price)
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
- ...mapActions(["initMerchantInfo"]),
|
|
|
+ // removed unused initMerchantInfo
|
|
|
selTimeFn(e) {
|
|
|
this.form.reachDate = e.detail.value;
|
|
|
},
|
|
|
@@ -258,7 +247,7 @@ export default {
|
|
|
that.form.hasMap = that.userInfo.hasMap || 0
|
|
|
that.calcSendCost()
|
|
|
}
|
|
|
- })
|
|
|
+ }).catch(()=>{})
|
|
|
},
|
|
|
modifyAddress(){
|
|
|
this.$util.pageTo({ url: '/pages/user/modify?hasMap='+this.form.hasMap})
|
|
|
@@ -286,11 +275,16 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
weight = Number(weight).toFixed(2)
|
|
|
+ // 无地址或重量为 0 时,设为 0 并返回
|
|
|
+ if (this.$util.isEmpty(that.userInfo.lat) || this.$util.isEmpty(that.userInfo.long) || Number(weight) <= 0) {
|
|
|
+ that.form.sendCost = 0
|
|
|
+ return
|
|
|
+ }
|
|
|
freight({weight:weight,lat:that.userInfo.lat,long:that.userInfo.long}).then(res => {
|
|
|
if(res.code == 1){
|
|
|
that.form.sendCost = res.data.fee?parseFloat(Number(res.data.fee)):0
|
|
|
}
|
|
|
- });
|
|
|
+ }).catch(()=>{});
|
|
|
},
|
|
|
confirmForm() {
|
|
|
const product = this.selectList.map(ele => {
|
|
|
@@ -300,7 +294,7 @@ export default {
|
|
|
unitType = 1
|
|
|
num = (ele.smallCount/ele.ratio).toFixed(2)
|
|
|
}
|
|
|
- return { productId: ele.id, num:num,itemId:ele.itemId,property:1,unitType:unitType,property:1};
|
|
|
+ return { productId: ele.id, num: num, itemId: ele.itemId, unitType: unitType, property: 1 };
|
|
|
});
|
|
|
let hdId = this.option.hdId ? this.option.hdId : 0
|
|
|
let params = { product: JSON.stringify(product),...this.form,hdId:hdId }
|
|
|
@@ -429,28 +423,6 @@ export default {
|
|
|
border-radius: 10upx;
|
|
|
overflow: hidden;
|
|
|
padding-top: 20upx;
|
|
|
- .ghs-msg{
|
|
|
- padding: 0 20upx 20upx;
|
|
|
- font-size: 32upx;
|
|
|
- &.active{
|
|
|
- color: #868686;
|
|
|
- font-size: 24upx;
|
|
|
- }
|
|
|
- i{color: #62ed73;font-size: 48upx}
|
|
|
- }
|
|
|
-
|
|
|
- .member-wrap {
|
|
|
- .member-det {
|
|
|
- font-size: 24upx;
|
|
|
- margin-left: 20upx;
|
|
|
- }
|
|
|
- }
|
|
|
- .remark-wrap {
|
|
|
- align-items: flex-start;
|
|
|
- .remark {
|
|
|
- height: 240upx;
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
.under-bar {
|
|
|
@@ -480,22 +452,5 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .coupon_box{
|
|
|
- flex: 1;
|
|
|
- text-align: right;
|
|
|
- padding-right: 45upx;
|
|
|
- .has-hb{
|
|
|
- background:red;
|
|
|
- color:white;
|
|
|
- border:1upx solid red;
|
|
|
- border-radius: 30upx;
|
|
|
- font-size:20upx;
|
|
|
- padding:5upx 15upx 5upx 15upx;
|
|
|
- }
|
|
|
- .selected{
|
|
|
- color:red;
|
|
|
- float:left;
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
</style>
|