更新存取货,分类用户,修复bug

This commit is contained in:
weipengfei 2024-06-28 18:13:10 +08:00
parent 44c7223ca0
commit 7f94d55df0
8 changed files with 152 additions and 118 deletions

View File

@ -4,11 +4,11 @@ VITE_NOW_TYPE = 'dist'
# VITE_PUSH_URL = 'ws://192.168.1.201:8787' # VITE_PUSH_URL = 'ws://192.168.1.201:8787'
# VITE_BASE_URL = 'http://192.168.1.201:8545' # VITE_BASE_URL = 'http://192.168.1.201:8545'
# VITE_PUSH_URL = 'ws://192.168.1.22:8787' VITE_PUSH_URL = 'ws://192.168.1.22:8787'
# VITE_BASE_URL = 'http://192.168.1.22:8545' VITE_BASE_URL = 'http://192.168.1.22:8545'
VITE_PUSH_URL ='wss://test-multi-store.lihaink.cn/pull' # VITE_PUSH_URL ='wss://test-multi-store.lihaink.cn/pull'
VITE_BASE_URL = 'https://test-multi-store.lihaink.cn' # VITE_BASE_URL = 'https://test-multi-store.lihaink.cn'
# VITE_PUSH_URL ='wss://multi-store.lihaink.cn/pull' # VITE_PUSH_URL ='wss://multi-store.lihaink.cn/pull'
# VITE_BASE_URL = 'https://multi-store.lihaink.cn' # VITE_BASE_URL = 'https://multi-store.lihaink.cn'

View File

@ -191,3 +191,18 @@ export function storeOrderCheckSmsApi(data) {
export function storeOrderPrintApi(data) { export function storeOrderPrintApi(data) {
return request.get(`/store_order/StoreOrder/print`, { params: 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)
}

View File

@ -61,10 +61,12 @@ const form = ref({});
const cart_id = ref([]); const cart_id = ref([]);
const uid = ref(''); const uid = ref('');
const isRePay = ref(false); const isRePay = ref(false);
let is_storage = 0;
const setForm = (e) => { const setForm = (e) => {
form.value = e.data; form.value = e.data;
cart_id.value = e.cart_id; cart_id.value = e.cart_id;
uid.value = e.uid; uid.value = e.uid;
is_storage = e.is_storage || 0;
console.log('选择了用户==', uid.value || '游客'); console.log('选择了用户==', uid.value || '游客');
isRePay.value = e.isRePay || false; isRePay.value = e.isRePay || false;
}; };
@ -72,6 +74,7 @@ const setForm = (e) => {
const setRePay = (e) => { const setRePay = (e) => {
form.value.pay_price = e.price; form.value.pay_price = e.price;
order_id.value = e.order_id; order_id.value = e.order_id;
is_storage = e.is_storage || 0;
}; };
const emit = defineEmits(["paySuccess"]); const emit = defineEmits(["paySuccess"]);
@ -120,6 +123,7 @@ const handleEnter = () => {
key: form.value.key, key: form.value.key,
cart_id: cart_id.value, cart_id: cart_id.value,
pay_type: pay_type, pay_type: pay_type,
is_storage: is_storage,
auth_code: input.value, auth_code: input.value,
uid: uid.value uid: uid.value
}) })
@ -176,6 +180,7 @@ const orderPay = () => {
orderPayApi({ orderPayApi({
order_id: form.value.order_id, order_id: form.value.order_id,
pay_type: pay_type, pay_type: pay_type,
is_storage: is_storage,
auth_code: input.value, auth_code: input.value,
uid: uid.value uid: uid.value
}).then((res) => { }).then((res) => {
@ -345,6 +350,7 @@ const cashBnt = () => {
orderCreateApi({ orderCreateApi({
cart_id: cart_id.value, cart_id: cart_id.value,
pay_type: "17", // 17 pay_type: "17", // 17
is_storage: is_storage,
uid: uid.value uid: uid.value
}) })
.then((res) => { .then((res) => {
@ -452,6 +458,7 @@ const handlecodeEnter = () => {
if (active.value == 4) pay_type = 19; // if (active.value == 4) pay_type = 19; //
orderCreateApi({ orderCreateApi({
pay_type: pay_type, pay_type: pay_type,
is_storage: is_storage,
sms_code: smsCode.value, sms_code: smsCode.value,
cart_id: cart_id.value, cart_id: cart_id.value,
uid: uid.value uid: uid.value

View File

@ -111,12 +111,22 @@ const setUser = (row) => {
userInfo.value.uid = row.id; userInfo.value.uid = row.id;
} }
const is_storage = ref(false)
const resetView = ()=>{
is_storage.value = false;
userInfo.value.uid = "";
getList();
}
defineExpose({ defineExpose({
getList, getList,
resetView,
list, list,
discounts, discounts,
allPrice, allPrice,
userInfo userInfo,
is_storage
}); });
// //
@ -152,7 +162,8 @@ onUnmounted(() => {
</div> </div>
<div class="flex-bewteen" style="align-items: flex-end;"> <div class="flex-bewteen" style="align-items: flex-end;">
<div style="display:flex;"> <div style="display:flex;">
<div style="margin-right: 0.5rem;">采购款: <span style="color: #f70;">{{ userInfo.purchase_funds }}</span></div> <div style="margin-right: 0.5rem;">采购款: <span style="color: #f70;">{{
userInfo.purchase_funds }}</span></div>
<div>礼品券: <span style="color: #f70;">{{ userInfo.get_frozen }}</span></div> <div>礼品券: <span style="color: #f70;">{{ userInfo.get_frozen }}</span></div>
</div> </div>
<el-button link @click="userInfo.uid = ''">重置<el-icon> <el-button link @click="userInfo.uid = ''">重置<el-icon>
@ -198,8 +209,8 @@ onUnmounted(() => {
¥<span>{{ item.price }}</span> ¥<span>{{ item.price }}</span>
</div> </div>
<div> <div>
<el-input-number v-model="item.cart_num" :min="+item.batch > 0 ? +item.batch : 1" :step="1" step-strictly <el-input-number v-model="item.cart_num" :min="+item.batch > 0 ? +item.batch : 1" :step="1"
@change="changeCartNum(item)" /> step-strictly @change="changeCartNum(item)" />
</div> </div>
</div> </div>
</div> </div>
@ -207,13 +218,14 @@ onUnmounted(() => {
</div> </div>
<div class="order-footer"> <div class="order-footer">
<div class="order-total"> <div class="order-total">
<div class="price"> <div class="price" style="flex-direction: column; align-items: flex-start;">
<div class="total-item" style="flex-shrink: 0;"> <div class="total-item" style="flex-shrink: 0;">
合计: 合计:
<span>¥<span style="font-size: 1.4rem"> <span>¥<span style="font-size: 1.4rem">
{{ extend.pay_price || '0.00' }}</span></span> {{ extend.pay_price || '0.00' }}</span></span>
</div> </div>
<div v-if="extend.msg" class="total-item" style="padding-right: 0;line-height: 0.8rem;"><span style="font-size: 0.8rem">{{ extend.msg }}</span></div> <div v-if="extend.msg" class="total-item" style="padding-right: 0;line-height: 0.8rem;"><span
style="font-size: 0.8rem">{{ extend.msg }}</span></div>
<!-- <div class="total-item"> <!-- <div class="total-item">
优惠: 优惠:
<span <span
@ -221,14 +233,19 @@ onUnmounted(() => {
> >
</div> --> </div> -->
</div> </div>
<!-- <div class="update-price"> <div class="update-price" v-if="userInfo.uid">
<el-button class="btn" type="primary" @click="showPrice" <el-switch
>改价 (Insert)</el-button v-model="is_storage"
> size="large"
</div> --> inline-prompt
active-text="存货"
inactive-text="不存"
/>
</div>
</div> </div>
<div class="order-btn"> <div class="order-btn">
<el-button class="btn" type="primary" @click="goPay" :disabled="list.length == 0">{{ "立即结账 (F9)" }}</el-button> <el-button class="btn" type="primary" @click="goPay" :disabled="list.length == 0">{{ "立即结账 (F9)"
}}</el-button>
</div> </div>
</div> </div>
<price ref="priceRef" @changeAllPrice="changeAllPrice"></price> <price ref="priceRef" @changeAllPrice="changeAllPrice"></price>
@ -361,7 +378,7 @@ onUnmounted(() => {
background-color: #fff; background-color: #fff;
.order-total { .order-total {
height: 2.5rem; height: 3.5rem;
padding: 1rem 2rem; padding: 1rem 2rem;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;

View File

@ -108,7 +108,7 @@ const checkOut = () => {
let cart_id = orderRef.value.list.map((item) => item.id); let cart_id = orderRef.value.list.map((item) => item.id);
let query = { let query = {
cart_id: cart_id, cart_id: cart_id,
uid: orderRef.value?.userInfo?.uid || "" uid: orderRef.value?.userInfo?.uid || "",
}; };
if (orderRef.value.discounts > 0) { if (orderRef.value.discounts > 0) {
query.deduction_price = orderRef.value.discounts.toFixed(2); query.deduction_price = orderRef.value.discounts.toFixed(2);
@ -119,7 +119,8 @@ const checkOut = () => {
payRef.value.setForm({ payRef.value.setForm({
data: res.data.order, data: res.data.order,
cart_id: cart_id, 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); // if(data) onPrint(data);
setTimeout(() => { setTimeout(() => {
orderRef.value.getList(); orderRef.value.resetView();
}) })
}; };

View File

@ -3,8 +3,9 @@ import { ref, onMounted, onUnmounted, reactive } from "vue";
import { apiProvince, apiCity, apiArea, apiStreet, apiVillage, apiBrigade } from '@/api/public' import { apiProvince, apiCity, apiArea, apiStreet, apiVillage, apiBrigade } from '@/api/public'
import { userShipApi, userAddApi, userArchivesSmsApi } from "@/api/user" import { userShipApi, userAddApi, userArchivesSmsApi } from "@/api/user"
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { useUserStore } from "@/store/user";
const userStore = useUserStore();
const formDataRef = ref(null); const formDataRef = ref(null);
const formDataInfo = reactive({ const formDataInfo = reactive({
mobile: '', mobile: '',
@ -138,6 +139,7 @@ const addUser = () => {
forms.street = formDataInfo.selectedValues[2] forms.street = formDataInfo.selectedValues[2]
forms.village = formDataInfo.selectedValues[3] forms.village = formDataInfo.selectedValues[3]
forms.brigade = formDataInfo.selectedValues[4] forms.brigade = formDataInfo.selectedValues[4]
forms.store_id = userStore.userInfo.store_id;
userAddApi(forms).then(res=>{ userAddApi(forms).then(res=>{
emit('close') emit('close')
}) })

View File

@ -6,6 +6,7 @@ import { useRouter } from "vue-router";
import mitt from "@/utils/mitt.js"; import mitt from "@/utils/mitt.js";
import payUser from "@/components/payUser.vue"; import payUser from "@/components/payUser.vue";
import { userAddressDetailApi, userAddressEditApi, userDetailApi } from "@/api/user" import { userAddressDetailApi, userAddressEditApi, userDetailApi } from "@/api/user"
import { userProductStorageApi, userProductStorageSupplyApi } from "@/api/store"
import { apiProvince, apiCity, apiArea, apiStreet, apiVillage, apiBrigade } from '@/api/public' import { apiProvince, apiCity, apiArea, apiStreet, apiVillage, apiBrigade } from '@/api/public'
import { userShipApi, userShipUpdateApi, userLabelListApi, userLabelUpdateApi } from "@/api/user" import { userShipApi, userShipUpdateApi, userLabelListApi, userLabelUpdateApi } from "@/api/user"
@ -221,83 +222,63 @@ const activeStoreList = ref(["基本信息", "用户资产"]);
const isOut = ref(false); // const isOut = ref(false); //
const productList = ref([]); // const productList = ref([]); //
const initProduct = ()=>{ 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;
}
})
}
productList.value = [ //
{ const onOutAll = ()=>{
"id": 574, info = productList.value.filter(item=>item.n_num).map(item=>{
"oid": 568, return {
"product_id": 44, product_id: item.product_id,
"cart_info": { nums: item.n_num
"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"
} }
}, })
{ if(info.length==0) return ElMessage.error("请选择商品")
"id": 575, onOutPut();
"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 onOutAll = ()=>{ const onOutPut = ()=>{
ElMessage.error("未全部出库") userProductStorageSupplyApi({
uid: formData.value.id,
info: info
}).then(res=>{
isOut.value = false;
ElMessage.success("出库成功");
initProduct(true);
})
} }
onMounted(() => { onMounted(() => {
mitt.on("set-user-detail", (res) => { mitt.on("set-user-detail", (res) => {
formData.value = res; formData.value = res;
isOut.value = false;
userDetailApi({ userDetailApi({
id: res.id id: res.id
}).then(({ data }) => { }).then(({ data }) => {
@ -305,7 +286,7 @@ onMounted(() => {
console.log(formData.value); console.log(formData.value);
}) })
getAddress(); getAddress();
initProduct(); initProduct(true);
}); });
}); });
@ -462,37 +443,38 @@ onUnmounted(() => {
</div> </div>
</div> </div>
</div> </div>
<div class="detail" v-if="formData.id && activeStore == 1"> <div class="detail" v-if="formData.id && activeStore == 1" v-loading="whereProduct.loading">
<div class="table"> <div class="table" v-infinite-scroll="initProduct" :infinite-scroll-distance="300"
:infinite-scroll-delay="300" style="overflow: auto" :infinite-scroll-immediate="false">
<el-table :data="productList"> <el-table :data="productList">
<el-table-column label="商品信息"> <el-table-column label="商品信息">
<template #default="{ row }"> <template #default="{ row }">
<div style="display: flex; align-items: center"> <div style="display: flex; align-items: center">
<el-image style="height: 3rem; width: 3rem" :src="row.cart_info?.image"></el-image> <el-image style="height: 3rem; width: 3rem" :src="row.image"></el-image>
<span style="margin-left: 0.5rem">{{ row.cart_info?.name }}</span> <span style="margin-left: 0.5rem">{{ row.store_name }}</span>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="cart_info.price" label="单价" width="150" /> <el-table-column prop="price" label="单价" width="150" />
<el-table-column prop="cart_info.cart_num" v-if="isOut" label="数量" width="250"> <el-table-column prop="nums" v-if="isOut" label="数量" width="250">
<template #default="{ row }"> <template #default="{ row }">
<div style="display: flex; align-items: center"> <div style="display: flex; align-items: center" v-if="row.nums">
<el-input-number v-model="row.cart_info.n_num" step-strictly :min="1" :max="row.cart_info.cart_num" /> <el-input-number v-model="row.n_num" step-strictly :min="0" :max="row.nums" />
<el-button type="primary" style="margin-left: 1rem;" @click="row.cart_info.n_num = row.cart_info.cart_num">全部</el-button> <el-button type="primary" style="margin-left: 1rem;" @click="row.n_num = row.nums">全部</el-button>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="cart_info.cart_num" v-else label="数量" width="250" /> <el-table-column prop="nums" v-else label="数量" width="250" />
<!-- <el-table-column prop="cart_info.pay_price" label="总价" width="150" /> --> <!-- <el-table-column prop="pay_price" label="总价" width="150" /> -->
</el-table> </el-table>
</div> </div>
<div class="footer"> <div class="footer">
<div v-if="!isOut"> <div v-if="!isOut">
<el-button type="warning" size="large" @click="isOut = true">部分出库</el-button> <el-button type="warning" size="large" @click="isOut = true" :disabled="productList.length == 0">商品出库</el-button>
<el-button type="primary" size="large" @click="onOutAll">全部出库</el-button> <!-- <el-button type="primary" size="large" @click="onOutAll">全部出库</el-button> -->
</div> </div>
<div v-else> <div v-else>
<el-button type="primary" size="large" @click="isOut = false">确认出库</el-button> <el-button type="primary" size="large" @click="onOutAll">确认出库</el-button>
<el-button size="large" @click="isOut = false">取消</el-button> <el-button size="large" @click="isOut = false">取消</el-button>
</div> </div>
</div> </div>
@ -554,7 +536,7 @@ onUnmounted(() => {
.table { .table {
padding: 1rem; padding: 1rem;
padding-bottom: 6rem; padding-bottom: 7rem;
box-sizing: border-box; box-sizing: border-box;
overflow-y: auto; overflow-y: auto;
height: 100%; height: 100%;
@ -654,6 +636,7 @@ onUnmounted(() => {
.footer { .footer {
position: absolute; position: absolute;
z-index: 1000;
bottom: 0; bottom: 0;
left: 0; left: 0;
width: 100%; width: 100%;

View File

@ -29,7 +29,7 @@ const where = ref({
page_no: 1, page_no: 1,
page_size: 20, page_size: 20,
mobile: "", mobile: "",
user_ship: "" user_ship: "",
}); });
const loading = ref(false); const loading = ref(false);
@ -42,6 +42,9 @@ const getOrderList = (reload = false) => {
if (reload) where.value.page_no = 1; if (reload) where.value.page_no = 1;
else if (loadEnd.value || loading.value) return; else if (loadEnd.value || loading.value) return;
loading.value = true; 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) userListsApi(where.value)
.then((res) => { .then((res) => {
if (reload) orderList.value = res.data.lists; if (reload) orderList.value = res.data.lists;
@ -83,6 +86,12 @@ const getUserShip = () => {
} }
getUserShip() getUserShip()
const resetWhere = ()=>{
where.value.mobile = "";
where.value.user_ship = "";
getOrderList(true);
}
onMounted(() => { onMounted(() => {
mitt.on('re-load-user-list', () => { mitt.on('re-load-user-list', () => {
getOrderList(true); getOrderList(true);
@ -108,7 +117,7 @@ onUnmounted(() => {
<el-select v-model="where.user_ship" @change="getOrderList(true)" placeholder="请选择用户类型" style="flex: 1"> <el-select v-model="where.user_ship" @change="getOrderList(true)" placeholder="请选择用户类型" style="flex: 1">
<el-option v-for="item in userShip" :key="item.id" :label="item.title" :value="item.id" /> <el-option v-for="item in userShip" :key="item.id" :label="item.title" :value="item.id" />
</el-select> </el-select>
<el-button @click="where.user_ship='';getOrderList(true)" style="margin-left: 1rem;">重置</el-button> <el-button @click="resetWhere" style="margin-left: 1rem;">重置</el-button>
</div> </div>
<div class="header-input"> <div class="header-input">
<el-input v-model="where.mobile" placeholder="搜索手机号/ID" @keydown.enter="getOrderList(true)" <el-input v-model="where.mobile" placeholder="搜索手机号/ID" @keydown.enter="getOrderList(true)"