diff --git a/src/api/store.js b/src/api/store.js
index c24cb15..1dcd657 100644
--- a/src/api/store.js
+++ b/src/api/store.js
@@ -21,6 +21,12 @@ export function cartChangeApi(id, data) {
return request.post(`user/cart/change/${id}`, data)
}
+/**
+ * @description 下单前校验数量库存
+ */
+export function storeOrdeCheckInventoryrApi(data) {
+ return request.post(`/store_order/storeOrder/checkInventory`, data)
+}
/**
* @description 结算
diff --git a/src/components/pay.vue b/src/components/pay.vue
index cfd3a5b..d9b5768 100644
--- a/src/components/pay.vue
+++ b/src/components/pay.vue
@@ -61,12 +61,14 @@ const changeActive = (e) => {
const form = ref({});
const cart_id = ref([]);
const uid = ref('');
+const reservation = ref(null);
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;
+ reservation.value = e.reservation || null;
is_storage = e.is_storage || 0;
console.log('选择了用户==', uid.value || '游客');
isRePay.value = e.isRePay || false;
@@ -125,6 +127,7 @@ const handleEnter = () => {
pay_type: pay_type,
is_storage: is_storage,
auth_code: input.value,
+ reservation: reservation.value,
uid: uid.value
})
.then((res) => {
@@ -182,6 +185,7 @@ const orderPay = () => {
pay_type: pay_type,
is_storage: is_storage,
auth_code: input.value,
+ reservation: reservation.value,
uid: uid.value
}).then((res) => {
if (res.msg?.includes('成功')) {
@@ -351,6 +355,7 @@ const cashBnt = () => {
cart_id: cart_id.value,
pay_type: "17", //现金支付 17
is_storage: is_storage,
+ reservation: reservation.value,
uid: uid.value
})
.then((res) => {
@@ -438,8 +443,10 @@ const getSms = () => {
if (!uid.value) return ElMessage.error('请先选择用户');
let type = 1; // 采购款支付
if (active.value == 4) type = 2; //礼品券兑换
+ if (active.value == 5) type = 3; //余额支付
storeOrderCheckSmsApi({
cart_id: cart_id.value,
+ reservation: reservation.value,
uid: uid.value,
type: type
}).then(res => {
@@ -462,6 +469,7 @@ const handlecodeEnter = () => {
is_storage: is_storage,
sms_code: smsCode.value,
cart_id: cart_id.value,
+ reservation: reservation.value,
uid: uid.value
}).then(res => {
drawer.value = false;
diff --git a/src/components/userList.vue b/src/components/userList.vue
index d5b083d..fabbfe6 100644
--- a/src/components/userList.vue
+++ b/src/components/userList.vue
@@ -94,7 +94,7 @@ defineExpose({
采购款: {{ item.purchase_funds }}
-
礼品券: {{ item.get_frozen?.toFixed(2) || item.get_frozen }}
+
礼品券: {{ item.get_frozen }}
余额: {{ item.now_money }}
diff --git a/src/utils/EscPos.js b/src/utils/EscPos.js
index b9282f8..b5b51a3 100644
--- a/src/utils/EscPos.js
+++ b/src/utils/EscPos.js
@@ -116,7 +116,9 @@ export const printTicket = (obj = {}, test = false) => {
if (!obj || !obj.order_id) obj = testObj;
str += Esc.Size2(2) + Esc.Center() + Esc.boldFontOn() + obj.system_store_name + Esc.Size1() + "\n";
str += Esc.fillLine(" ") + Esc.boldFontOff() + "\n";
- if (obj.shipping_type) str += Esc.Left() + "核销码: " + Esc.boldFontOn() + obj.verify_code + Esc.boldFontOff() + "\n";
+ if (obj.shipping_type) {
+ str += Esc.Left() + "核销码: " + Esc.boldFontOn() + obj.verify_code + Esc.boldFontOff() + (obj.reservation ? " (次日提)" : " ") + "\n";
+ }
str += Esc.Left() + "单号: " + obj.order_id + "\n";
str += Esc.Left() + "下单时间: " + obj.create_time + "\n";
@@ -128,7 +130,8 @@ export const printTicket = (obj = {}, test = false) => {
str += Esc.Left() + item.store_name + "\n";
let total = +item.price || 0;
total *= +item.cart_num;
- str += Esc.inline3(`${item.price || '0.00'}元`, `${item.cart_num}${item.unit_name || ''}`, `${total}元`, " ", 1) + "\n";
+ total = total.toFixed(2);
+ str += Esc.inline3(`${item.price || '0.00'}元`, `${item.cart_num}${item.unit_name || ''}`, `${item.cart_info?.pay_price || total}元`, " ", 1) + "\n";
})
str += Esc.fillLine("=") + "\n";
diff --git a/src/views/saleHome/component/order.vue b/src/views/saleHome/component/order.vue
index 164ee11..05f8b32 100644
--- a/src/views/saleHome/component/order.vue
+++ b/src/views/saleHome/component/order.vue
@@ -46,7 +46,7 @@ const getList = () => {
cartListApi().then((res) => {
extend.value = res.data.extend;
list.value = res.data.lists || [];
- if (!extend.value?.pay_price) userInfo.value.uid = "";
+ // if (!extend.value?.pay_price) userInfo.value.uid = "";
// if (res.data?.lists?.length > 0) {
// list.value = res.data.lists;
// allPrice.value = res.data?.lists.reduce((previous, current) => {
@@ -165,7 +165,7 @@ onUnmounted(() => {
采购款: {{
userInfo.purchase_funds }}
-
礼品券:
{{ userInfo.get_frozen?.toFixed(2) || userInfo.get_frozen
+ 礼品券: {{ userInfo.get_frozen
}}
余额: {{ userInfo.now_money }}
diff --git a/src/views/saleHome/component/shop.vue b/src/views/saleHome/component/shop.vue
index 0835b7f..d96af2e 100644
--- a/src/views/saleHome/component/shop.vue
+++ b/src/views/saleHome/component/shop.vue
@@ -32,8 +32,8 @@ const loadMore = () => {
};
const changeItem = (item) => {
- if (item.is_used == 0) return ElMessage.error("该商品已被平台关闭");
- if (item.stock == 0) return ElMessage.warning("该商品无库存");
+ // if (item.is_used == 0) return ElMessage.error("该商品已被平台关闭");
+ // if (item.stock == 0) return ElMessage.warning("该商品无库存");
emit("changeItem", item);
};
@@ -113,18 +113,23 @@ onUnmounted(() => {
¥
{{ item[priceKey.op_price] }}
/{{ item.unit_name }}
-
@@ -283,6 +288,29 @@ onUnmounted(() => {
justify-content: center;
}
}
+ .no-stock-re{
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ background-color: rgba($color: #000000, $alpha: 0.1);
+ display: flex;
+ justify-content: center;
+ align-items: center;
+
+ div {
+ background-color: rgba($color: #E6A23C, $alpha: 0.8);
+ color: #fff;
+ border-radius: 50%;
+ width: 5rem;
+ height: 5rem;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ }
+ }
}
}
diff --git a/src/views/saleHome/index.vue b/src/views/saleHome/index.vue
index 91c4a38..f721832 100644
--- a/src/views/saleHome/index.vue
+++ b/src/views/saleHome/index.vue
@@ -6,7 +6,7 @@ import pupop from "./component/pupop.vue";
import classify from "./component/classify.vue";
import pay from "@/components/pay.vue";
import { ref, reactive, nextTick, onMounted, onUnmounted } from "vue";
-import { cartCreateApi, orderCheckApi } from "@/api/store.js";
+import { cartCreateApi, orderCheckApi, storeOrdeCheckInventoryrApi } from "@/api/store.js";
import { saleStoreListApi } from "@/api/shop.js";
import { useUserStore } from "@/store/user.js";
import { useRoute } from "vue-router";
@@ -14,6 +14,7 @@ import mitt from "@/utils/mitt.js";
import moment from "moment";
import { printTicket } from "@/utils/EscPos.js";
import { ElMessage } from "element-plus";
+import feedback from "@/utils/feedback";
const pupopRef = ref(null);
const orderRef = ref(null);
@@ -104,12 +105,16 @@ const editPupop = (item) => {
const orderForm = ref({});
// 结算
-const checkOut = () => {
+const checkOut = async () => {
let cart_id = orderRef.value.list.map((item) => item.id);
let query = {
cart_id: cart_id,
uid: orderRef.value?.userInfo?.uid || "",
};
+ let {data} = await storeOrdeCheckInventoryrApi(query);
+ if(data.reservation>0){
+ await feedback.confirm('部分商品暂无现货, 需要次日提货, 是否确认购买?')
+ }
if (orderRef.value.discounts > 0) {
query.deduction_price = orderRef.value.discounts.toFixed(2);
query.pay_type = "micropay";
@@ -118,17 +123,18 @@ const checkOut = () => {
orderForm.value = res.data.order;
payRef.value.setForm({
data: res.data.order,
+ reservation: data.reservation,
cart_id: cart_id,
uid: orderRef.value?.userInfo?.uid || "",
is_storage: orderRef.value?.is_storage ? 1 : 0,
});
});
+ payRef.value.drawer = true;
};
const goPay = () => {
if(orderRef.value?.is_storage && !orderRef.value?.userInfo?.uid) return ElMessage.error("选择用户才可以存货");
checkOut();
- payRef.value.drawer = true;
};
const paySuccess = (data = null) => {
diff --git a/src/views/stock/index.vue b/src/views/stock/index.vue
index e2517a3..d034fe3 100644
--- a/src/views/stock/index.vue
+++ b/src/views/stock/index.vue
@@ -9,7 +9,9 @@ const where = ref({
page_no: 1,
page_size: 20,
loadend: false,
- type: 1
+ store_name: '',
+ status: null,
+ stock: null
});
const loading = ref(false);
@@ -20,7 +22,9 @@ const getOrderList = () => {
storeProductListsApi({
page_no: where.value.page_no,
page_size: where.value.page_size,
- type: where.value.type
+ store_name: where.value.store_name,
+ stock: where.value.stock,
+ status: where.value.status,
}).then((res) => {
orderList.value = [...orderList.value, ...res.data.lists];
if (res.data.lists.length < where.value.page_size) where.value.loadend = true;
@@ -38,35 +42,65 @@ const reload = ()=>{
getOrderList();
};
-
+const statusLable = ref(0);
+const changeProducStatus = (e)=>{
+ if(e==0) {
+ where.value.status = null;
+ where.value.stock = null;
+ }else if(e==1){
+ where.value.status = 1;
+ where.value.stock = null;
+ }else if(e==2){
+ where.value.status = 0;
+ where.value.stock = null;
+ }else if(e==3){
+ where.value.status = null;
+ where.value.stock = 10;
+ }else if(e==4){
+ where.value.status = null;
+ where.value.stock = 0;
+ }
+ reload();
+}
-
- 售卖库存
- 兑换库存
-
+
-
-
-
+
+
-
-
+
+
+
+
- 已入库
- 待确认
- 库存不足
+ 上架
+ 下架
+ 库存预警
+ 已售罄
-
@@ -92,6 +126,22 @@ const reload = ()=>{
flex: 1;
width: 100%;
}
+
+ .storage-header{
+ display: flex;
+ width: 100%;
+ justify-content: space-between;
+ align-items: center;
+ .flex{
+ height: 100%;
+ display: flex;
+ align-items: flex-start
+ }
+ }
+
+ .el-tag{
+ margin-right: 1rem;
+ }
}
.my-card {}
diff --git a/src/views/user/component/add.vue b/src/views/user/component/add.vue
index 78d2236..dafaf99 100644
--- a/src/views/user/component/add.vue
+++ b/src/views/user/component/add.vue
@@ -119,7 +119,9 @@ const props = {
const userShip = ref([])
const getUserShip = () => {
- userShipApi().then(res => {
+ userShipApi({
+ type_id: 4
+ }).then(res => {
userShip.value = res.data.lists?.filter((item) => {
return item.id == 0 || item.id == 4
});
diff --git a/src/views/user/component/detail.vue b/src/views/user/component/detail.vue
index 5472fb1..0a92f6e 100644
--- a/src/views/user/component/detail.vue
+++ b/src/views/user/component/detail.vue
@@ -48,7 +48,9 @@ const paySuccess = (e = null) => {
const updateShip = ref(false);
const userShip = ref([]);
const getUserShip = () => {
- userShipApi().then(res => {
+ userShipApi({
+ type_id: 4
+ }).then(res => {
userShip.value = res.data.lists;
})
}
@@ -422,7 +424,7 @@ onUnmounted(() => {
礼品券:
-
¥{{ formData.get_frozen?.toFixed(2) }}
+
¥{{ formData.get_frozen }}
冻结礼品券:
diff --git a/src/views/user/component/order.vue b/src/views/user/component/order.vue
index 1f6d6ba..5c0a327 100644
--- a/src/views/user/component/order.vue
+++ b/src/views/user/component/order.vue
@@ -82,7 +82,9 @@ const addSuccess = () => {
const userShip = ref([])
const getUserShip = () => {
- userShipApi().then(res => {
+ userShipApi({
+ type_id: 4
+ }).then(res => {
userShip.value = res.data.lists;
})
}
@@ -250,7 +252,7 @@ onUnmounted(() => {
余额: {{ item.now_money }}
采购款: {{ item.purchase_funds }}
返还金: {{ item.return_money?.toFixed(2) }}
-
礼品券: {{ item.get_frozen?.toFixed(2) }}
+
礼品券: {{ item.get_frozen }}
{{ item.user_ship_name }}
{{ item.user_ship_name }}