更新存取货,分类用户,修复bug
This commit is contained in:
parent
44c7223ca0
commit
7f94d55df0
|
@ -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'
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(() => {
|
|||
</div>
|
||||
<div class="flex-bewteen" style="align-items: flex-end;">
|
||||
<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>
|
||||
<el-button link @click="userInfo.uid = ''">重置<el-icon>
|
||||
|
@ -198,8 +209,8 @@ onUnmounted(() => {
|
|||
¥<span>{{ item.price }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<el-input-number v-model="item.cart_num" :min="+item.batch > 0 ? +item.batch : 1" :step="1" step-strictly
|
||||
@change="changeCartNum(item)" />
|
||||
<el-input-number v-model="item.cart_num" :min="+item.batch > 0 ? +item.batch : 1" :step="1"
|
||||
step-strictly @change="changeCartNum(item)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -207,13 +218,14 @@ onUnmounted(() => {
|
|||
</div>
|
||||
<div class="order-footer">
|
||||
<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;">
|
||||
合计:
|
||||
<span>¥<span style="font-size: 1.4rem">
|
||||
{{ extend.pay_price || '0.00' }}</span></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 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">
|
||||
优惠:
|
||||
<span
|
||||
|
@ -221,14 +233,19 @@ onUnmounted(() => {
|
|||
>
|
||||
</div> -->
|
||||
</div>
|
||||
<!-- <div class="update-price">
|
||||
<el-button class="btn" type="primary" @click="showPrice"
|
||||
>改价 (Insert)</el-button
|
||||
>
|
||||
</div> -->
|
||||
<div class="update-price" v-if="userInfo.uid">
|
||||
<el-switch
|
||||
v-model="is_storage"
|
||||
size="large"
|
||||
inline-prompt
|
||||
active-text="存货"
|
||||
inactive-text="不存"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
<price ref="priceRef" @changeAllPrice="changeAllPrice"></price>
|
||||
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
})
|
||||
};
|
||||
|
||||
|
|
|
@ -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')
|
||||
})
|
||||
|
|
|
@ -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 = ()=>{
|
||||
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 = [
|
||||
{
|
||||
"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"
|
||||
// 预出库
|
||||
const onOutAll = ()=>{
|
||||
info = productList.value.filter(item=>item.n_num).map(item=>{
|
||||
return {
|
||||
product_id: item.product_id,
|
||||
nums: item.n_num
|
||||
}
|
||||
},
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
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(() => {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail" v-if="formData.id && activeStore == 1">
|
||||
<div class="table">
|
||||
<div class="detail" v-if="formData.id && activeStore == 1" v-loading="whereProduct.loading">
|
||||
<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-column label="商品信息">
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; align-items: center">
|
||||
<el-image style="height: 3rem; width: 3rem" :src="row.cart_info?.image"></el-image>
|
||||
<span style="margin-left: 0.5rem">{{ row.cart_info?.name }}</span>
|
||||
<el-image style="height: 3rem; width: 3rem" :src="row.image"></el-image>
|
||||
<span style="margin-left: 0.5rem">{{ row.store_name }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="cart_info.price" label="单价" width="150" />
|
||||
<el-table-column prop="cart_info.cart_num" v-if="isOut" label="数量" width="250">
|
||||
<el-table-column prop="price" label="单价" width="150" />
|
||||
<el-table-column prop="nums" v-if="isOut" label="数量" width="250">
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; align-items: center">
|
||||
<el-input-number v-model="row.cart_info.n_num" step-strictly :min="1" :max="row.cart_info.cart_num" />
|
||||
<el-button type="primary" style="margin-left: 1rem;" @click="row.cart_info.n_num = row.cart_info.cart_num">全部</el-button>
|
||||
<div style="display: flex; align-items: center" v-if="row.nums">
|
||||
<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.n_num = row.nums">全部</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="cart_info.cart_num" v-else label="数量" width="250" />
|
||||
<!-- <el-table-column prop="cart_info.pay_price" label="总价" width="150" /> -->
|
||||
<el-table-column prop="nums" v-else label="数量" width="250" />
|
||||
<!-- <el-table-column prop="pay_price" label="总价" width="150" /> -->
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div v-if="!isOut">
|
||||
<el-button type="warning" size="large" @click="isOut = true">部分出库</el-button>
|
||||
<el-button type="primary" size="large" @click="onOutAll">全部出库</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> -->
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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%;
|
||||
|
|
|
@ -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(() => {
|
|||
<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-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 class="header-input">
|
||||
<el-input v-model="where.mobile" placeholder="搜索手机号/ID" @keydown.enter="getOrderList(true)"
|
||||
|
|
Loading…
Reference in New Issue