diff --git a/package-lock.json b/package-lock.json
index ae01bac..ee2775d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,17 +1,78 @@
{
- "name": "jiangchengfeiyi-xiaochengxu",
- "lockfileVersion": 3,
"requires": true,
- "packages": {
- "": {
- "dependencies": {
- "mitt": "^3.0.1"
+ "lockfileVersion": 1,
+ "dependencies": {
+ "@babel/runtime": {
+ "version": "7.26.0",
+ "resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.26.0.tgz",
+ "integrity": "sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==",
+ "requires": {
+ "regenerator-runtime": "^0.14.0"
}
},
- "node_modules/mitt": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz",
- "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw=="
+ "complex.js": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmmirror.com/complex.js/-/complex.js-2.4.2.tgz",
+ "integrity": "sha512-qtx7HRhPGSCBtGiST4/WGHuW+zeaND/6Ld+db6PbrulIB1i2Ev/2UPiqcmpQNPSyfBKraC0EOvOKCB5dGZKt3g=="
+ },
+ "decimal.js": {
+ "version": "10.4.3",
+ "resolved": "https://registry.npmmirror.com/decimal.js/-/decimal.js-10.4.3.tgz",
+ "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA=="
+ },
+ "escape-latex": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmmirror.com/escape-latex/-/escape-latex-1.2.0.tgz",
+ "integrity": "sha512-nV5aVWW1K0wEiUIEdZ4erkGGH8mDxGyxSeqPzRNtWP7ataw+/olFObw7hujFWlVjNsaDFw5VZ5NzVSIqRgfTiw=="
+ },
+ "fraction.js": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmmirror.com/fraction.js/-/fraction.js-5.2.1.tgz",
+ "integrity": "sha512-Ah6t/7YCYjrPUFUFsOsRLMXAdnYM+aQwmojD2Ayb/Ezr82SwES0vuyQ8qZ3QO8n9j7W14VJuVZZet8U3bhSdQQ=="
+ },
+ "javascript-natural-sort": {
+ "version": "0.7.1",
+ "resolved": "https://registry.npmmirror.com/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz",
+ "integrity": "sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw=="
+ },
+ "mathjs": {
+ "version": "14.0.1",
+ "resolved": "https://registry.npmmirror.com/mathjs/-/mathjs-14.0.1.tgz",
+ "integrity": "sha512-yyJgLwC6UXuve724np8tHRMYaTtb5UqiOGQkjwbSXgH8y1C/LcJ0pvdNDZLI2LT7r+iExh2Y5HwfAY+oZFtGIQ==",
+ "requires": {
+ "@babel/runtime": "^7.25.7",
+ "complex.js": "^2.2.5",
+ "decimal.js": "^10.4.3",
+ "escape-latex": "^1.2.0",
+ "fraction.js": "^5.2.1",
+ "javascript-natural-sort": "^0.7.1",
+ "seedrandom": "^3.0.5",
+ "tiny-emitter": "^2.1.0",
+ "typed-function": "^4.2.1"
+ }
+ },
+ "mitt": {
+ "version": "3.0.1"
+ },
+ "regenerator-runtime": {
+ "version": "0.14.1",
+ "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
+ "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="
+ },
+ "seedrandom": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmmirror.com/seedrandom/-/seedrandom-3.0.5.tgz",
+ "integrity": "sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg=="
+ },
+ "tiny-emitter": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmmirror.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
+ "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
+ },
+ "typed-function": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmmirror.com/typed-function/-/typed-function-4.2.1.tgz",
+ "integrity": "sha512-EGjWssW7Tsk4DGfE+5yluuljS1OGYWiI1J6e8puZz9nTMM51Oug8CD5Zo4gWMsOhq5BI+1bF+rWTm4Vbj3ivRA=="
}
}
}
diff --git a/package.json b/package.json
index 055b94a..0df35ed 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,6 @@
{
"dependencies": {
+ "mathjs": "^14.0.1",
"mitt": "^3.0.1"
}
}
diff --git a/pages/Shopping-cart/component/addProduct.vue b/pages/Shopping-cart/component/addProduct.vue
index 2d46cdc..c1c58c7 100644
--- a/pages/Shopping-cart/component/addProduct.vue
+++ b/pages/Shopping-cart/component/addProduct.vue
@@ -96,7 +96,7 @@
console.log('失败原因-->', res.data);
uni.showToast({
icon: 'error',
- title: "请求失败"
+ title: res.data.message
})
return;
}
diff --git a/pages/Shopping-cart/newaddress_Info/newaddress_Info.vue b/pages/Shopping-cart/newaddress_Info/newaddress_Info.vue
index 1029029..74f8342 100644
--- a/pages/Shopping-cart/newaddress_Info/newaddress_Info.vue
+++ b/pages/Shopping-cart/newaddress_Info/newaddress_Info.vue
@@ -14,10 +14,11 @@
所在地区
-
+
+
@@ -47,24 +48,34 @@
\ No newline at end of file
diff --git a/pages/Shopping-cart/productmain/productmain.vue b/pages/Shopping-cart/productmain/productmain.vue
index 9c1532d..e74d073 100644
--- a/pages/Shopping-cart/productmain/productmain.vue
+++ b/pages/Shopping-cart/productmain/productmain.vue
@@ -21,16 +21,16 @@
- {{ item.cartGoodVO.name }}
- 【{{ item.cartGoodVO.type }}】
+ {{ item.cartGoodVO.name }}
+ 【{{ item.cartGoodVO.type }}】
- ¥{{ item.cartGoodVO.price }}
+ ¥{{ item.cartGoodVO.price }}
',products.value);
}
+const deleteProduct = async (idArr) =>{ //删除商品
+ const res = await uni.request({
+ url: baseUrl + '/cart/delete',
+ method: 'POST',
+ data: idArr ,
+ header: {
+ 'cookie': wx.getStorageSync('cookie')
+ }
+ })
+ console.log(res.data);
+ if(res.data.code === 1) {
+ getProductCart() //重新获取购物车信息
+ totalPrice.value = 0
+ }
+}
const getServiceCart =()=>{
console.log('获取服务类商品方法被触发');
}
@@ -241,10 +257,6 @@ const allChecked = ()=>{
item.checked = true //将全部选项选上
computed(item.cartGoodVO.price , item.quantity)
})
- // checkedData.value = products.value.map((item)=>({
- // goodId: item.goodId,
- // quantity: item.quantity
- // })) //将商品全部信息保存到checkedData中
checkedData.value = products.value.map((item)=>( item.id ))
console.log('checkedData--->',checkedData.value);
} else {
@@ -268,43 +280,61 @@ const decrease =(index , item)=>{ //item用于监测是否选中
const increase =(index , item) =>{ //item用于监测是否选中
console.log('increase,index-->',index);
console.log('increase,item-->',item);
- if(products.value[index].quantity <= 99) {
+ if(products.value[index].quantity < products.value[index].cartGoodVO.inventory) {
+ if(item && products.value[index].quantity <= products.value[index].cartGoodVO.inventory) {
+ computed(products.value[index].cartGoodVO.price, 1)
+ }
products.value[index].quantity += 1
}
- if(item) {
- computed(products.value[index].cartGoodVO.price, 1)
- }
}
//计算方法
const computed =( price , quantity )=>{
- totalPrice.value += price * quantity
+ totalPrice.value = math.round(totalPrice.value+price * quantity,2)
return totalPrice.value
}
-const jump_product =()=>{
+const jump_product =(gid)=>{
uni.navigateTo({
- url:'../../../pages/store-home/ProductDetails/ProductDetails'
+ url:'../../../pages/store-home/ProductDetails/ProductDetails?gid=' + JSON.stringify(gid)
})
}
-const editOrSettle = async ()=>{
+const editOrSettle = async ()=>{ //去结算或者删除状态方法
// console.log('要传到订单详情页面的checked--->',checkedData.value);
if(stateText.value.bottomBtn === '去结算') {
- uni.navigateTo({
- url: '/pages/order/product-waitpay/product-waitpay?cartInfo=' + JSON.stringify(checkedData.value)
- })
- } else {
const res = await uni.request({
- url: baseUrl + '/cart/delete',
+ url: baseUrl + '/cart/cart/list/error',
method: 'POST',
- data: checkedData.value ,
header: {
'cookie': wx.getStorageSync('cookie')
}
})
console.log(res.data);
- if(res.data.code === 1) {
- getProductCart() //重新获取购物车信息
- totalPrice.value = 0
+ if(res.data.data.length != 0) {
+ uni.showModal({
+ title: '提示',
+ content: '购物车商品发生改变,点击移除变化商品',
+ showCancel: false,
+ success: (e)=>{
+ if(e.confirm) {
+ deleteProduct(res.data.data)
+ }
+ }
+ })
+ } else {
+ uni.navigateTo({
+ url: '/pages/order/product-waitpay/product-waitpay?cartInfo=' + JSON.stringify(checkedData.value)
+ })
}
+ } else {
+ uni.showModal({
+ title: '提示',
+ content: '是否删除商品?',
+ success: (e) => {
+ if(e.confirm)
+ deleteProduct(checkedData.value)
+ else if(e.cancel)
+ return;
+ }
+ })
}
}
const changeState =()=>{ //修改购物车订单方法
diff --git a/pages/order/component/addressComponent.vue b/pages/order/component/addressComponent.vue
index c88317e..bdeaa26 100644
--- a/pages/order/component/addressComponent.vue
+++ b/pages/order/component/addressComponent.vue
@@ -94,11 +94,15 @@ const deleteAddress = async( id ) =>{
const res = await uni.request({
url: baseUrl + '/address/delete',
method: 'POST',
+ header: {
+ 'cookie': wx.getStorageSync('cookie')
+ },
data: { id: id }
})
+ // console.log(res.data);
if( res.data.code === 1 ) {
getAddressList()
- console.log("删除地址成功");
+ // console.log("删除地址成功");
}
}
diff --git a/pages/order/product-waitpay/product-waitpay.vue b/pages/order/product-waitpay/product-waitpay.vue
index 4a7879f..93eaa5e 100644
--- a/pages/order/product-waitpay/product-waitpay.vue
+++ b/pages/order/product-waitpay/product-waitpay.vue
@@ -167,6 +167,7 @@ import emitter from '../../../utils/emitter'
import { onLoad , onShow } from "@dcloudio/uni-app";
import { baseUrl } from '../../../api/request';
import addressComponentVue from '../component/addressComponent.vue'; //导入组件
+import { stateMap } from '../../../common/global';
//一些暂时变量
const num = ref(1)
const price = ref(138)
@@ -194,6 +195,7 @@ onMounted(() => {
emitter.on('addressInfo', (val) =>{
addressRealInfo.value = val
})
+ // console.log(stateMap.get('订单已经退款'));
})
onLoad((options)=>{
totalInfo.value = JSON.parse(options.cartInfo)
@@ -227,8 +229,7 @@ const getDefaultAddress = async () =>{
method: 'POST',
header: {
cookie: wx.getStorageSync('cookie')
- },
- data: { id: userInfo.value.id }
+ }
})
//根据for循环遍历默认地址
for(let key in res.data.data) {
diff --git a/pages/store-home/ProductDetails/ProductDetails.vue b/pages/store-home/ProductDetails/ProductDetails.vue
index eb97a28..c499ec9 100644
--- a/pages/store-home/ProductDetails/ProductDetails.vue
+++ b/pages/store-home/ProductDetails/ProductDetails.vue
@@ -1,10 +1,15 @@
-
+ /> -->
+
+
+
+
+
¥
@@ -83,21 +88,13 @@ import emitter from '../../../utils/emitter'
import addProduct from '../../Shopping-cart/component/addProduct.vue';
const popup = ref(null) //弹窗对象
const goodObject = ref({}) //商品对象
-// const checkedData = ref([{}]) //对齐批量购买
const idInfo = ref([]) //数量 + 商品id
const userInfo = ref({}) //用户信息
const labelList = ref([]) //标签
+const imgArr = ref([])
//转换上一页面传来的商品
onLoad((options) => {
- goodObject.value = JSON.parse(options.info) //将string转为objec赋值给商品对象
- idInfo.value = [{
- goodId: goodObject.value.id,
- quantity: 1 //暂时为1
- }]
- labelList.value = goodObject.value.label.split(";") //分割字符串,生成标签数组
- labelList.value = labelList.value.filter((s)=>{ //使用filter将最后一个空值去掉
- return s
- })
+ getProduct(JSON.parse(options.gid)) //页面加载的时候获取商品信息
})
onShow(()=>{
userInfo.value = wx.getStorageSync('userInfo') //获取用户信息
@@ -109,6 +106,30 @@ onMounted(()=>{
})
getFonts()
})
+const getProduct = async (gid) =>{ //根据商品获取商品信息
+ const res = await uni.request({
+ url: baseUrl + '/goods/getById',
+ method: 'POST',
+ data: { id: gid },
+ header: {
+ cookie: wx.getStorageSync('cookie')
+ }
+ })
+ // console.log('请求请求--->',res.data);
+ if(res.data.code === 1) {
+ goodObject.value = res.data.data
+ imgArr.value = res.data.data.goodImg.split(';') //将后端传来的图片字符串转为图片数组
+ // console.log(imgArr.value);
+ labelList.value = goodObject.value.label.split(';') //分割字符串,生成标签数组
+ labelList.value = labelList.value.filter((s)=>{ //使用filter将最后一个空值去掉
+ return s
+ })
+ idInfo.value = [{
+ goodId: goodObject.value.id,
+ quantity: 1 //暂时为1
+ }]
+ }
+}
const loadPop =()=>{
popup.value.open('bottom') //从底部弹出
emitter.emit('product',goodObject.value)
@@ -158,11 +179,11 @@ const getFonts =()=>{
overflow-x: hidden;
}
.image {
- width: 100vw;
- height: 72vw;
+ width: 100%;
+ height: 100%;
}
.section_2 {
- margin-top: 20.63rpx;
+ // margin-top: 20.63rpx;
padding-left: 18.75rpx;
padding-top: 19.2rpx;
background-color: #ffffff;
@@ -367,5 +388,9 @@ const getFonts =()=>{
.text_18 {
line-height: 27.77rpx;
}
+.swiper-box {
+ width: 100%;
+ height: calc(150vw * 9 / 16);
+}
@import url(../../../common/css/global.css);
\ No newline at end of file
diff --git a/pages/store-home/main/main.vue b/pages/store-home/main/main.vue
index 7635b7c..182ed0e 100644
--- a/pages/store-home/main/main.vue
+++ b/pages/store-home/main/main.vue
@@ -10,7 +10,7 @@
+ src="https://carbon2.obs.cn-north-4.myhuaweicloud.com:443/feiyi%2Ftest%2F0%2FloZarLZD-%E6%B5%8B%E8%AF%95%E6%8F%92%E5%85%A5.jpg" />
@@ -40,7 +40,7 @@
+ :src="item.goodImg.split(';')[0]" />
{{ item.name }}
{{ item.intro }}
@@ -55,9 +55,7 @@