diff --git a/.env.development b/.env.development index f5f48a0..d46ca2a 100644 --- a/.env.development +++ b/.env.development @@ -4,11 +4,11 @@ VITE_NOW_TYPE = 'dist' # VITE_PUSH_URL = 'ws://192.168.1.201:8787' # VITE_BASE_URL = 'http://192.168.1.201:8545' -# VITE_PUSH_URL = 'ws://192.168.1.22:8787' -# VITE_BASE_URL = 'http://192.168.1.22:8545' +VITE_PUSH_URL = 'ws://192.168.1.22:8787' +VITE_BASE_URL = 'http://192.168.1.22:8545' -VITE_PUSH_URL ='wss://test-multi-store.lihaink.cn/pull' -VITE_BASE_URL = 'https://test-multi-store.lihaink.cn' +# VITE_PUSH_URL ='wss://test-multi-store.lihaink.cn/pull' +# VITE_BASE_URL = 'https://test-multi-store.lihaink.cn' # VITE_PUSH_URL ='wss://multi-store.lihaink.cn/pull' # VITE_BASE_URL = 'https://multi-store.lihaink.cn' \ No newline at end of file diff --git a/src/api/store.js b/src/api/store.js index 9e13501..c24cb15 100644 --- a/src/api/store.js +++ b/src/api/store.js @@ -191,3 +191,18 @@ export function storeOrderCheckSmsApi(data) { export function storeOrderPrintApi(data) { return request.get(`/store_order/StoreOrder/print`, { params: data }) } + +/** + * @description 用户商品存储列表 + */ +export function userProductStorageApi(data) { + return request.get(`/user_product_storage/UserProductStorage/lists`, { params: data }) +} + + +/** + * @description 用户商品存储出库 + */ +export function userProductStorageSupplyApi(data) { + return request.post(`/user_product_storage/UserProductStorage/supply`, data) +} diff --git a/src/components/pay.vue b/src/components/pay.vue index 25f9831..fa525fd 100644 --- a/src/components/pay.vue +++ b/src/components/pay.vue @@ -61,10 +61,12 @@ const form = ref({}); const cart_id = ref([]); const uid = ref(''); const isRePay = ref(false); +let is_storage = 0; const setForm = (e) => { form.value = e.data; cart_id.value = e.cart_id; uid.value = e.uid; + is_storage = e.is_storage || 0; console.log('选择了用户==', uid.value || '游客'); isRePay.value = e.isRePay || false; }; @@ -72,6 +74,7 @@ const setForm = (e) => { const setRePay = (e) => { form.value.pay_price = e.price; order_id.value = e.order_id; + is_storage = e.is_storage || 0; }; const emit = defineEmits(["paySuccess"]); @@ -120,6 +123,7 @@ const handleEnter = () => { key: form.value.key, cart_id: cart_id.value, pay_type: pay_type, + is_storage: is_storage, auth_code: input.value, uid: uid.value }) @@ -176,6 +180,7 @@ const orderPay = () => { orderPayApi({ order_id: form.value.order_id, pay_type: pay_type, + is_storage: is_storage, auth_code: input.value, uid: uid.value }).then((res) => { @@ -345,6 +350,7 @@ const cashBnt = () => { orderCreateApi({ cart_id: cart_id.value, pay_type: "17", //现金支付 17 + is_storage: is_storage, uid: uid.value }) .then((res) => { @@ -452,6 +458,7 @@ const handlecodeEnter = () => { if (active.value == 4) pay_type = 19; //礼品券兑换 orderCreateApi({ pay_type: pay_type, + is_storage: is_storage, sms_code: smsCode.value, cart_id: cart_id.value, uid: uid.value diff --git a/src/views/saleHome/component/order.vue b/src/views/saleHome/component/order.vue index d3a86cf..cc8a039 100644 --- a/src/views/saleHome/component/order.vue +++ b/src/views/saleHome/component/order.vue @@ -47,11 +47,11 @@ const getList = () => { extend.value = res.data.extend; list.value = res.data.lists || []; // if (res.data?.lists?.length > 0) { - // list.value = res.data.lists; - // allPrice.value = res.data?.lists.reduce((previous, current) => { - // return previous + Number(current.total_price); - // }, 0) - // costPrice.value = allPrice.value; + // list.value = res.data.lists; + // allPrice.value = res.data?.lists.reduce((previous, current) => { + // return previous + Number(current.total_price); + // }, 0) + // costPrice.value = allPrice.value; // } else list.value = []; }); }; @@ -74,11 +74,11 @@ const changeCartNum = (val, old) => { // allPrice.value += item.price * item.cart_num; // }); // costPrice.value = allPrice.value; - }).catch((err)=>{ + }).catch((err) => { let match = err?.msg?.match(/\b\d+(\.\d+)?\b/); - if(match){ + if (match) { val.cart_num = +match[0]; - }else val.cart_num = 1; + } else val.cart_num = 1; }); }; @@ -111,12 +111,22 @@ const setUser = (row) => { userInfo.value.uid = row.id; } +const is_storage = ref(false) + +const resetView = ()=>{ + is_storage.value = false; + userInfo.value.uid = ""; + getList(); +} + defineExpose({ getList, + resetView, list, discounts, allPrice, - userInfo + userInfo, + is_storage }); // 键盘事件 @@ -152,7 +162,8 @@ onUnmounted(() => {
-
采购款: {{ userInfo.purchase_funds }}
+
采购款: {{ + userInfo.purchase_funds }}
礼品券: {{ userInfo.get_frozen }}
重置 @@ -198,8 +209,8 @@ onUnmounted(() => { ¥{{ item.price }}
- +
@@ -207,28 +218,34 @@ onUnmounted(() => { @@ -361,7 +378,7 @@ onUnmounted(() => { background-color: #fff; .order-total { - height: 2.5rem; + height: 3.5rem; padding: 1rem 2rem; display: flex; justify-content: space-between; diff --git a/src/views/saleHome/index.vue b/src/views/saleHome/index.vue index 059ea5f..fa001c4 100644 --- a/src/views/saleHome/index.vue +++ b/src/views/saleHome/index.vue @@ -108,7 +108,7 @@ const checkOut = () => { let cart_id = orderRef.value.list.map((item) => item.id); let query = { cart_id: cart_id, - uid: orderRef.value?.userInfo?.uid || "" + uid: orderRef.value?.userInfo?.uid || "", }; if (orderRef.value.discounts > 0) { query.deduction_price = orderRef.value.discounts.toFixed(2); @@ -119,7 +119,8 @@ const checkOut = () => { payRef.value.setForm({ data: res.data.order, cart_id: cart_id, - uid: orderRef.value?.userInfo?.uid || "" + uid: orderRef.value?.userInfo?.uid || "", + is_storage: orderRef.value?.is_storage ? 1 : 0, }); }); }; @@ -138,7 +139,7 @@ const paySuccess = (data = null) => { // } // if(data) onPrint(data); setTimeout(() => { - orderRef.value.getList(); + orderRef.value.resetView(); }) }; diff --git a/src/views/user/component/add.vue b/src/views/user/component/add.vue index 602511b..d429a57 100644 --- a/src/views/user/component/add.vue +++ b/src/views/user/component/add.vue @@ -3,8 +3,9 @@ import { ref, onMounted, onUnmounted, reactive } from "vue"; import { apiProvince, apiCity, apiArea, apiStreet, apiVillage, apiBrigade } from '@/api/public' import { userShipApi, userAddApi, userArchivesSmsApi } from "@/api/user" import { ElMessage } from "element-plus"; +import { useUserStore } from "@/store/user"; - +const userStore = useUserStore(); const formDataRef = ref(null); const formDataInfo = reactive({ mobile: '', @@ -138,6 +139,7 @@ const addUser = () => { forms.street = formDataInfo.selectedValues[2] forms.village = formDataInfo.selectedValues[3] forms.brigade = formDataInfo.selectedValues[4] + forms.store_id = userStore.userInfo.store_id; userAddApi(forms).then(res=>{ emit('close') }) diff --git a/src/views/user/component/detail.vue b/src/views/user/component/detail.vue index 12cb935..6d8ea67 100644 --- a/src/views/user/component/detail.vue +++ b/src/views/user/component/detail.vue @@ -6,6 +6,7 @@ import { useRouter } from "vue-router"; import mitt from "@/utils/mitt.js"; import payUser from "@/components/payUser.vue"; import { userAddressDetailApi, userAddressEditApi, userDetailApi } from "@/api/user" +import { userProductStorageApi, userProductStorageSupplyApi } from "@/api/store" import { apiProvince, apiCity, apiArea, apiStreet, apiVillage, apiBrigade } from '@/api/public' import { userShipApi, userShipUpdateApi, userLabelListApi, userLabelUpdateApi } from "@/api/user" @@ -221,83 +222,63 @@ const activeStoreList = ref(["基本信息", "用户资产"]); const isOut = ref(false); // 是否为出库状态 const productList = ref([]); // 商品列表 -const initProduct = ()=>{ - - productList.value = [ - { - "id": 574, - "oid": 568, - "product_id": 44, - "cart_info": { - "product_id": 44, - "cart_num": 3, - "price": "56.00", - "cost": "56.00", - "total_price": "189.00", - "deduction_price": 0, - "vip": 0, - "purchase": "162.00", - "pay_price": "168.00", - "store_price": "168.00", - "old_cart_id": 766, - "verify_code": "8-12407", - "name": "陈醋", - "image": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240615/202406151511024463d0051.jpg" - } - }, - { - "id": 575, - "oid": 568, - "product_id": 45, - "cart_info": { - "product_id": 45, - "cart_num": 2, - "price": "164.00", - "cost": "164.00", - "total_price": "368.00", - "deduction_price": 0, - "vip": 0, - "purchase": "312.00", - "pay_price": "328.00", - "store_price": "328.00", - "old_cart_id": 767, - "verify_code": "8-12407", - "name": "青花椒油", - "image": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240615/202406151511025ef012582.jpg" - } - }, - { - "id": 576, - "oid": 568, - "product_id": 40, - "cart_info": { - "product_id": 40, - "cart_num": 2, - "price": "2.50", - "cost": "2.50", - "total_price": "5.60", - "deduction_price": 0, - "vip": 0, - "purchase": "48.00", - "pay_price": "5.00", - "store_price": "5.00", - "old_cart_id": 769, - "verify_code": "8-12407", - "name": "草果", - "image": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240615/20240615150435f2ea41542.jpg" - } - } - ] +const whereProduct = ref({ + page_no: 1, + page_size: 10, + loading: false, + loadend: false +}) +let info = []; // 出库列表 +const initProduct = (re=false)=>{ + if(re){ + productList.value = []; + whereProduct.value.page_no = 1; + whereProduct.value.loadend = false; + } + if(whereProduct.value.loadend || whereProduct.value.loading) return ; + whereProduct.value.loading = true; + userProductStorageApi({ + uid: formData.value.id, + page_no: whereProduct.value.page_no, + page_size: whereProduct.value.page_size + }).then(res=>{ + productList.value = [...productList.value, ...res.data.lists]; + whereProduct.value.loading = false; + whereProduct.value.page_no++; + if(res.data.lists.length < whereProduct.value.page_size) { + whereProduct.value.loadend = true; + } + }) +} + +// 预出库 +const onOutAll = ()=>{ + info = productList.value.filter(item=>item.n_num).map(item=>{ + return { + product_id: item.product_id, + nums: item.n_num + } + }) + if(info.length==0) return ElMessage.error("请选择商品") + onOutPut(); } // 出库 -const onOutAll = ()=>{ - ElMessage.error("未全部出库") +const onOutPut = ()=>{ + userProductStorageSupplyApi({ + uid: formData.value.id, + info: info + }).then(res=>{ + isOut.value = false; + ElMessage.success("出库成功"); + initProduct(true); + }) } onMounted(() => { mitt.on("set-user-detail", (res) => { formData.value = res; + isOut.value = false; userDetailApi({ id: res.id }).then(({ data }) => { @@ -305,7 +286,7 @@ onMounted(() => { console.log(formData.value); }) getAddress(); - initProduct(); + initProduct(true); }); }); @@ -462,37 +443,38 @@ onUnmounted(() => { -
-
+
+
- - + + - - + +
@@ -554,7 +536,7 @@ onUnmounted(() => { .table { padding: 1rem; - padding-bottom: 6rem; + padding-bottom: 7rem; box-sizing: border-box; overflow-y: auto; height: 100%; @@ -654,6 +636,7 @@ onUnmounted(() => { .footer { position: absolute; + z-index: 1000; bottom: 0; left: 0; width: 100%; diff --git a/src/views/user/component/order.vue b/src/views/user/component/order.vue index 8ba11d4..6b613b9 100644 --- a/src/views/user/component/order.vue +++ b/src/views/user/component/order.vue @@ -29,7 +29,7 @@ const where = ref({ page_no: 1, page_size: 20, mobile: "", - user_ship: "" + user_ship: "", }); const loading = ref(false); @@ -42,6 +42,9 @@ const getOrderList = (reload = false) => { if (reload) where.value.page_no = 1; else if (loadEnd.value || loading.value) return; loading.value = true; + if(where.value.mobile == '' && where.value.user_ship == ''){ + where.value.store_id = userStore.userInfo.store_id; + } else where.value.store_id = null; userListsApi(where.value) .then((res) => { if (reload) orderList.value = res.data.lists; @@ -83,6 +86,12 @@ const getUserShip = () => { } getUserShip() +const resetWhere = ()=>{ + where.value.mobile = ""; + where.value.user_ship = ""; + getOrderList(true); +} + onMounted(() => { mitt.on('re-load-user-list', () => { getOrderList(true); @@ -108,7 +117,7 @@ onUnmounted(() => { - 重置 + 重置