diff --git a/.env.development b/.env.development index f5f48a0..fcd874a 100644 --- a/.env.development +++ b/.env.development @@ -5,10 +5,10 @@ VITE_NOW_TYPE = 'dist' # 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_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_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 035a223..9e13501 100644 --- a/src/api/store.js +++ b/src/api/store.js @@ -184,3 +184,10 @@ export function merchantOrderCountApi(data) { export function storeOrderCheckSmsApi(data) { return request.post(`/store_order/StoreOrder/checkSms`, data) } + +/** + * @description 订单打印 + */ +export function storeOrderPrintApi(data) { + return request.get(`/store_order/StoreOrder/print`, { params: data }) +} diff --git a/src/api/user.js b/src/api/user.js index bd8815a..335986a 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -28,7 +28,7 @@ export function logout() { } /** - * @description 会员类型 + * @description 用户类型 */ export function userShipApi(data) { return request.get(`/user/UserShip/lists`, { params: data }) @@ -75,3 +75,10 @@ export function userAddressEditApi(data) { export function userRechangeAmountApi(data) { return request.post(`/store_order/StoreOrder/rechange_amount`, data) } + +/** +* @description 设置会员 +*/ +export function userShipUpdateApi(data) { + return request.post(`/user/user/user_ship`, data) +} diff --git a/src/components/pay.vue b/src/components/pay.vue index d771a5b..da2db40 100644 --- a/src/components/pay.vue +++ b/src/components/pay.vue @@ -4,6 +4,9 @@ import { orderCreateApi, orderStatusApi, orderPayApi, storeOrderCheckSmsApi } fr import { ElMessage } from "element-plus"; import { audioplay } from "@/utils/audio.js"; import mitt from "@/utils/mitt.js"; +import { + storeOrderPrintApi +} from "@/api/store.js"; import { useUserStore } from "@/store/user.js"; const drawer = ref(false); @@ -13,6 +16,15 @@ const codeRef = ref(""); const userStore = useUserStore(); +const onPrint = (id) => { + storeOrderPrintApi({ + id: id, + }).then(res => { + mitt.emit('letPrintReceipt', res.data); + }) +} + + const cancelClick = () => { beforeClose(); }; @@ -51,7 +63,7 @@ const setForm = (e) => { form.value = e.data; cart_id.value = e.cart_id; uid.value = e.uid; - console.log('选择了用户==', uid.value||'游客'); + console.log('选择了用户==', uid.value || '游客'); isRePay.value = e.isRePay || false; }; @@ -117,6 +129,7 @@ const handleEnter = () => { }); // if(res.data.message) audioplay(res.data.message); beforeClose(res.data); + onPrint(res.data.id); } else { if (res.msg == "用户支付中" && res.code == 1) { ElMessage.warning(res.msg); @@ -125,6 +138,7 @@ const handleEnter = () => { message: "支付成功", type: "success", }); + onPrint(res.data.id); setTimeout(() => { mitt.off("pay_success"); }, 200); @@ -167,6 +181,7 @@ const orderPay = () => { message: "支付成功", type: "success", }); + onPrint(res.data.id); // if(res.data.message) audioplay(res.data.message); beforeClose(); } else { @@ -177,6 +192,7 @@ const orderPay = () => { message: "支付成功", type: "success", }); + onPrint(res.data.id); setTimeout(() => { mitt.off("pay_success"); }, 200); @@ -327,6 +343,7 @@ const cashBnt = () => { message: res.msg, type: "success", }); + onPrint(res.data.id); changeActive(1); beforeClose(); }) @@ -401,6 +418,7 @@ const keyboard = (event) => { }; const getSms = () => { + if(!uid.value) return ElMessage.error('请先选择用户'); storeOrderCheckSmsApi({ cart_id: cart_id.value, uid: uid.value @@ -414,6 +432,7 @@ const getSms = () => { const smsCode = ref(''); // 提交验证码/支付 const handlecodeEnter = () => { + if(!uid.value) return ElMessage.error('请先选择用户'); orderCreateApi({ pay_type: 18, //余额/采购款支付 sms_code: smsCode.value, @@ -425,6 +444,7 @@ const handlecodeEnter = () => { message: res.msg, type: "success", }); + onPrint(res.data.id); changeActive(1); beforeClose(); }) @@ -522,7 +542,7 @@ onUnmounted(() => {
{{ item - }} + }}
diff --git a/src/components/userList.vue b/src/components/userList.vue index 66605fd..db009ee 100644 --- a/src/components/userList.vue +++ b/src/components/userList.vue @@ -84,7 +84,7 @@ defineExpose({
{{ item.nickname }}{{ ' (ID:' + item.id + ')' }}
-
手机号: {{ item.account }}
+
手机号: {{ item.mobile || item.account }}
@@ -144,7 +144,7 @@ defineExpose({ .item { width: 45%; - height: auto; + height: 6rem; border-radius: 0.5rem; cursor: pointer; box-sizing: border-box; diff --git a/src/views/convert/component/detail.vue b/src/views/convert/component/detail.vue index 05d2452..69d1fa6 100644 --- a/src/views/convert/component/detail.vue +++ b/src/views/convert/component/detail.vue @@ -7,7 +7,8 @@ import { cartListApi, cashierinfoListApi, cashierinfoDetailsApi, - writeoffOrderApi + writeoffOrderApi, + storeOrderPrintApi } from "@/api/store.js"; import { useUserStore } from "@/store/user.js"; import { ElMessage } from "element-plus"; @@ -125,9 +126,17 @@ const convert = ()=>{ writeoffOrderApi({ verify_code: formData.value.verify_code }).then(res=>{ - console.log("===", res); if(res.show==0&&res.msg=='核销成功') ElMessage.success(res.msg); formData.value.is_writeoff = 1; + onPrint(); + }) +} + +const onPrint = ()=>{ + storeOrderPrintApi({ + id: formData.value.id, + }).then(res=>{ + mitt.emit('letPrintReceipt', res.data); }) } @@ -217,7 +226,8 @@ onUnmounted(() => {
diff --git a/src/views/saleHome/component/order.vue b/src/views/saleHome/component/order.vue index 5b1d41b..1d0399e 100644 --- a/src/views/saleHome/component/order.vue +++ b/src/views/saleHome/component/order.vue @@ -135,7 +135,7 @@ onUnmounted(() => {
-
手机号: {{ userInfo.account }}
+
手机号: {{ userInfo.mobile || userInfo.account }}
切换用户
diff --git a/src/views/user/component/add.vue b/src/views/user/component/add.vue index 5cb0947..e4fb757 100644 --- a/src/views/user/component/add.vue +++ b/src/views/user/component/add.vue @@ -18,7 +18,7 @@ const formDataRules = reactive({ { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号', trigger: 'blur' } ], user_ship: [ - { required: true, message: '请选择会员类型', trigger: 'change' } + { required: true, message: '请选择用户类型', trigger: 'change' } ], selectedValues: [ { required: true, message: '请选择用户地址', trigger: 'change' } @@ -145,11 +145,11 @@ defineExpose({