This commit is contained in:
weipengfei 2024-06-17 18:08:29 +08:00
parent 0788b36218
commit 9329366191
10 changed files with 102 additions and 28 deletions

View File

@ -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'

View File

@ -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 })
}

View File

@ -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)
}

View File

@ -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(() => {
<div class="left">
<el-button v-for="item in numList" :key="item" @click="numTap(item)">{{
item
}}
}}
</el-button>
</div>
<div class="right">

View File

@ -84,7 +84,7 @@ defineExpose({
<div class="r-1"><span class="bold">{{ item.nickname }}</span><span>{{ ' (ID:' + item.id
+ ')' }}</span>
</div>
<div>手机号: {{ item.account }}</div>
<div>手机号: {{ item.mobile || item.account }}</div>
</div>
<div class="bottom flex" style="justify-content: space-between;">
<!-- <div class="r-1">积分: <span class="red">55</span></div> -->
@ -144,7 +144,7 @@ defineExpose({
.item {
width: 45%;
height: auto;
height: 6rem;
border-radius: 0.5rem;
cursor: pointer;
box-sizing: border-box;

View File

@ -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(() => {
</div>
<div class="footer">
<el-button v-if="formData.is_writeoff==0" type="primary" size="large" :disabled="formData.is_writeoff" @click="convert">立即核销</el-button>
<div v-else>该订单已核销</div>
<div v-if="formData.is_writeoff==1">该订单已核销</div>
<el-button style="margin-left: 1rem" v-if="formData.is_writeoff==1" type="warning" size="large" @click="onPrint">打印小票</el-button>
</div>
</div>
<div v-else>

View File

@ -135,7 +135,7 @@ onUnmounted(() => {
<el-avatar class="avatar" :src="userInfo.avatar" />
<div class="info" v-if="userInfo.uid">
<div class="flex-bewteen">
<div>手机号: {{ userInfo.account }}</div>
<div>手机号: {{ userInfo.mobile || userInfo.account }}</div>
<el-button type="primary" link class="change-user" @click="userListRef.open()">切换用户<el-icon><ArrowRight /></el-icon></el-button>
</div>
<div class="flex-bewteen" style="align-items: flex-end;">

View File

@ -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({
<template>
<div class="add-user">
<el-form :model="formDataInfo" :rules="formDataRules" ref="formDataRef" label-width="80px">
<el-form-item label="会员电话" prop="mobile">
<el-input v-model="formDataInfo.mobile" placeholder="请输入会员电话" />
<el-form-item label="用户电话" prop="mobile">
<el-input v-model="formDataInfo.mobile" placeholder="请输入用户电话" />
</el-form-item>
<el-form-item label="会员类型" prop="user_ship">
<el-select v-model="formDataInfo.user_ship" placeholder="请选择会员类型" style="width: 100%;">
<el-form-item label="用户类型" prop="user_ship">
<el-select v-model="formDataInfo.user_ship" placeholder="请选择用户类型" style="width: 100%;">
<el-option v-for="item in userShip" :key="item.id" :label="item.title" :value="item.id" :disabled="item.id==1" />
</el-select>
</el-form-item>

View File

@ -7,6 +7,7 @@ import mitt from "@/utils/mitt.js";
import payUser from "@/components/payUser.vue";
import { userAddressDetailApi, userAddressEditApi, userDetailApi } from "@/api/user"
import { apiProvince, apiCity, apiArea, apiStreet, apiVillage, apiBrigade } from '@/api/public'
import { userShipApi, userShipUpdateApi } from "@/api/user"
const userStore = useUserStore();
const router = useRouter();
@ -41,6 +42,29 @@ const paySuccess = () => {
mitt.emit('re-load-user-list');
}
const updateShip = ref(false);
const userShip = ref([]);
const getUserShip = () => {
userShipApi().then(res => {
userShip.value = res.data.lists;
})
}
getUserShip()
const updateUserShip = ()=>{
userShipUpdateApi({
id: formData.value.id,
user_ship: formData.value.user_ship
}).then(res => {
ElMessage.success('修改成功');
formData.value.user_ship_name = userShip.value.find(item=>item.id==formData.value.user_ship)?.title;
updateShip.value = false;
})
}
const cancelUserShip = ()=>{
updateShip.value = false;
}
const addressInfo = ref({
id: '',
province: '',
@ -213,13 +237,17 @@ onUnmounted(() => {
</div>
</div>
<div class="info-item">
<div class="info-item-title">用户昵称:</div>
<div class="info-item-info">{{ formData.nickname }}</div>
<div class="info-item-title">礼品券:</div>
<div class="info-item-info red">¥{{ formData.integral }}</div>
</div>
<div class="info-item">
<div class="info-item-title">ID:</div>
<div class="info-item-info">{{ formData.id }}</div>
</div>
<div class="info-item">
<div class="info-item-title">用户昵称:</div>
<div class="info-item-info">{{ formData.nickname }}</div>
</div>
<div class="info-item">
<div class="info-item-title">用户电话:</div>
<div class="info-item-info">{{ formData.mobile }}</div>
@ -236,21 +264,21 @@ onUnmounted(() => {
<div class="info-item-title">用户类型:</div>
<div class="info-item-info">
<template v-if="updateShip == false">
<el-tag type="primary" v-if="formData.user_ship == 0">{{ formData.user_ship_name
<el-tag type="primary" size="large" v-if="formData.user_ship != 1">{{ formData.user_ship_name
}}</el-tag>
<el-tag type="success" v-else>{{ formData.user_ship_name }}</el-tag>
<el-button v-if="isDisabled" type="primary" style="margin-left: 1rem;" size="small"
@click="isDisabled = false">修改</el-button>
<el-tag type="success" size="large" v-else>{{ formData.user_ship_name }}</el-tag>
<el-button type="primary" style="margin-left: 1rem;"
@click="updateShip = true">修改</el-button>
</template>
<template v-else>
<el-select v-model="formDataInfo.user_ship" placeholder="请选择会员类型" style="width: 100%;">
<el-select v-model="formData.user_ship" placeholder="请选择用户类型" style="width: 10rem;">
<el-option v-for="item in userShip" :key="item.id" :label="item.title"
:value="item.id" :disabled="item.id == 1" />
</el-select>
<el-button v-if="!isDisabled" type="primary" style="margin-left: 1rem;"
@click="updateAddress">确认</el-button>
<el-button v-if="!isDisabled" style="margin-left: 1rem;"
@click="cancelUpdate">取消</el-button>
<el-button type="primary" style="margin-left: 1rem;"
@click="updateUserShip">确认</el-button>
<el-button style="margin-left: 1rem;"
@click="cancelUserShip">取消</el-button>
</template>
</div>
</div>

View File

@ -120,6 +120,7 @@ onUnmounted(()=>{
<div>余额: <span class="red">{{item.now_money}}</span></div>
<div>采购款: <span class="red">{{item.purchase_funds}}</span></div>
<div>待返还: <span class="red">{{item.return_money}}</span></div>
<div>礼品券: <span class="red">{{item.integral}}</span></div>
<div>
<el-tag type="primary" v-if="item.user_ship!=1">{{ item.user_ship_name }}</el-tag>
<el-tag type="success" v-else>{{ item.user_ship_name }}</el-tag>
@ -206,7 +207,8 @@ onUnmounted(()=>{
margin-right: 1rem;
}
.bottom {
.bottom>div{
margin-left: 0.5rem;
}
.red {