3
0
Fork 0

fix(specialArea): bug-42 修复注册专区等下单支付成功后,订单后退路径不正确的问题, 购物车状态机添加set方法

This commit is contained in:
woody 2025-04-24 14:19:12 +08:00
parent 00f02dc653
commit eaf598a51e
12 changed files with 103 additions and 425 deletions

View File

@ -9,23 +9,35 @@
v-show="smallCarLength > 0">{{ smallCarLength }}</view>
</view>
<u-popup :show="downShow"
mode="bottom"
closeOnClickOverlay
closeable
round="10"
@close="close">
<u-popup
:show="downShow"
mode="bottom"
closeOnClickOverlay
closeable
round="10"
@close="close"
>
<view class="title">{{ '购物车' }}</view>
<cartBtmList ref='cartBtmList'></cartBtmList>
<cartBtmList ref="cartBtmList" @orderCallBack="orderCallBack"></cartBtmList>
</u-popup>
</view>
</template>
<script>
import { mapGetters } from 'vuex'
import { mapGetters, mapActions } from 'vuex'
import cartBtmList from '@/components/cartBtmList.vue'
export default {
props: {
carLength: {
type: Number | String,
default: 0,
},
specialArea: {
type: Number | String,
default: 1,
},
},
components: {
cartBtmList,
},
@ -39,37 +51,17 @@ export default {
computed: {
...mapGetters(['smallCarLength']),
},
watch: {
carLength(n, o) {
this.smallCarLength = n
},
},
props: {
carLength: {
type: Number | String,
default: 0,
},
specialArea: {
type: Number | String,
default: 1,
},
},
mounted() {
this.$store.dispatch('getCarLength', this.specialArea)
// .then((res) => {
// this.smallCarLength = res.data.smallCount
// })
created() {
this.getCar()
},
methods: {
close() {
this.downShow = false
this.getCar()
},
getCar() {
this.$store.dispatch('getCarLength', this.specialArea)
// .then((res) => {
// this.smallCarLength = res.data.smallCount
// })
},
goCart() {
this.downShow = true
@ -78,6 +70,9 @@ export default {
})
// uni.switchTab({ url: '/pages/shoppingCar/index' })
},
orderCallBack() {
this.close()
},
},
}
</script>

View File

@ -12,13 +12,7 @@
v-for="(item, index) in shopCarList"
:key="item.specialArea"
>
<!-- <view class="kuang_t">
{{ item.specialAreaVal }}
</view> -->
<!-- <u-checkbox-group v-model="item.isSelect"
shape="circle"
placement="column"
@change="checkboxChange($event,item)"> -->
<view
v-for="(ctem, cndex) in item.shoppingCartList"
:key="cndex"
@ -352,34 +346,6 @@ export default {
this.goodsCheck[0].specialArea == 1 ||
this.goodsCheck[0].specialArea == 24
) {
// let deleteList = []
// shoppArr.forEach((item) => {
// deleteList.push({
// shoppingId: item,
// })
// })
// api
// .validShop({
// specialArea: this.goodsCheck[0].specialArea,
// deleteList: deleteList,
// })
// .then((res) => {
// if (res.code == 200) {
// uni.navigateTo({
// url:
// '/pages/regiest/index?specialArea=' +
// this.goodsCheck[0].specialArea +
// '&shoppArr=' +
// JSON.stringify(shoppArr),
// })
// } else {
// uni.showToast({
// title: res.msg,
// icon: 'none',
// mask: true,
// })
// }
// })
let deleteList = [];
shoppArr.forEach((item) => {
deleteList.push({
@ -393,42 +359,6 @@ export default {
"&shoppArr=" +
JSON.stringify(shoppArr),
});
// api
// .validShop({
// specialArea: this.goodsCheck[0].specialArea,
// deleteList: deleteList,
// })
// .then((res) => {
// if (res.code == 200) {
// // this.tableData = response.data;
// // this.tableData.forEach((item) => {
// // this.$set(item, "quantity", 1);
// // });
// // this.dialogVisible2 = true;
// // api
// // .energyShop({
// // specialArea: this.goodsCheck[0].specialArea,
// // deleteList: deleteList,
// // })
// // .then((response) => {
// // if (response.data && response.data.length > 0) {
// // this.tableData = response.data;
// // this.tableData.forEach((item) => {
// // this.$set(item, "quantity", 1);
// // });
// // this.dialogVisible2 = true;
// // } else {
// // uni.navigateTo({
// // url:
// // "/pages/regiest/index?specialArea=" +
// // this.goodsCheck[0].specialArea +
// // "&shoppArr=" +
// // JSON.stringify(shoppArr),
// // });
// // }
// // });
// }
// });
} else if (this.goodsCheck[0].specialArea == 21) {
if (
this.userInfo.registerShare == 0 ||
@ -458,34 +388,6 @@ export default {
});
} else {
if (this.goodsCheck[0].specialArea == 2) {
// let deleteList = []
// shoppArr.forEach((item) => {
// deleteList.push({
// shoppingId: item,
// })
// })
// api
// .validShop({
// specialArea: this.goodsCheck[0].specialArea,
// deleteList: deleteList,
// })
// .then((res) => {
// if (res.code == 200) {
// uni.navigateTo({
// url:
// '/pages/other/index?specialArea=' +
// this.goodsCheck[0].specialArea +
// '&shoppArr=' +
// JSON.stringify(shoppArr),
// })
// } else {
// uni.showToast({
// title: res.msg,
// icon: 'none',
// mask: true,
// })
// }
// })
let deleteList = [];
shoppArr.forEach((item) => {
deleteList.push({
@ -499,42 +401,6 @@ export default {
"&shoppArr=" +
JSON.stringify(shoppArr),
});
// api
// .validShop({
// specialArea: this.goodsCheck[0].specialArea,
// deleteList: deleteList,
// })
// .then((res) => {
// if (res.code == 200) {
// // this.tableData = response.data;
// // this.tableData.forEach((item) => {
// // this.$set(item, "quantity", 1);
// // });
// // this.dialogVisible2 = true;
// // api
// // .energyShop({
// // specialArea: this.goodsCheck[0].specialArea,
// // deleteList: deleteList,
// // })
// // .then((response) => {
// // if (response.data && response.data.length > 0) {
// // this.tableData = response.data;
// // this.tableData.forEach((item) => {
// // this.$set(item, "quantity", 1);
// // });
// // this.dialogVisible2 = true;
// // } else {
// // uni.navigateTo({
// // url:
// // "/pages/other/index?specialArea=" +
// // this.goodsCheck[0].specialArea +
// // "&shoppArr=" +
// // JSON.stringify(shoppArr),
// // });
// // }
// // });
// }
// });
} else if (this.goodsCheck[0].specialArea == 30) {
if (this.goodsCheck[0].orderItemsParams.length > 1) {
uni.showToast({
@ -607,42 +473,6 @@ export default {
// this.getShoppingCount()
});
},
// checkArea() {
// let arr = []
// this.shopCarList.forEach((item) => {
// item.shoppingCartList.forEach((ctem) => {
// if (item.isSelect.indexOf(ctem.shoppingId) > -1) {
// arr.push({
// specialArea: item.specialArea,
// orderItemsParams: [
// {
// waresCode: ctem.waresCode,
// shoppingId: ctem.shoppingId,
// waresName: ctem.waresName,
// achieve: ctem.achieve,
// waresPrice: ctem.waresPrice,
// cover1: ctem.cover1,
// quantity: ctem.number,
// waresItemsParamList: ctem.waresItemsParamList,
// waresSkuList: ctem.waresSkuList || [],
// source: ctem.source || '',
// },
// ],
// })
// }
// })
// })
// const arrayHashmap = arr.reduce((obj, item) => {
// obj[item.specialArea]
// ? obj[item.specialArea].orderItemsParams.push(
// ...item.orderItemsParams
// )
// : (obj[item.specialArea] = item)
// return obj
// }, {})
// this.goodsCheck = Object.values(arrayHashmap)
// this.checkPrice()
// },
//
checkPrice() {
let totalPrice = 0;

View File

@ -6,27 +6,7 @@
<u-icon name="checkmark-circle-fill" color="#029B00"></u-icon>
<view>{{'注册成功'}}</view>
</view>
<!-- <view class="digBody">
<view class="red">{{'恭喜您注册成功'}}
<view class="copy"
@click="onCopy">{{'复制'}}</view>
</view>
<view>{{'会员姓名'}}: {{ allData.memberName }}</view>
<view>{{'会员编号'}}: {{ allData.memberCode }}</view>
<view>会员电话: {{ allData.phone }}</view>
<view>登录密码: {{ allData.loginPassword }}</view>
<view>支付密码: {{ allData.payPassword }}</view>
<view>邮箱: {{ allData.email }}</view>
<view>登录网址: {{ allData.urlAddress }}</view>
</view>
<span slot="footer"
class="dialog-footer">
<view class="btn"
@click="handleClose">{{'确定'}}</view>
<view class="hui"
@click="handleClose">取消</view>
</span> -->
<!-- <view class="tit1">{{'恭喜您注册成功'}}</view> -->
<view class="getCode" @tap="onCopy">{{'复制'}}</view>
<view class="form">
<u--form labelPosition="left" labelWidth="80px" :model="allData" ref="uForm">
@ -50,26 +30,17 @@
<u-form-item :label="'登录网址'+':'" borderBottom>
<u--input v-model="allData.urlAddress" border="none"></u--input>
</u-form-item>
<!-- <u-form-item :label="'公众号搜索'+':'"
borderBottom>
<u--input v-model="allData.gzh"
border="none"></u--input>
</u-form-item>
<u-form-item :label="'APP(苹果)'+':'"
borderBottom>
<u--input v-model="allData.ios"
border="none"></u--input>
</u-form-item>
<u-form-item :label="'APP(安卓)'+':'"
borderBottom>
<u--input v-model="allData.android"
border="none"></u--input>
</u-form-item> -->
</u--form>
<view class="disflx">
<u-button type="success" class="uBtn" shape="circle"
<u-button
type="success"
class="uBtn"
shape="circle"
color="linear-gradient(to right, #005BAC, #005BAC )"
@tap="handleClose">{{'确定'}}</u-button>
@tap="handleClose"
>
确定
</u-button>
</view>
</view>
<img class="yh" v-show="bia" src="@/static/images/yh.gif" alt="">

View File

@ -77,8 +77,7 @@ export const checkShare = (params) => http.get('/member/api/share/check-share-co
//海粉订单详情
export const waresinfo = (params) => http.post('/sale/api/wares/query-confirm-waresinfo', params)
//购物车注册下单校验
export const validShop = (params) => http.post('/sale/api/order/valid-enough-shop', params)
//hi粉确认订单
export const fansConfirm = (params) => http.post('/sale/api/order/fans-confirm-order', params)
//购物车注册下单校验弹框

View File

@ -13,7 +13,7 @@ module.exports = (vm) => {
//#ifdef DEV_SERVER
console.log('DEV_SERVER')
config.baseURL = '/prod-api';
config.baseURL = 'http://localhost:8080/';
//#endif
//#ifdef QA_SERVER

View File

@ -4,7 +4,7 @@
<u-form :model="addressForm" labelWidth="auto" ref="uForm">
<view class="view-class">
<u-form-item
:label="'收货人'"
label="收货人"
label-width="100px"
prop="recName"
>
@ -19,7 +19,7 @@
</view>
<view class="view-class">
<u-form-item
:label="'联系方式'"
label="联系方式"
label-width="100px"
prop="recPhone"
>
@ -43,7 +43,7 @@
</u-form-item>
</view>
<view class="view-class" @click="getDiqu">
<u-form-item :label="'收货地址'" label-width="100px" prop="address">
<u-form-item label="收货地址" label-width="100px" prop="address">
<view
v-if="address"
style="font-size: 28rpx; color: #333; margin-left: 20rpx"
@ -65,7 +65,7 @@
</view>
<view class="view-class">
<u-form-item
:label="'详细地址'"
label="详细地址"
class="label-style"
label-width="100px"
prop="recAddress"
@ -75,7 +75,7 @@
placeholder-class="place-class"
class="border-color"
maxlength="200"
:placeholder="'请输入详细地址'"
placeholder="请输入详细地址"
/>
</u-form-item>
</view>
@ -98,9 +98,17 @@
:defaultCode="defaultCode"
@addressData="addressData"
></v-address>
<u-button type="success" shape="circle" class="btn" @click="submit">{{
'确定'
}}</u-button>
<u-button
:disabled="!addressForm.recName || !addressForm.recPhone || !addressForm.recAddress"
type="success"
shape="circle"
class="btn"
@click="submit"
color="#005BAC"
:loading="loading"
>
确定
</u-button>
<view style="height: 20rpx"></view>
</view>
</template>
@ -129,6 +137,7 @@ export default {
isDefault: 0,
pkId: "",
},
loading: false,
rules: {
recName: [
{
@ -195,19 +204,26 @@ export default {
},
submit() {
this.$refs.uForm.validate().then((res) => {
this.loading = true
api.saveAddress(this.addressForm).then((res) => {
if (res.code == "200") {
uni.showToast({
const toast = uni.showToast({
title: res.msg,
icon: "none",
success() {
complete() {
setTimeout(() => {
uni.navigateBack(1);
}, 2000);
this.loading = false
uni.navigateBack(1)
toast.hideToast()
}, 500);
},
});
} else {
this.loading = false
}
});
}).catch(() => {
this.loading = false
})
});
},
getDiqu() {
@ -325,8 +341,6 @@ page {
background-color: #fff;
}
.btn {
background-color: #fb3024;
border: none;
height: 92rpx;
line-height: 92rpx;
font-size: 30rpx;

View File

@ -1178,7 +1178,7 @@ export default {
this.isLoading = false
if (res.code == 200) {
uni.navigateTo({
uni.redirectTo({
url:
'/pages/pay/index?paramsPost=' +
JSON.stringify(res.data) +

View File

@ -1,9 +1,4 @@
<!--
* @Descripttion:
* @version:
* @Author: kBank
* @Date: 2022-11-21 15:11:22
-->
<template>
<view class="content">
<view class="index_header">
@ -742,8 +737,10 @@
</div>
</view>
</u-popup>
<successDialog @successClose="successClose"
ref="successDialog"></successDialog>
<successDialog
@successClose="successClose"
ref="successDialog"
/>
<u-modal @confirm="toUnBind"
@cancel='isNoBind=false'
:show="isNoBind"

View File

@ -1373,7 +1373,7 @@ export default {
.then((res) => {
this.isLoading = false;
if (res.code == 200) {
uni.navigateTo({
uni.redirectTo({
url:
"/pages/pay/index?paramsPost=" +
JSON.stringify(

View File

@ -196,9 +196,6 @@ export default {
selTable: [],
allTable: [],
total: "0.00",
// show:false,
// title:'',
// content:''
};
},
computed: {
@ -318,36 +315,7 @@ export default {
if (
this.goodsCheck[0].specialArea == 1 ||
this.goodsCheck[0].specialArea == 24
) {
// let deleteList = []
// shoppArr.forEach((item) => {
// deleteList.push({
// shoppingId: item,
// })
// })
// api
// .validShop({
// specialArea: this.goodsCheck[0].specialArea,
// deleteList: deleteList,
// })
// .then((res) => {
// if (res.code == 200) {
// uni.navigateTo({
// url:
// '/pages/regiest/index?specialArea=' +
// this.goodsCheck[0].specialArea +
// '&shoppArr=' +
// JSON.stringify(shoppArr),
// })
// } else {
// uni.showToast({
// title: res.msg,
// icon: 'none',
// mask: true,
// })
// }
// })
) {
let deleteList = [];
shoppArr.forEach((item) => {
deleteList.push({
@ -361,46 +329,7 @@ export default {
"&shoppArr=" +
JSON.stringify(shoppArr),
});
// api
// .validShop({
// specialArea: this.goodsCheck[0].specialArea,
// deleteList: deleteList,
// })
// .then((res) => {
// if (res.code == 200) {
// // api
// // .energyShop({
// // specialArea: this.goodsCheck[0].specialArea,
// // deleteList: deleteList,
// // })
// // .then((response) => {
// // if (response.data && response.data.length > 0) {
// // this.tableData = response.data;
// // this.tableData.forEach((item) => {
// // this.$set(item, "quantity", 1);
// // });
// // this.dialogVisible2 = true;
// // } else {
// // uni.navigateTo({
// // url:
// // "/pages/regiest/index?specialArea=" +
// // this.goodsCheck[0].specialArea +
// // "&shoppArr=" +
// // JSON.stringify(shoppArr),
// // });
// // }
// // });
// }
// });
} else if (this.goodsCheck[0].specialArea == 21) {
// uni.navigateTo({
// url:
// '/pages/other/haiConfirm?allData=' +
// JSON.stringify(this.goodsCheck[0].orderItemsParams) +
// '&shoppArr=' +
// JSON.stringify(shoppArr),
// })
uni.setStorageSync(
"haiConfirm",
JSON.stringify(this.goodsCheck[0].orderItemsParams)
@ -431,42 +360,6 @@ export default {
"&shoppArr=" +
JSON.stringify(shoppArr),
});
// api
// .validShop({
// specialArea: this.goodsCheck[0].specialArea,
// deleteList: deleteList,
// })
// .then((res) => {
// if (res.code == 200) {
// // this.tableData = response.data;
// // this.tableData.forEach((item) => {
// // this.$set(item, "quantity", 1);
// // });
// // this.dialogVisible2 = true;
// // api
// // .energyShop({
// // specialArea: this.goodsCheck[0].specialArea,
// // deleteList: deleteList,
// // })
// // .then((response) => {
// // if (response.data && response.data.length > 0) {
// // this.tableData = response.data;
// // this.tableData.forEach((item) => {
// // this.$set(item, "quantity", 1);
// // });
// // this.dialogVisible2 = true;
// // } else {
// // uni.navigateTo({
// // url:
// // "/pages/other/index?specialArea=" +
// // this.goodsCheck[0].specialArea +
// // "&shoppArr=" +
// // JSON.stringify(shoppArr),
// // });
// // }
// // });
// }
// });
} else if (this.goodsCheck[0].specialArea == 30) {
if (this.goodsCheck[0].orderItemsParams.length > 1) {
uni.showToast({
@ -535,17 +428,9 @@ export default {
} else {
this.getCarList();
}
// this.getShoppingCount()
});
},
checkArea() {
// let i = 0;
// this.shopCarList.forEach((item) => {
// if (item.isSelected) {
// i++;
// }
// });
// this.isTo = i;
let arr = [];
this.shopCarList.forEach((item) => {
item.shoppingCartList.forEach((ctem) => {
@ -609,13 +494,6 @@ export default {
this.$set(item, "isSelect", e);
this.checkArea();
}
// let i = 0
// this.shopCarList.forEach((item) => {
// if (item.isSelected) {
// i++
// }
// })
// this.isTo = i
},
//
delOne(ctem) {

View File

@ -7,7 +7,6 @@
<template>
<view class="content">
<backIcon :diff="diff"></backIcon>
<cartBall ref="cart" :carLength="shopCarLength" :specialArea="specialArea"></cartBall>
<view class="index_header">
<view>{{ titLabel }}</view>
</view>
@ -100,6 +99,7 @@
<u-picker :show="isCountry" @cancel="isCountry = false" @confirm="sureCountry" :columns="countryList"
keyName="label"></u-picker>
<selSpaceGoods ref="selSpaceGoods" @getCar="getCatLength"></selSpaceGoods>
<cartBall ref="cart" :carLength="shopCarLength" :specialArea="specialArea"></cartBall>
</view>
</template>
@ -107,7 +107,8 @@
import backIcon from "@/components/backIcon.vue";
import cartBall from "@/components/cartBall.vue";
import {
mapGetters
mapGetters,
mapActions
} from "vuex";
import * as api from "@/config/goods";
import clTabbar from "@/components/cl-tabbar.vue";
@ -225,8 +226,20 @@
});
//
this.getJScountry();
this.$nextTick(() => {
this.$refs.cart.getCar()
})
},
onHide() {
this.$refs.cart.close()
this.setSmallCarLength(0)
},
beforeDestroy() {
console.log('beforeDestroy........?')
this.setSmallCarLength(0)
},
methods: {
...mapActions(['setSmallCarLength', 'setShopCarLength']),
changeCountry() {
this.isCountry = true;
},

View File

@ -22,38 +22,15 @@ const mutations = {
SET_USER: (state, user) => {
state.user = user
},
shopCarLength: (state, data) => {
state.shopCarLength = data
},
smallCarLength: (state, data) => {
SET_SMALL_CAR_LENGTH: (state, data) => {
state.smallCarLength = data
},
SET_SHOP_CAR_LENGTH: (state, data) => {
state.shopCarLength = data
}
}
const actions = {
checkFunc({ commit }) {
return new Promise((resolve, reject) => {
// uni.login({
// provider: "weixin",
// success: function (loginRes) {
// // 登录成功
// let data = {
// code: loginRes.code,
// }
// wxSqlogin(data).then(res => {
// console.log("🚀 ~ AdminToken res", res);
// if (res.code == 200) {
// uni.setStorageSync('AdminToken', res.token)
// uni.setStorageSync("User", res.data);
// resolve(true)
// }
// })
// },
// fail: function (err) {
// },
// });
})
},
// 获取用户信息
GetInfo({ commit, state }) {
return new Promise((resolve, reject) => {
@ -68,6 +45,7 @@ const actions = {
})
})
},
// 退出登录
LogOut({ commit, state }) {
return new Promise((resolve, reject) => {
@ -96,13 +74,10 @@ const actions = {
let obj = { specialArea: data, pkCountry: pkCountry }
getShoppingCount(obj).then(res => {
if (res.code == 200) {
// resolve(res)
// commit('shopCarLength', res.data.cont)
// commit('smallCarLength', res.data.smallCount)
getSmallCount(obj).then(res1 => {
if (res.code == 200) {
commit('smallCarLength', res1.data.smallCount)
commit('shopCarLength', res.data.cont)
commit('SET_SMALL_CAR_LENGTH', res1.data.smallCount)
commit('SET_SHOP_CAR_LENGTH', res.data.cont)
resolve(res)
}
})
@ -111,6 +86,12 @@ const actions = {
})
})
},
setSmallCarLength({ commit }, data) {
commit('SET_SMALL_CAR_LENGTH', data)
},
setShopCarLength({ commit }, data) {
commit('SET_SHOP_CAR_LENGTH', data)
}
}
export default {