批量购买,购物车,订单详情
This commit is contained in:
parent
aed8fae442
commit
0b35b8492b
|
@ -161,6 +161,13 @@
|
|||
{
|
||||
"navigationBarTitleText" : ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/service/productDetail/productDetail",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -57,14 +57,17 @@
|
|||
</view>
|
||||
<view class="flex-row">
|
||||
<image
|
||||
class="image_5"
|
||||
:src="short" />
|
||||
class="image_5"
|
||||
:src="short"
|
||||
@click="shortNum(index)"
|
||||
/>
|
||||
<view class="flex-col justify-start items-center text-wrapper_4 ml-2">
|
||||
<text class="font text_12">1</text>
|
||||
<text class="font text_12">{{ item.quantity }}</text>
|
||||
</view>
|
||||
<image
|
||||
class="image_6 ml-2"
|
||||
:src="add"
|
||||
@click="addNum(index)"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
|
14
pages/service/productDetail/productDetail.vue
Normal file
14
pages/service/productDetail/productDetail.vue
Normal file
|
@ -0,0 +1,14 @@
|
|||
<template>
|
||||
<view class="">
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
|
@ -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) {
|
||||
|
|
3
unpackage/dist/dev/mp-weixin/addProduct.js
vendored
3
unpackage/dist/dev/mp-weixin/addProduct.js
vendored
|
@ -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,
|
||||
|
|
1
unpackage/dist/dev/mp-weixin/app.js
vendored
1
unpackage/dist/dev/mp-weixin/app.js
vendored
|
@ -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) {
|
||||
|
|
3
unpackage/dist/dev/mp-weixin/app.json
vendored
3
unpackage/dist/dev/mp-weixin/app.json
vendored
|
@ -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",
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -1 +1 @@
|
|||
<view class="flex-col page data-v-eda1e8f0"><view class="flex-col justify-start data-v-eda1e8f0"><view class="flex-col group data-v-eda1e8f0"><view class="flex-col section data-v-eda1e8f0"><view class="flex-row justify-between data-v-eda1e8f0"><view class="flex-col data-v-eda1e8f0"><text class="self-center font text data-v-eda1e8f0">{{a}}</text><view class="flex-row items-center self-stretch data-v-eda1e8f0"><image class="shrink-0 image_2 data-v-eda1e8f0" src="{{b}}"/><text class="font_2 text_2 ml-7 data-v-eda1e8f0">{{c}}</text></view></view><view class="flex-row self-start group_2 data-v-eda1e8f0" bindtap="{{e}}"><image class="image_3 data-v-eda1e8f0" src="{{d}}"/><text class="font_3 text_3 data-v-eda1e8f0">更换地址</text></view></view><view class="flex-row items-baseline group_3 mt-4 data-v-eda1e8f0"><text class="font_2 text_4 data-v-eda1e8f0">{{f}}</text><text class="font_2 text_5 data-v-eda1e8f0">{{g}}</text></view></view><view wx:for="{{h}}" wx:for-item="item" wx:key="e" class="flex-col section_2 mt-8 data-v-eda1e8f0"><view class="flex-row data-v-eda1e8f0"><image class="image_4 data-v-eda1e8f0" src="{{item.a}}"/><view class="flex-col self-start group_4 ml-17 data-v-eda1e8f0"><view class="flex-row self-stretch data-v-eda1e8f0"><text class="font data-v-eda1e8f0">{{item.b}}</text><text class="font ml-4 data-v-eda1e8f0">【{{item.c}}】</text></view><view class="flex-row self-stretch mt-12 data-v-eda1e8f0"></view></view></view><view class="flex-row justify-between items-center group_5 data-v-eda1e8f0"><view class="flex-row items-center group_6 data-v-eda1e8f0"><text class="text_10 data-v-eda1e8f0">¥{{item.d}}</text><text class="font text_11 data-v-eda1e8f0">.00</text></view><view class="flex-row data-v-eda1e8f0"><image class="image_5 data-v-eda1e8f0" src="{{i}}"/><view class="flex-col justify-start items-center text-wrapper_4 ml-2 data-v-eda1e8f0"><text class="font text_12 data-v-eda1e8f0">1</text></view><image class="image_6 ml-2 data-v-eda1e8f0" src="{{j}}"/></view></view><view class="flex-row justify-end items-center group_7 data-v-eda1e8f0"><view class="group_8 data-v-eda1e8f0"><text class="font_2 text_13 data-v-eda1e8f0">注:购买商品均视为同意</text><text class="font_2 text_14 data-v-eda1e8f0">用户须知</text></view><image class="shrink-0 image_9 ml-2 data-v-eda1e8f0" src="{{k}}"/></view></view><view class="flex-col section_3 mt-8 data-v-eda1e8f0"><view class="flex-row justify-between items-center group_9 data-v-eda1e8f0"><view class="flex-row data-v-eda1e8f0"><text class="font_5 text_16 ml-7 data-v-eda1e8f0">共 {{l}} 件商品</text></view></view><view class="flex-col mt-25 data-v-eda1e8f0"><view class="flex-col mt-9 data-v-eda1e8f0"><view class="flex-row justify-between items-center group_13 data-v-eda1e8f0"><text class="font_4 text_22 data-v-eda1e8f0">合计</text><view class="flex-row items-center data-v-eda1e8f0"><image class="shrink-0 image_10 data-v-eda1e8f0" src="{{m}}"/><text class="font_6 data-v-eda1e8f0">{{n}}.00</text></view></view></view></view></view><view class="flex-col section_1 mt-8 data-v-eda1e8f0"><text class="self-start font_7 data-v-eda1e8f0">订单备注</text><block wx:if="{{r0}}"><textarea class="text-wrapper_5 mt-11 data-v-eda1e8f0" placeholder="备注建议提前协商(250字以内)" value="{{o}}" bindinput="{{p}}"></textarea></block></view></view></view><view class="flex-row justify-between items-center section_4 mt-194 data-v-eda1e8f0"><view class="flex-row items-center data-v-eda1e8f0"><image class="shrink-0 image_10 image_13 data-v-eda1e8f0" src="{{q}}"/><text class="font_7 text_24 data-v-eda1e8f0">应付:</text><text class="text_25 data-v-eda1e8f0">{{r}}.</text><text class="font_6 text_27 data-v-eda1e8f0">00</text></view><view class="flex-col justify-start items-center text-wrapper_6 data-v-eda1e8f0" bindtap="{{s}}"><text class="font_4 text_26 data-v-eda1e8f0">微信支付</text></view></view></view><uni-popup wx:if="{{w}}" class="r data-v-eda1e8f0" u-s="{{['d']}}" u-r="popup" bindchange="{{v}}" u-i="eda1e8f0-0" bind:__l="__l" u-p="{{w}}"><view class="popup-content data-v-eda1e8f0"><address-component-vue class="data-v-eda1e8f0" u-i="eda1e8f0-1,eda1e8f0-0" bind:__l="__l"></address-component-vue></view></uni-popup>
|
||||
<view class="flex-col page data-v-eda1e8f0"><view class="flex-col justify-start data-v-eda1e8f0"><view class="flex-col group data-v-eda1e8f0"><view class="flex-col section data-v-eda1e8f0"><view class="flex-row justify-between data-v-eda1e8f0"><view class="flex-col data-v-eda1e8f0"><text class="self-center font text data-v-eda1e8f0">{{a}}</text><view class="flex-row items-center self-stretch data-v-eda1e8f0"><image class="shrink-0 image_2 data-v-eda1e8f0" src="{{b}}"/><text class="font_2 text_2 ml-7 data-v-eda1e8f0">{{c}}</text></view></view><view class="flex-row self-start group_2 data-v-eda1e8f0" bindtap="{{e}}"><image class="image_3 data-v-eda1e8f0" src="{{d}}"/><text class="font_3 text_3 data-v-eda1e8f0">更换地址</text></view></view><view class="flex-row items-baseline group_3 mt-4 data-v-eda1e8f0"><text class="font_2 text_4 data-v-eda1e8f0">{{f}}</text><text class="font_2 text_5 data-v-eda1e8f0">{{g}}</text></view></view><view wx:for="{{h}}" wx:for-item="item" wx:key="h" class="flex-col section_2 mt-8 data-v-eda1e8f0"><view class="flex-row data-v-eda1e8f0"><image class="image_4 data-v-eda1e8f0" src="{{item.a}}"/><view class="flex-col self-start group_4 ml-17 data-v-eda1e8f0"><view class="flex-row self-stretch data-v-eda1e8f0"><text class="font data-v-eda1e8f0">{{item.b}}</text><text class="font ml-4 data-v-eda1e8f0">【{{item.c}}】</text></view><view class="flex-row self-stretch mt-12 data-v-eda1e8f0"></view></view></view><view class="flex-row justify-between items-center group_5 data-v-eda1e8f0"><view class="flex-row items-center group_6 data-v-eda1e8f0"><text class="text_10 data-v-eda1e8f0">¥{{item.d}}</text><text class="font text_11 data-v-eda1e8f0">.00</text></view><view class="flex-row data-v-eda1e8f0"><image class="image_5 data-v-eda1e8f0" src="{{i}}" bindtap="{{item.e}}"/><view class="flex-col justify-start items-center text-wrapper_4 ml-2 data-v-eda1e8f0"><text class="font text_12 data-v-eda1e8f0">{{item.f}}</text></view><image class="image_6 ml-2 data-v-eda1e8f0" src="{{j}}" bindtap="{{item.g}}"/></view></view><view class="flex-row justify-end items-center group_7 data-v-eda1e8f0"><view class="group_8 data-v-eda1e8f0"><text class="font_2 text_13 data-v-eda1e8f0">注:购买商品均视为同意</text><text class="font_2 text_14 data-v-eda1e8f0">用户须知</text></view><image class="shrink-0 image_9 ml-2 data-v-eda1e8f0" src="{{k}}"/></view></view><view class="flex-col section_3 mt-8 data-v-eda1e8f0"><view class="flex-row justify-between items-center group_9 data-v-eda1e8f0"><view class="flex-row data-v-eda1e8f0"><text class="font_5 text_16 ml-7 data-v-eda1e8f0">共 {{l}} 件商品</text></view></view><view class="flex-col mt-25 data-v-eda1e8f0"><view class="flex-col mt-9 data-v-eda1e8f0"><view class="flex-row justify-between items-center group_13 data-v-eda1e8f0"><text class="font_4 text_22 data-v-eda1e8f0">合计</text><view class="flex-row items-center data-v-eda1e8f0"><image class="shrink-0 image_10 data-v-eda1e8f0" src="{{m}}"/><text class="font_6 data-v-eda1e8f0">{{n}}.00</text></view></view></view></view></view><view class="flex-col section_1 mt-8 data-v-eda1e8f0"><text class="self-start font_7 data-v-eda1e8f0">订单备注</text><block wx:if="{{r0}}"><textarea class="text-wrapper_5 mt-11 data-v-eda1e8f0" placeholder="备注建议提前协商(250字以内)" value="{{o}}" bindinput="{{p}}"></textarea></block></view></view></view><view class="flex-row justify-between items-center section_4 mt-194 data-v-eda1e8f0"><view class="flex-row items-center data-v-eda1e8f0"><image class="shrink-0 image_10 image_13 data-v-eda1e8f0" src="{{q}}"/><text class="font_7 text_24 data-v-eda1e8f0">应付:</text><text class="text_25 data-v-eda1e8f0">{{r}}.</text><text class="font_6 text_27 data-v-eda1e8f0">00</text></view><view class="flex-col justify-start items-center text-wrapper_6 data-v-eda1e8f0" bindtap="{{s}}"><text class="font_4 text_26 data-v-eda1e8f0">微信支付</text></view></view></view><uni-popup wx:if="{{w}}" class="r data-v-eda1e8f0" u-s="{{['d']}}" u-r="popup" bindchange="{{v}}" u-i="eda1e8f0-0" bind:__l="__l" u-p="{{w}}"><view class="popup-content data-v-eda1e8f0"><address-component-vue class="data-v-eda1e8f0" u-i="eda1e8f0-1,eda1e8f0-0" bind:__l="__l"></address-component-vue></view></uni-popup>
|
8
unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.js
vendored
Normal file
8
unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.js
vendored
Normal file
|
@ -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);
|
4
unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.json
vendored
Normal file
4
unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.json
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"navigationBarTitleText": "",
|
||||
"usingComponents": {}
|
||||
}
|
1
unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.wxml
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
<view class=""></view>
|
0
unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.wxss
vendored
Normal file
0
unpackage/dist/dev/mp-weixin/pages/service/productDetail/productDetail.wxss
vendored
Normal file
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user