feat: 合并代码解决冲突
This commit is contained in:
commit
3a5ff55440
@ -12,4 +12,6 @@ export const apiArr = {
|
|||||||
settingDefaultAddress: '/api/v2/wechat/commodity/receiving_address/default', // 收货地址设置默认
|
settingDefaultAddress: '/api/v2/wechat/commodity/receiving_address/default', // 收货地址设置默认
|
||||||
updateAddress: '/api/v2/wechat/commodity/receiving_address/update', // 收货地址修改
|
updateAddress: '/api/v2/wechat/commodity/receiving_address/update', // 收货地址修改
|
||||||
updateCar:"/api/v2/wechat/commodity/cart/update",
|
updateCar:"/api/v2/wechat/commodity/cart/update",
|
||||||
|
updateCar:"/api/v2/wechat/commodity/cart/update",//更新购物车信息
|
||||||
|
getUserDefAddress:"/api/v2/wechat/commodity/receiving_address/get_default",//获取用户默认地址
|
||||||
}
|
}
|
||||||
@ -327,25 +327,67 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
addCar() {
|
addCar() {
|
||||||
console.log(this.info);
|
|
||||||
|
|
||||||
|
let that = this
|
||||||
|
//如果没有当前商品 直接添加一个
|
||||||
|
let goods_id_and_count = []
|
||||||
this.info.commodity_goods_info_list[this.currentGGIndex].cart_count = { count: 1 }
|
this.info.commodity_goods_info_list[this.currentGGIndex].cart_count = { count: 1 }
|
||||||
|
|
||||||
let carNum = 0
|
|
||||||
this.info.commodity_goods_info_list.forEach(item => {
|
this.info.commodity_goods_info_list.forEach(item => {
|
||||||
carNum += item.cart_count.count
|
console.log(item);
|
||||||
|
|
||||||
|
goods_id_and_count.push({
|
||||||
|
goods_id: item.id,
|
||||||
|
count: item.cart_count.count
|
||||||
})
|
})
|
||||||
this.carNum = carNum
|
})
|
||||||
|
|
||||||
|
request(apiArr.updateCar, "POST", {
|
||||||
|
goods_id_and_count
|
||||||
|
}).then(res => {
|
||||||
|
that.getShopCar()
|
||||||
|
that.getShopCarList()
|
||||||
|
})
|
||||||
|
// let flag = false
|
||||||
|
// this.carOrderList.forEach(item => {
|
||||||
|
// if (item.goods_id == this.info.commodity_goods_info_list[this.currentGGIndex].id) {
|
||||||
|
// flag = true
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// console.log(flag);
|
||||||
|
|
||||||
|
// if (flag) {
|
||||||
|
|
||||||
|
// this.info.commodity_goods_info_list[this.currentGGIndex].cart_count = { count: 1 }
|
||||||
|
// let carNum = 0
|
||||||
|
// this.info.commodity_goods_info_list.forEach(item => {
|
||||||
|
// carNum += item.cart_count.count
|
||||||
|
// })
|
||||||
|
// this.carNum = carNum
|
||||||
|
// } else {
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
changeCar(newValue) {
|
changeCar(newValue) {
|
||||||
this.info.commodity_goods_info_list[this.currentGGIndex].cart_count.count = newValue.value
|
this.info.commodity_goods_info_list[this.currentGGIndex].cart_count.count = newValue.value
|
||||||
let carNum = 0
|
|
||||||
this.info.commodity_goods_info_list.forEach(item => {
|
this.carOrderList.forEach(item=>{
|
||||||
if (item.cart_count) {
|
if(item.commodity_goods_info.id == this.info.commodity_goods_info_list[this.currentGGIndex].id){
|
||||||
carNum += item.cart_count.count
|
console.log(item,'item');
|
||||||
|
item.count = newValue.value
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
let carNum = 0
|
||||||
|
this.carOrderList.forEach(item=>{
|
||||||
|
carNum += item.count
|
||||||
|
})
|
||||||
|
// let carNum = 0
|
||||||
|
// this.info.commodity_goods_info_list.forEach(item => {
|
||||||
|
// if (item.cart_count) {
|
||||||
|
// carNum += item.cart_count.count
|
||||||
|
// }
|
||||||
|
// })
|
||||||
this.carNum = carNum
|
this.carNum = carNum
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -357,12 +399,15 @@ export default {
|
|||||||
this.localHeight = meun.height;
|
this.localHeight = meun.height;
|
||||||
|
|
||||||
this.id = options.id
|
this.id = options.id
|
||||||
this.getGoodsInfo()
|
|
||||||
this.getShopCar()
|
|
||||||
this.getShopCarList()
|
|
||||||
},
|
},
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
|
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.getGoodsInfo()
|
||||||
|
this.getShopCar()
|
||||||
|
this.getShopCarList()
|
||||||
},
|
},
|
||||||
onHide() {
|
onHide() {
|
||||||
|
|
||||||
|
|||||||
@ -31,19 +31,21 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="goodsItem_msg_right">
|
<div class="goodsItem_msg_right">
|
||||||
<div class="goodsItem_msg_right_tit">{{ item.commodity_goods_info.goods_name }}</div>
|
<div class="goodsItem_msg_right_tit">{{ item.commodity_goods_info.goods_name }}</div>
|
||||||
<div class="goodsItem_msg_right_subTit">{{ item.commodity_goods_info.goods_intro }}</div>
|
<div class="goodsItem_msg_right_subTit">{{ item.commodity_goods_info.goods_intro }}
|
||||||
|
</div>
|
||||||
<div class="goodsItem_msg_right_msg">
|
<div class="goodsItem_msg_right_msg">
|
||||||
<div class="goodsItem_msg_right_msg_left">
|
<div class="goodsItem_msg_right_msg_left">
|
||||||
<span>¥</span>{{ item.commodity_goods_info.sales_price }} <span>/{{ item.commodity_goods_info.goods_unit }}</span>
|
<span>¥</span>{{ item.commodity_goods_info.sales_price }} <span>/{{
|
||||||
|
item.commodity_goods_info.goods_unit }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="goodsItem_msg_right_msg_right">
|
<div class="goodsItem_msg_right_msg_right">
|
||||||
<u-number-box v-model="item.count">
|
<u-number-box v-model="item.count" :asyncChange="true" min="0">
|
||||||
<view slot="minus" class="minus">
|
<view slot="minus" class="minus" @click="minus(item, index)">
|
||||||
<u-icon name="minus" size="32" bold></u-icon>
|
<u-icon name="minus" size="32" bold></u-icon>
|
||||||
</view>
|
</view>
|
||||||
<text slot="input" style="width: 80rpx;text-align: center;" class="input">{{
|
<text slot="input" style="width: 80rpx;text-align: center;" class="input">{{
|
||||||
item.count }}</text>
|
item.count }}</text>
|
||||||
<view slot="plus" class="plus">
|
<view slot="plus" class="plus" @click="add(item, index)">
|
||||||
<u-icon name="plus" color="#FFFFFF" size="32" bold></u-icon>
|
<u-icon name="plus" color="#FFFFFF" size="32" bold></u-icon>
|
||||||
</view>
|
</view>
|
||||||
</u-number-box>
|
</u-number-box>
|
||||||
@ -118,7 +120,15 @@ export default {
|
|||||||
NavgateTo("1")
|
NavgateTo("1")
|
||||||
},
|
},
|
||||||
submitOrder() {
|
submitOrder() {
|
||||||
NavgateTo("../submitOrder/index")
|
|
||||||
|
let arr = []
|
||||||
|
this.shopCarList.forEach(item => {
|
||||||
|
if (item.checked) {
|
||||||
|
arr.push(item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
NavgateTo(`../submitOrder/index?shopCarList=${JSON.stringify(arr)}`)
|
||||||
},
|
},
|
||||||
|
|
||||||
getShopCar() {
|
getShopCar() {
|
||||||
@ -126,7 +136,6 @@ export default {
|
|||||||
res.commodity_cart_list.forEach(item => {
|
res.commodity_cart_list.forEach(item => {
|
||||||
item.checked = false
|
item.checked = false
|
||||||
});
|
});
|
||||||
console.log(res.commodity_cart_list);
|
|
||||||
this.shopCarTotal = res.total
|
this.shopCarTotal = res.total
|
||||||
this.shopCarList = res.commodity_cart_list
|
this.shopCarList = res.commodity_cart_list
|
||||||
})
|
})
|
||||||
@ -156,8 +165,11 @@ export default {
|
|||||||
},
|
},
|
||||||
// 计算金额
|
// 计算金额
|
||||||
calcTotal() {
|
calcTotal() {
|
||||||
|
|
||||||
let total = 0
|
let total = 0
|
||||||
this.shopCarList.forEach(item => {
|
this.shopCarList.forEach(item => {
|
||||||
|
console.log(item);
|
||||||
|
|
||||||
if (item.checked) {
|
if (item.checked) {
|
||||||
total += item.commodity_goods_info.sales_price * item.count
|
total += item.commodity_goods_info.sales_price * item.count
|
||||||
}
|
}
|
||||||
@ -165,6 +177,25 @@ export default {
|
|||||||
this.shopMoney = total
|
this.shopMoney = total
|
||||||
},
|
},
|
||||||
|
|
||||||
|
minus(item, index) {
|
||||||
|
let that = this
|
||||||
|
if (item.count === 1) {
|
||||||
|
request(apiArr.deleteCar, "POST", {
|
||||||
|
ids: [item.id]
|
||||||
|
}).then(res => {
|
||||||
|
that.shopCarList.splice(index, 1)
|
||||||
|
that.calcTotal()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.shopCarList[index].count = this.shopCarList[index].count - 1
|
||||||
|
this.calcTotal()
|
||||||
|
},
|
||||||
|
add(item, index) {
|
||||||
|
this.shopCarList[index].count = this.shopCarList[index].count + 1
|
||||||
|
this.calcTotal()
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
deleteItem() {
|
deleteItem() {
|
||||||
let that = this
|
let that = this
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
@ -176,6 +207,7 @@ export default {
|
|||||||
that.shopCarList.forEach(item => {
|
that.shopCarList.forEach(item => {
|
||||||
if (item.checked) {
|
if (item.checked) {
|
||||||
ids.push(item.id)
|
ids.push(item.id)
|
||||||
|
item.checked = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
request(apiArr.deleteCar, "POST", {
|
request(apiArr.deleteCar, "POST", {
|
||||||
@ -186,6 +218,9 @@ export default {
|
|||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
that.getShopCar()
|
that.getShopCar()
|
||||||
|
that.calcTotal()
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err);
|
||||||
})
|
})
|
||||||
} else if (res.cancel) {
|
} else if (res.cancel) {
|
||||||
console.log('用户点击取消');
|
console.log('用户点击取消');
|
||||||
|
|||||||
@ -177,3 +177,23 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.address_Info_btn {
|
||||||
|
background: linear-gradient(91deg, #FF7658 0%, #FF370B 100%);
|
||||||
|
border-radius: 100rpx 100rpx 100rpx 100rpx;
|
||||||
|
height: 90rpx;
|
||||||
|
width: 600rpx;
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.noneDef{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
@ -4,42 +4,49 @@
|
|||||||
<div class="border">
|
<div class="border">
|
||||||
<image src="http://192.168.0.172:5500/7.15/shop_border.png" mode="widthFix"></image>
|
<image src="http://192.168.0.172:5500/7.15/shop_border.png" mode="widthFix"></image>
|
||||||
</div>
|
</div>
|
||||||
<div class="address_Info" @click="choseAddress">
|
<div class="address_Info" @click="choseAddress" v-if="defAddress">
|
||||||
<div class="address_Info_left">
|
<div class="address_Info_left">
|
||||||
<div class="address_Info_left_tit">收货地址</div>
|
<div class="address_Info_left_tit">收货地址</div>
|
||||||
<div class="address_Info_left_name">李佳 15901518415</div>
|
<div class="address_Info_left_name">李佳 15901518415</div>
|
||||||
<div class="address_Info_left_addr">北京北京市朝阳区珠江绿洲文化广场</div>
|
<div class="address_Info_left_addr">北京北京市朝阳区珠江绿洲文化广场</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="address_Info_right">
|
|
||||||
<u-icon name="arrow-right" size="40rpx"></u-icon>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="address_Info" @click="choseAddress" v-if="!defAddress">
|
||||||
|
<div class="address_Info_left noneDef">
|
||||||
|
<div class="address_Info_btn">添加收货地址</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="border">
|
<div class="border">
|
||||||
<image src="http://192.168.0.172:5500/7.15/shop_border.png" mode="widthFix"></image>
|
<image src="http://192.168.0.172:5500/7.15/shop_border.png" mode="widthFix"></image>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="goodsCate" v-for="items, indexs in 2" :key="indexs">
|
<div class="goodsCate" v-for="items, indexs in carList" :key="indexs">
|
||||||
<div class="goodsItem" v-for="item, index in 3" :key="index">
|
<div class="goodsItem">
|
||||||
<div class="goodsItem_msg_img">
|
<div class="goodsItem_msg_img">
|
||||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_MsgImg1.png">
|
<image :src="picUrl + items.commodity_goods_info.commodity_pic">
|
||||||
</image>
|
</image>
|
||||||
</div>
|
</div>
|
||||||
<div class="goodsItem_msg_right">
|
<div class="goodsItem_msg_right">
|
||||||
<div class="goodsItem_msg_right_tit">泰国金枕榴莲</div>
|
<div class="goodsItem_msg_right_tit">{{ items.commodity_goods_info.goods_name }}</div>
|
||||||
<div class="goodsItem_msg_right_subTit">商品介绍商品介绍</div>
|
<div class="goodsItem_msg_right_subTit">{{ items.commodity_goods_info.goods_intro }}</div>
|
||||||
<div class="goodsItem_msg_right_msg">
|
<div class="goodsItem_msg_right_msg">
|
||||||
<div class="goodsItem_msg_right_msg_left">
|
<div class="goodsItem_msg_right_msg_left">
|
||||||
<span>¥</span>125.9 <span>/个</span>
|
<span>¥</span>{{ items.commodity_goods_info.sales_price }}
|
||||||
|
<span>/{{ items.commodity_goods_info.goods_unit }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="goodsItem_msg_right_msg_right">
|
<div class="goodsItem_msg_right_msg_right">
|
||||||
<u-number-box v-model="value">
|
<u-number-box v-model="value">
|
||||||
<view slot="minus" class="minus">
|
<view slot="minus" class="minus" @click="minus(items, indexs)">
|
||||||
<u-icon name="minus" size="32" bold></u-icon>
|
<u-icon name="minus" size="32" bold></u-icon>
|
||||||
</view>
|
</view>
|
||||||
<text slot="input" style="width: 80rpx;text-align: center;" class="input">{{
|
<text slot="input" style="width: 80rpx;text-align: center;" class="input">
|
||||||
value }}</text>
|
{{ items.count }}
|
||||||
<view slot="plus" class="plus">
|
</text>
|
||||||
|
<view slot="plus" class="plus" @click="add(items, indexs)">
|
||||||
<u-icon name="plus" color="#FFFFFF" size="32" bold></u-icon>
|
<u-icon name="plus" color="#FFFFFF" size="32" bold></u-icon>
|
||||||
</view>
|
</view>
|
||||||
</u-number-box>
|
</u-number-box>
|
||||||
@ -55,7 +62,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<div class="btn">立即支付¥4500.00</div>
|
<div class="btn">立即支付¥{{ totalMony }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
@ -64,7 +71,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
apiArr
|
apiArr
|
||||||
} from '../../../api/doorToDoor';
|
} from '../../../api/shop';
|
||||||
import {
|
import {
|
||||||
picUrl,
|
picUrl,
|
||||||
menuButtonInfo,
|
menuButtonInfo,
|
||||||
@ -74,22 +81,63 @@ import {
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
picUrl,
|
||||||
top: "",
|
top: "",
|
||||||
localHeight: "",
|
localHeight: "",
|
||||||
value: 3,
|
value: 3,
|
||||||
type: "error",
|
type: "error",
|
||||||
|
carList: [],
|
||||||
|
totalMony: 0,
|
||||||
|
defAddress:{},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
choseAddress() {
|
choseAddress() {
|
||||||
NavgateTo('../address/index')
|
NavgateTo('../address/index')
|
||||||
},
|
},
|
||||||
|
|
||||||
|
calcTotal() {
|
||||||
|
let total = 0
|
||||||
|
this.carList.forEach(item => {
|
||||||
|
total += item.commodity_goods_info.sales_price * item.count
|
||||||
|
})
|
||||||
|
this.totalMony = total
|
||||||
|
},
|
||||||
|
|
||||||
|
minus(item, index) {
|
||||||
|
let that = this
|
||||||
|
if (item.count === 1) {
|
||||||
|
request(apiArr.deleteCar, "POST", {
|
||||||
|
ids: [item.id]
|
||||||
|
}).then(res => {
|
||||||
|
that.carList.splice(index, 1)
|
||||||
|
that.calcTotal()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.carList[index].count = this.carList[index].count - 1
|
||||||
|
this.calcTotal()
|
||||||
|
},
|
||||||
|
add(item, index) {
|
||||||
|
this.carList[index].count = this.carList[index].count + 1
|
||||||
|
this.calcTotal()
|
||||||
|
},
|
||||||
|
//用户收货地址
|
||||||
|
getUserAddress() {
|
||||||
|
request(apiArr.getUserDefAddress, "POST", {}).then(res => {
|
||||||
|
this.defAddress = res.default_address
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.getUserAddress()
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
const meun = menuButtonInfo();
|
const meun = menuButtonInfo();
|
||||||
this.top = meun.top;
|
this.top = meun.top;
|
||||||
this.localHeight = meun.height;
|
this.localHeight = meun.height;
|
||||||
|
this.carList = JSON.parse(options.shopCarList)
|
||||||
|
this.calcTotal()
|
||||||
},
|
},
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -3,39 +3,5 @@
|
|||||||
"projectname": "uniapp-ZHSQ",
|
"projectname": "uniapp-ZHSQ",
|
||||||
"setting": {
|
"setting": {
|
||||||
"compileHotReLoad": true
|
"compileHotReLoad": true
|
||||||
},
|
|
||||||
"condition": {
|
|
||||||
"miniprogram": {
|
|
||||||
"list": [
|
|
||||||
{
|
|
||||||
"name": "packages/community/choseCommunity/index",
|
|
||||||
"pathName": "packages/community/choseCommunity/index",
|
|
||||||
"query": "",
|
|
||||||
"scene": null,
|
|
||||||
"launchMode": "default"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "添加收货模式",
|
|
||||||
"pathName": "packages/shop/addAddress/index",
|
|
||||||
"query": "",
|
|
||||||
"launchMode": "default",
|
|
||||||
"scene": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "收货地址",
|
|
||||||
"pathName": "packages/shop/address/index",
|
|
||||||
"query": "",
|
|
||||||
"launchMode": "default",
|
|
||||||
"scene": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "packages/shop/submitOrder/index",
|
|
||||||
"pathName": "packages/shop/submitOrder/index",
|
|
||||||
"query": "",
|
|
||||||
"launchMode": "default",
|
|
||||||
"scene": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user