From 0b35b8492bba4ce54e9f7110cd14853b09d35657 Mon Sep 17 00:00:00 2001
From: yuanteng0011 <1876787513@qq.com>
Date: Fri, 15 Nov 2024 14:22:52 +0800
Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E8=B4=AD=E4=B9=B0=EF=BC=8C?=
=?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=EF=BC=8C=E8=AE=A2=E5=8D=95=E8=AF=A6?=
=?UTF-8?q?=E6=83=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages.json | 7 ++
pages/Shopping-cart/component/addProduct.vue | 3 +
.../newaddress_Info/newaddress_Info.vue | 3 +
.../Shopping-cart/productmain/productmain.vue | 25 +++----
pages/login/login.vue | 4 +-
pages/mine/mineorders/mineorders.vue | 52 +++++++-------
pages/order/component/addressComponent.vue | 3 +
.../order/product-waitpay/product-waitpay.vue | 38 +++++++++--
pages/service/productDetail/productDetail.vue | 14 ++++
pages/store-home/main/main.vue | 10 ++-
unpackage/dist/dev/mp-weixin/addProduct.js | 3 +
unpackage/dist/dev/mp-weixin/app.js | 1 +
unpackage/dist/dev/mp-weixin/app.json | 3 +-
.../newaddress_Info/newaddress_Info.js | 3 +
.../Shopping-cart/productmain/productmain.js | 14 ++--
.../dist/dev/mp-weixin/pages/login/login.js | 2 +-
.../pages/mine/mineorders/mineorders.js | 60 +++++++++--------
.../pages/order/component/addressComponent.js | 3 +
.../order/product-waitpay/product-waitpay.js | 67 ++++++++-----------
.../product-waitpay/product-waitpay.wxml | 2 +-
.../service/productDetail/productDetail.js | 8 +++
.../service/productDetail/productDetail.json | 4 ++
.../service/productDetail/productDetail.wxml | 1 +
.../service/productDetail/productDetail.wxss | 0
.../mp-weixin/pages/store-home/main/main.js | 10 ++-
25 files changed, 219 insertions(+), 121 deletions(-)
create mode 100644 pages/service/productDetail/productDetail.vue
create mode 100644 unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.js
create mode 100644 unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.json
create mode 100644 unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.wxml
create mode 100644 unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.wxss
diff --git a/pages.json b/pages.json
index 6e7893b..ab0bade 100644
--- a/pages.json
+++ b/pages.json
@@ -161,6 +161,13 @@
{
"navigationBarTitleText" : ""
}
+ },
+ {
+ "path" : "pages/service/productDetail/productDetail",
+ "style" :
+ {
+ "navigationBarTitleText" : ""
+ }
}
],
"globalStyle": {
diff --git a/pages/Shopping-cart/component/addProduct.vue b/pages/Shopping-cart/component/addProduct.vue
index bec9f68..89a3ec3 100644
--- a/pages/Shopping-cart/component/addProduct.vue
+++ b/pages/Shopping-cart/component/addProduct.vue
@@ -74,6 +74,9 @@ const addCart = async()=>{
const res = await uni.request({
url: baseUrl + '/cart/add',
method: 'POST',
+ header: {
+ cookie: wx.getStorageSync('cookie')
+ },
data: {
userId: userInfo.value.id,
goodId: productBrief.value.id,
diff --git a/pages/Shopping-cart/newaddress_Info/newaddress_Info.vue b/pages/Shopping-cart/newaddress_Info/newaddress_Info.vue
index f77ae3a..96f47c4 100644
--- a/pages/Shopping-cart/newaddress_Info/newaddress_Info.vue
+++ b/pages/Shopping-cart/newaddress_Info/newaddress_Info.vue
@@ -88,6 +88,9 @@ const newAddress = async () =>{
const res = await uni.request({
url: baseUrl + '/address/add',
method: 'POST',
+ header: {
+ 'cookie': wx.getStorageSync('cookie')
+ },
data: {...addressParam.value}
})
console.log('res==>',res.data);
diff --git a/pages/Shopping-cart/productmain/productmain.vue b/pages/Shopping-cart/productmain/productmain.vue
index 0622294..9dbe0a1 100644
--- a/pages/Shopping-cart/productmain/productmain.vue
+++ b/pages/Shopping-cart/productmain/productmain.vue
@@ -142,7 +142,7 @@ import pull from '@/pages/Shopping-cart/productmain/img/pull.png';
import rmb from '@/pages/Shopping-cart/productmain/img/rmb.png';
import short from '@/pages/Shopping-cart/productmain/img/short.png';
const products = ref([])
-const current = ref(1)
+const current = ref(1) //用于判断是实体类商品还是服务类商品
const allCheck = ref(false) //全选
const checkedData = ref([]) //选择的暂存保存数组
const totalPrice = ref(0)
@@ -159,6 +159,9 @@ const getProductCart = async ()=>{
const res = await uni.request({
url: baseUrl + '/cart/list',
method: 'POST',
+ header: {
+ 'cookie': wx.getStorageSync('cookie')
+ },
data: { id: userInfo.id }
})
// console.log(res.data);
@@ -186,6 +189,14 @@ const getTextStyle = (num) => ({
});
//复选框绑定方法
const checkBoxChange =(event)=>{
+ console.log('方法被触发');
+ //如果选中的checkbox的value的数组长度和后端传过来的数组长度相等则为全选状态 allCheck为true
+ console.log('length---->',event.detail.value.length);
+ if(event.detail.value.length == products.value.length) {
+ allCheck.value = true
+ } else {
+ allCheck.value = false
+ }
checkedData.value = [{}] //每次都要重置一下
totalPrice.value = 0;
let count = 0; //用于记录checkedData不为null的个数
@@ -194,16 +205,11 @@ const checkBoxChange =(event)=>{
//计算一下总金额
for(let key in event.detail.value) {
let temp = parseInt(event.detail.value[parseInt(key)]) //相当于商品数组下标
- // totalPrice.value += products.value[temp].goodVO.price * products.value[temp].quantity
computed(products.value[temp].goodVO.price , products.value[temp].quantity)
}
- // products.value.forEach((item)=>{
- // item.checked = false
- // allCheck.value = false
- // })
event.detail.value.forEach((item)=>{
products.value[parseInt(item)].checked = true
- allCheck.value = false
+ // allCheck.value = false
})
//然后假如checkboxGroup传过来的 detail.value中有某个id则把这些元素的checked属性置为true(选中状态)
products.value.forEach((x)=>{
@@ -213,11 +219,6 @@ const checkBoxChange =(event)=>{
}
})
})
- //如果选中的checkbox的value的数组长度和后端传过来的数组长度相等则为全选状态 allCheck为true
- // console.log('length',event.detail.value.length);
- if(event.detail.value.length == products.value.length) {
- allCheck.value = true
- }
event.detail.value.forEach((item)=>{ //将选中的商品信息赋值给checkedData
console.log('products.value[parseInt(item)].goodId',products.value[parseInt(item)].goodId);
if(products.value[parseInt(item)] !== null) {
diff --git a/pages/login/login.vue b/pages/login/login.vue
index cee29b2..a2b4902 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -43,8 +43,8 @@ const loginUser = async ( code ) =>{
code: code
}
})
- console.log('loginUser后台返回的==>',res);
- uni.removeStorageSync('cookie');
+ console.log('loginUser后台返回的==>',res.header['Set-Cookie']);
+ uni.removeStorageSync('cookie');
uni.setStorageSync("cookie",res.header['Set-Cookie']); //保存setStorageSync到
if(res.data.code == 1) {
uni.showToast({
diff --git a/pages/mine/mineorders/mineorders.vue b/pages/mine/mineorders/mineorders.vue
index 4bf1e38..0ee67f6 100644
--- a/pages/mine/mineorders/mineorders.vue
+++ b/pages/mine/mineorders/mineorders.vue
@@ -116,34 +116,38 @@
testUrl,
suiUrl
} from '@/api/request';
- const currentColor = ref(0);
- onMounted(async () => {
- await Getorder();
- Status.displayedOrders = Status.orders;
- });
- const userInfo = ref({
- userInfo: uni.getStorageSync('userInfo'),
- });
- const Getorder = async () => {
- const res = await uni.request({
- url: baseUrl + '/order/list',
- method: 'POST',
- data: {
- // id:userInfo.value.userInfo.id,
- id: 215,
- },
- });
- if (res.data.code === 1) {
- Status.value.orders = res.data.data;
- } else {
- console.log('没拿到用户数据');
- }
- };
const Status = ref({
orderStatus: '全部',
orders: [],
displayedOrders: [],
});
+ const orderStatus = ''
+ const currentColor = ref(0);
+ const isSelected = (tab) => Status.value.orderStatus === tab;
+ onMounted(async () => {
+ await Getorder();
+ Status.value.displayedOrders = Status.value.orders;
+ });
+ const userInfo = wx.getStorageSync('userInfo')
+ const Getorder = async () => {
+ const res = await uni.request({
+ url: baseUrl + '/order/list',
+ method: 'POST',
+ header: {
+ cookie : wx.getStorageSync('cookie')
+ },
+ data: {
+ // id:userInfo.value.userInfo.id,
+ id: userInfo.id,
+ },
+ });
+ if (res.data.code === 1) {
+ console.log('res.data.data--->',res.data.data);
+ Status.value.orders = res.data.data;
+ } else {
+ console.log('没拿到用户数据');
+ }
+ };
const changeTab = (tab) => {
if (tab === '全部') {
Status.value.displayedOrders = Status.value.orders;
@@ -166,7 +170,7 @@
Status.value.orderStatus = tab;
}
};
- const isSelected = (tab) => Status.value.orderStatus === tab;
+
const goToText = (index) => {
console.log('下标-->', index);
diff --git a/pages/order/component/addressComponent.vue b/pages/order/component/addressComponent.vue
index 5975181..c88317e 100644
--- a/pages/order/component/addressComponent.vue
+++ b/pages/order/component/addressComponent.vue
@@ -55,6 +55,9 @@ const getAddressList = async () =>{
const res = await uni.request({
url: baseUrl + '/address/list' ,
method: 'POST',
+ header: {
+ 'cookie': wx.getStorageSync('cookie')
+ },
data: {
id : userInfo.id
}
diff --git a/pages/order/product-waitpay/product-waitpay.vue b/pages/order/product-waitpay/product-waitpay.vue
index 988ff7a..9f06787 100644
--- a/pages/order/product-waitpay/product-waitpay.vue
+++ b/pages/order/product-waitpay/product-waitpay.vue
@@ -57,14 +57,17 @@
+ class="image_5"
+ :src="short"
+ @click="shortNum(index)"
+ />
- 1
+ {{ item.quantity }}
@@ -203,7 +206,6 @@ onMounted(() => {
emitter.on('addressInfo', (val) =>{
addressRealInfo.value = val
})
-
})
onLoad((options)=>{
totalInfo.value = JSON.parse(options.cartInfo)
@@ -235,6 +237,9 @@ const getDefaultAddress = async () =>{
const res = await uni.request({
url: baseUrl + '/address/list',
method: 'POST',
+ header: {
+ cookie: wx.getStorageSync('cookie')
+ },
data: { id: userInfo.value.id }
})
//根据for循环遍历默认地址
@@ -250,6 +255,9 @@ const createOrder = async () => {
const resOrder = await uni.request({ //向后端发送生成订单请求
url: baseUrl + '/order/add',
method: 'POST',
+ header: {
+ cookie: wx.getStorageSync('cookie')
+ },
data: {
userId: userInfo.id,
orderType: productArr.value[0].goodVO.isGoodType ? 'product' : 'service' ,
@@ -267,7 +275,7 @@ const createOrder = async () => {
console.log('后台返回订单响应==>',resOrder);
if(resOrder.data.code === 1) {
uni.navigateTo({
- url: '/pages/order/paysuccess/paysuccess'
+ url: '/pages/mine/OrderDetails/OrderDetails'
})
} else {
uni.showToast({
@@ -282,6 +290,9 @@ const getProduct = async ()=> {
const res = await uni.request({
url: baseUrl + '/cart/cart/list',
method: 'POST',
+ header: {
+ cookie: wx.getStorageSync('cookie')
+ },
data: JSON.stringify(totalInfo.value)
})
if( res.data.code === 1 ) {
@@ -292,7 +303,22 @@ const getProduct = async ()=> {
})
}
}
-
+//减少当前商品数量
+const shortNum =(index)=>{
+ if(productArr.value[index].quantity > 1) {
+ productArr.value[index].quantity -= 1
+ //计算商品价格
+ sumprice.value -= productArr.value[index].goodVO.price * 1
+ }
+}
+//增加当前商品数量
+const addNum =(index)=>{
+ if( productArr.value[index].quantity < productArr.value[index].goodVO.inventory ) { //数量肯定不能大于库存
+ productArr.value[index].quantity += 1
+ //计算商品价格
+ sumprice.value += productArr.value[index].goodVO.price * 1
+ }
+}
diff --git a/pages/service/productDetail/productDetail.vue b/pages/service/productDetail/productDetail.vue
new file mode 100644
index 0000000..9e1a63f
--- /dev/null
+++ b/pages/service/productDetail/productDetail.vue
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
diff --git a/pages/store-home/main/main.vue b/pages/store-home/main/main.vue
index 47d3188..4b0e16c 100644
--- a/pages/store-home/main/main.vue
+++ b/pages/store-home/main/main.vue
@@ -72,11 +72,13 @@ const currentColor = ref(0);
const sort =ref([{}]) //商品类别对象数组
const headerList = ref([{}]) //类别标题和介绍
const productList = ref([{}]) //类别下对应的商品
+const cookie = wx.getStorageSync("cookie")
const product_type = [{
type: "材料包",
detail: "提供材料自行DIY"
}]
onMounted( async () => {
+ console.log('cookie--->',cookie);
await Getsort() //获取商品类别
await changeTypes( sort.value[0] , 0 ) //首先获取最开始的类别
})
@@ -84,7 +86,10 @@ onMounted( async () => {
const Getsort = async ()=>{
const res = await uni.request({
url: baseUrl + '/category/list',
- method:'POST'
+ method:'POST',
+ header: {
+ cookie,
+ }
})
if(res.data.code === 1){
for(let key in res.data.data) {
@@ -115,6 +120,9 @@ const changeTypes = async (item , index) =>{
method: 'POST',
data: {
id : item.id
+ },
+ header:{
+ cookie,
}
})
if(res.data.code === 1) {
diff --git a/unpackage/dist/dev/mp-weixin/addProduct.js b/unpackage/dist/dev/mp-weixin/addProduct.js
index e1e4d7c..2da82fb 100644
--- a/unpackage/dist/dev/mp-weixin/addProduct.js
+++ b/unpackage/dist/dev/mp-weixin/addProduct.js
@@ -25,6 +25,9 @@ const _sfc_main = {
const res = await common_vendor.index.request({
url: api_request.baseUrl + "/cart/add",
method: "POST",
+ header: {
+ cookie: common_vendor.wx$1.getStorageSync("cookie")
+ },
data: {
userId: userInfo.value.id,
goodId: productBrief.value.id,
diff --git a/unpackage/dist/dev/mp-weixin/app.js b/unpackage/dist/dev/mp-weixin/app.js
index d5dc4cf..ada9df9 100644
--- a/unpackage/dist/dev/mp-weixin/app.js
+++ b/unpackage/dist/dev/mp-weixin/app.js
@@ -26,6 +26,7 @@ if (!Math) {
"./pages/login/login.js";
"./pages/Shopping-cart/component/addProduct.js";
"./pages/mine/OrderDetails/OrderDetails.js";
+ "./pages/service/productDetail/productDetail.js";
}
const _sfc_main = {};
function _sfc_render(_ctx, _cache) {
diff --git a/unpackage/dist/dev/mp-weixin/app.json b/unpackage/dist/dev/mp-weixin/app.json
index d7b85e1..8ad1fe6 100644
--- a/unpackage/dist/dev/mp-weixin/app.json
+++ b/unpackage/dist/dev/mp-weixin/app.json
@@ -22,7 +22,8 @@
"pages/order/productOrderDetail/productOrderDetail",
"pages/login/login",
"pages/Shopping-cart/component/addProduct",
- "pages/mine/OrderDetails/OrderDetails"
+ "pages/mine/OrderDetails/OrderDetails",
+ "pages/service/productDetail/productDetail"
],
"window": {
"navigationBarTextStyle": "black",
diff --git a/unpackage/dist/dev/mp-weixin/pages/Shopping-cart/newaddress_Info/newaddress_Info.js b/unpackage/dist/dev/mp-weixin/pages/Shopping-cart/newaddress_Info/newaddress_Info.js
index 0f065e2..8c69c2a 100644
--- a/unpackage/dist/dev/mp-weixin/pages/Shopping-cart/newaddress_Info/newaddress_Info.js
+++ b/unpackage/dist/dev/mp-weixin/pages/Shopping-cart/newaddress_Info/newaddress_Info.js
@@ -37,6 +37,9 @@ const _sfc_main = {
const res = await common_vendor.index.request({
url: api_request.baseUrl + "/address/add",
method: "POST",
+ header: {
+ "cookie": common_vendor.wx$1.getStorageSync("cookie")
+ },
data: { ...addressParam.value }
});
console.log("res==>", res.data);
diff --git a/unpackage/dist/dev/mp-weixin/pages/Shopping-cart/productmain/productmain.js b/unpackage/dist/dev/mp-weixin/pages/Shopping-cart/productmain/productmain.js
index 86be4ca..db23dbb 100644
--- a/unpackage/dist/dev/mp-weixin/pages/Shopping-cart/productmain/productmain.js
+++ b/unpackage/dist/dev/mp-weixin/pages/Shopping-cart/productmain/productmain.js
@@ -19,6 +19,9 @@ const _sfc_main = {
const res = await common_vendor.index.request({
url: api_request.baseUrl + "/cart/list",
method: "POST",
+ header: {
+ "cookie": common_vendor.wx$1.getStorageSync("cookie")
+ },
data: { id: userInfo.id }
});
if (res.data.code === 1) {
@@ -36,6 +39,13 @@ const _sfc_main = {
"border-bottom": current.value === num ? "2px solid orange" : "2px solid #ffffff"
});
const checkBoxChange = (event) => {
+ console.log("方法被触发");
+ console.log("length---->", event.detail.value.length);
+ if (event.detail.value.length == products.value.length) {
+ allCheck.value = true;
+ } else {
+ allCheck.value = false;
+ }
checkedData.value = [{}];
totalPrice.value = 0;
let count = 0;
@@ -47,7 +57,6 @@ const _sfc_main = {
}
event.detail.value.forEach((item) => {
products.value[parseInt(item)].checked = true;
- allCheck.value = false;
});
products.value.forEach((x) => {
event.detail.value.forEach((y) => {
@@ -56,9 +65,6 @@ const _sfc_main = {
}
});
});
- if (event.detail.value.length == products.value.length) {
- allCheck.value = true;
- }
event.detail.value.forEach((item) => {
console.log("products.value[parseInt(item)].goodId", products.value[parseInt(item)].goodId);
if (products.value[parseInt(item)] !== null) {
diff --git a/unpackage/dist/dev/mp-weixin/pages/login/login.js b/unpackage/dist/dev/mp-weixin/pages/login/login.js
index 782353f..a3ebc4b 100644
--- a/unpackage/dist/dev/mp-weixin/pages/login/login.js
+++ b/unpackage/dist/dev/mp-weixin/pages/login/login.js
@@ -26,7 +26,7 @@ const _sfc_main = {
code
}
});
- console.log("loginUser后台返回的==>", res);
+ console.log("loginUser后台返回的==>", res.header["Set-Cookie"]);
common_vendor.index.removeStorageSync("cookie");
common_vendor.index.setStorageSync("cookie", res.header["Set-Cookie"]);
if (res.data.code == 1) {
diff --git a/unpackage/dist/dev/mp-weixin/pages/mine/mineorders/mineorders.js b/unpackage/dist/dev/mp-weixin/pages/mine/mineorders/mineorders.js
index ae2b7cf..0e00cb4 100644
--- a/unpackage/dist/dev/mp-weixin/pages/mine/mineorders/mineorders.js
+++ b/unpackage/dist/dev/mp-weixin/pages/mine/mineorders/mineorders.js
@@ -4,34 +4,37 @@ const api_request = require("../../../api/request.js");
const _sfc_main = {
__name: "mineorders",
setup(__props) {
- common_vendor.ref(0);
- common_vendor.onMounted(async () => {
- await Getorder();
- Status.displayedOrders = Status.orders;
- });
- common_vendor.ref({
- userInfo: common_vendor.index.getStorageSync("userInfo")
- });
- const Getorder = async () => {
- const res = await common_vendor.index.request({
- url: api_request.baseUrl + "/order/list",
- method: "POST",
- data: {
- // id:userInfo.value.userInfo.id,
- id: 215
- }
- });
- if (res.data.code === 1) {
- Status.value.orders = res.data.data;
- } else {
- console.log("没拿到用户数据");
- }
- };
const Status = common_vendor.ref({
orderStatus: "全部",
orders: [],
displayedOrders: []
});
+ common_vendor.ref(0);
+ const isSelected = (tab) => Status.value.orderStatus === tab;
+ common_vendor.onMounted(async () => {
+ await Getorder();
+ Status.value.displayedOrders = Status.value.orders;
+ });
+ const userInfo = common_vendor.wx$1.getStorageSync("userInfo");
+ const Getorder = async () => {
+ const res = await common_vendor.index.request({
+ url: api_request.baseUrl + "/order/list",
+ method: "POST",
+ header: {
+ cookie: common_vendor.wx$1.getStorageSync("cookie")
+ },
+ data: {
+ // id:userInfo.value.userInfo.id,
+ id: userInfo.id
+ }
+ });
+ if (res.data.code === 1) {
+ console.log("res.data.data--->", res.data.data);
+ Status.value.orders = res.data.data;
+ } else {
+ console.log("没拿到用户数据");
+ }
+ };
const changeTab = (tab) => {
if (tab === "全部") {
Status.value.displayedOrders = Status.value.orders;
@@ -54,7 +57,6 @@ const _sfc_main = {
Status.value.orderStatus = tab;
}
};
- const isSelected = (tab) => Status.value.orderStatus === tab;
const goToText = (index) => {
console.log("下标-->", index);
common_vendor.index.navigateTo({
@@ -63,19 +65,19 @@ const _sfc_main = {
};
return (_ctx, _cache) => {
return {
- a: _ctx.orderStatus === "全部" ? 1 : "",
+ a: "",
b: isSelected("全部") ? 1 : "",
c: common_vendor.o(($event) => changeTab("全部")),
- d: _ctx.orderStatus === "待支付" ? 1 : "",
+ d: "",
e: isSelected("待支付") ? 1 : "",
f: common_vendor.o(($event) => changeTab("待支付")),
- g: _ctx.orderStatus === "待发货" ? 1 : "",
+ g: "",
h: isSelected("待发货") ? 1 : "",
i: common_vendor.o(($event) => changeTab("待发货")),
- j: _ctx.orderStatus === "已发货" ? 1 : "",
+ j: "",
k: isSelected("已发货") ? 1 : "",
l: common_vendor.o(($event) => changeTab("已发货")),
- m: _ctx.orderStatus === "售后" ? 1 : "",
+ m: "",
n: isSelected("售后") ? 1 : "",
o: common_vendor.o(($event) => changeTab("售后")),
p: common_vendor.f(Status.value.displayedOrders, (order, index, i0) => {
diff --git a/unpackage/dist/dev/mp-weixin/pages/order/component/addressComponent.js b/unpackage/dist/dev/mp-weixin/pages/order/component/addressComponent.js
index 3b09086..7bf7b83 100644
--- a/unpackage/dist/dev/mp-weixin/pages/order/component/addressComponent.js
+++ b/unpackage/dist/dev/mp-weixin/pages/order/component/addressComponent.js
@@ -15,6 +15,9 @@ const _sfc_main = {
const res = await common_vendor.index.request({
url: api_request.baseUrl + "/address/list",
method: "POST",
+ header: {
+ "cookie": common_vendor.wx$1.getStorageSync("cookie")
+ },
data: {
id: userInfo.id
}
diff --git a/unpackage/dist/dev/mp-weixin/pages/order/product-waitpay/product-waitpay.js b/unpackage/dist/dev/mp-weixin/pages/order/product-waitpay/product-waitpay.js
index ac7482e..8803671 100644
--- a/unpackage/dist/dev/mp-weixin/pages/order/product-waitpay/product-waitpay.js
+++ b/unpackage/dist/dev/mp-weixin/pages/order/product-waitpay/product-waitpay.js
@@ -28,28 +28,7 @@ const _sfc_main = {
const productArr = common_vendor.ref([]);
common_vendor.ref([]);
const userInfo = common_vendor.wx$1.getStorageSync("userInfo");
- common_vendor.ref({
- userId: userInfo.id,
- orderType: "",
- userName: "",
- orderNumber: null,
- addressId: 0,
- //地址信息id
- contactsId: 0,
- //联系人信息id
- couponId: 0,
- //优惠卷id
- totalAmount: 0,
- //实付价格
- orderStatus: null,
- note: null,
- orderItemMainInfoAddRequestList: [
- {
- goodId: 0,
- quantity: 10
- }
- ]
- });
+ common_vendor.ref({});
const totalInfo = common_vendor.ref([]);
const note = common_vendor.ref("");
common_vendor.onMounted(() => {
@@ -80,6 +59,9 @@ const _sfc_main = {
const res = await common_vendor.index.request({
url: api_request.baseUrl + "/address/list",
method: "POST",
+ header: {
+ cookie: common_vendor.wx$1.getStorageSync("cookie")
+ },
data: { id: userInfo.value.id }
});
for (let key in res.data.data) {
@@ -91,8 +73,12 @@ const _sfc_main = {
const createOrder = async () => {
console.log("地址信息-->", addressRealInfo.value);
const resOrder = await common_vendor.index.request({
+ //向后端发送生成订单请求
url: api_request.baseUrl + "/order/add",
method: "POST",
+ header: {
+ cookie: common_vendor.wx$1.getStorageSync("cookie")
+ },
data: {
userId: userInfo.id,
orderType: productArr.value[0].goodVO.isGoodType ? "product" : "service",
@@ -109,25 +95,10 @@ const _sfc_main = {
orderItemMainInfoAddRequestList: common_vendor.toRaw(totalInfo.value)
}
});
- console.log("---->", {
- userId: userInfo.id,
- orderType: productArr.value[0].goodVO.isGoodType ? "product" : "service",
- userName: userInfo.userName,
- orderNumber: "null",
- addressId: addressRealInfo.value.id,
- //地址信息id
- // contactsId: null, //联系人信息id
- // couponId: null, //优惠卷id
- totalAmount: sumprice.value,
- //实付价格
- orderStatus: "待支付",
- note: note.value,
- orderItemMainInfoAddRequestList: totalInfo.value[0]
- });
console.log("后台返回订单响应==>", resOrder);
if (resOrder.data.code === 1) {
common_vendor.index.navigateTo({
- url: "/pages/order/paysuccess/paysuccess"
+ url: "/pages/mine/OrderDetails/OrderDetails"
});
} else {
common_vendor.index.showToast({
@@ -141,6 +112,9 @@ const _sfc_main = {
const res = await common_vendor.index.request({
url: api_request.baseUrl + "/cart/cart/list",
method: "POST",
+ header: {
+ cookie: common_vendor.wx$1.getStorageSync("cookie")
+ },
data: JSON.stringify(totalInfo.value)
});
if (res.data.code === 1) {
@@ -151,6 +125,18 @@ const _sfc_main = {
});
}
};
+ const shortNum = (index) => {
+ if (productArr.value[index].quantity > 1) {
+ productArr.value[index].quantity -= 1;
+ sumprice.value -= productArr.value[index].goodVO.price * 1;
+ }
+ };
+ const addNum = (index) => {
+ if (productArr.value[index].quantity < productArr.value[index].goodVO.inventory) {
+ productArr.value[index].quantity += 1;
+ sumprice.value += productArr.value[index].goodVO.price * 1;
+ }
+ };
return (_ctx, _cache) => {
return {
a: common_vendor.t(addressRealInfo.value.region),
@@ -166,7 +152,10 @@ const _sfc_main = {
b: common_vendor.t(item.goodVO.name),
c: common_vendor.t(item.goodVO.type),
d: common_vendor.t(item.goodVO.price),
- e: index
+ e: common_vendor.o(($event) => shortNum(index), index),
+ f: common_vendor.t(item.quantity),
+ g: common_vendor.o(($event) => addNum(index), index),
+ h: index
};
}),
i: common_vendor.unref(common_assets.short),
diff --git a/unpackage/dist/dev/mp-weixin/pages/order/product-waitpay/product-waitpay.wxml b/unpackage/dist/dev/mp-weixin/pages/order/product-waitpay/product-waitpay.wxml
index a5b3e96..db1803a 100644
--- a/unpackage/dist/dev/mp-weixin/pages/order/product-waitpay/product-waitpay.wxml
+++ b/unpackage/dist/dev/mp-weixin/pages/order/product-waitpay/product-waitpay.wxml
@@ -1 +1 @@
-{{a}}{{c}}更换地址{{f}}{{g}}{{item.b}}【{{item.c}}】¥{{item.d}}.001注:购买商品均视为同意用户须知共 {{l}} 件商品合计{{n}}.00订单备注应付:{{r}}.00微信支付
\ No newline at end of file
+{{a}}{{c}}更换地址{{f}}{{g}}{{item.b}}【{{item.c}}】¥{{item.d}}.00{{item.f}}注:购买商品均视为同意用户须知共 {{l}} 件商品合计{{n}}.00订单备注应付:{{r}}.00微信支付
\ No newline at end of file
diff --git a/unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.js b/unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.js
new file mode 100644
index 0000000..b710aed
--- /dev/null
+++ b/unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.js
@@ -0,0 +1,8 @@
+"use strict";
+const common_vendor = require("../../../common/vendor.js");
+const _sfc_main = {};
+function _sfc_render(_ctx, _cache) {
+ return {};
+}
+const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
+wx.createPage(MiniProgramPage);
diff --git a/unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.json b/unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.json
new file mode 100644
index 0000000..a0812ee
--- /dev/null
+++ b/unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.json
@@ -0,0 +1,4 @@
+{
+ "navigationBarTitleText": "",
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.wxml b/unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.wxml
new file mode 100644
index 0000000..c2bf272
--- /dev/null
+++ b/unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.wxml
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.wxss b/unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.wxss
new file mode 100644
index 0000000..e69de29
diff --git a/unpackage/dist/dev/mp-weixin/pages/store-home/main/main.js b/unpackage/dist/dev/mp-weixin/pages/store-home/main/main.js
index dae8a3f..f6d3a89 100644
--- a/unpackage/dist/dev/mp-weixin/pages/store-home/main/main.js
+++ b/unpackage/dist/dev/mp-weixin/pages/store-home/main/main.js
@@ -9,14 +9,19 @@ const _sfc_main = {
const sort = common_vendor.ref([{}]);
const headerList = common_vendor.ref([{}]);
const productList = common_vendor.ref([{}]);
+ const cookie = common_vendor.wx$1.getStorageSync("cookie");
common_vendor.onMounted(async () => {
+ console.log("cookie--->", cookie);
await Getsort();
await changeTypes(sort.value[0], 0);
});
const Getsort = async () => {
const res = await common_vendor.index.request({
url: api_request.baseUrl + "/category/list",
- method: "POST"
+ method: "POST",
+ header: {
+ cookie
+ }
});
if (res.data.code === 1) {
for (let key in res.data.data) {
@@ -48,6 +53,9 @@ const _sfc_main = {
method: "POST",
data: {
id: item.id
+ },
+ header: {
+ cookie
}
});
if (res.data.code === 1) {