This commit is contained in:
parent
74912345fc
commit
f65aed1e0c
|
@ -48,7 +48,8 @@ const changeActive = (e) => {
|
||||||
|
|
||||||
const form = ref({
|
const form = ref({
|
||||||
price: 0,
|
price: 0,
|
||||||
uid: ''
|
uid: '',
|
||||||
|
user_ship: '',
|
||||||
});
|
});
|
||||||
const cart_id = ref([]);
|
const cart_id = ref([]);
|
||||||
const isRePay = ref(false);
|
const isRePay = ref(false);
|
||||||
|
@ -107,6 +108,7 @@ const handleEnter = () => {
|
||||||
}
|
}
|
||||||
userRechangeAmountApi({
|
userRechangeAmountApi({
|
||||||
uid: form.value.uid,
|
uid: form.value.uid,
|
||||||
|
user_ship: form.value.user_ship,
|
||||||
price: form.value.price,
|
price: form.value.price,
|
||||||
pay_type: pay_type,
|
pay_type: pay_type,
|
||||||
auth_code: input.value,
|
auth_code: input.value,
|
||||||
|
@ -123,13 +125,13 @@ const handleEnter = () => {
|
||||||
} else {
|
} else {
|
||||||
if (res.msg == "用户支付中" && res.code == 1) {
|
if (res.msg == "用户支付中" && res.code == 1) {
|
||||||
ElMessage.warning(res.msg);
|
ElMessage.warning(res.msg);
|
||||||
mitt.on("pay_success", (e) => {
|
mitt.on("pay_user_success", (e) => {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: "支付成功",
|
message: "支付成功",
|
||||||
type: "success",
|
type: "success",
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
mitt.off("pay_success");
|
mitt.off("pay_user_success");
|
||||||
}, 200);
|
}, 200);
|
||||||
drawer.value = false;
|
drawer.value = false;
|
||||||
beforeClose(e);
|
beforeClose(e);
|
||||||
|
@ -175,13 +177,13 @@ const orderPay = () => {
|
||||||
} else {
|
} else {
|
||||||
if (res.msg == "用户支付中" && res.code == 1) {
|
if (res.msg == "用户支付中" && res.code == 1) {
|
||||||
ElMessage.warning(res.msg);
|
ElMessage.warning(res.msg);
|
||||||
mitt.on("pay_success", (e) => {
|
mitt.on("pay_user_success", (e) => {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: "支付成功",
|
message: "支付成功",
|
||||||
type: "success",
|
type: "success",
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
mitt.off("pay_success");
|
mitt.off("pay_user_success");
|
||||||
}, 200);
|
}, 200);
|
||||||
drawer.value = false;
|
drawer.value = false;
|
||||||
beforeClose(e);
|
beforeClose(e);
|
||||||
|
@ -323,6 +325,7 @@ const cashBnt = () => {
|
||||||
else
|
else
|
||||||
userRechangeAmountApi({
|
userRechangeAmountApi({
|
||||||
uid: form.value.uid,
|
uid: form.value.uid,
|
||||||
|
user_ship: form.value.user_ship,
|
||||||
price: form.value.price,
|
price: form.value.price,
|
||||||
pay_type: 17,
|
pay_type: 17,
|
||||||
})
|
})
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { ref, nextTick, onMounted, onUnmounted } from "vue";
|
||||||
import mitt from "@/utils/mitt.js";
|
import mitt from "@/utils/mitt.js";
|
||||||
import { useUserStore } from "@/store/user.js";
|
import { useUserStore } from "@/store/user.js";
|
||||||
import { Push } from "@/common/push.js";
|
import { Push } from "@/common/push.js";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const connection = new Push({
|
const connection = new Push({
|
||||||
|
@ -30,6 +31,9 @@ user_channel.on('message', function (data) {
|
||||||
if (data?.content?.type == 'platform_print') {
|
if (data?.content?.type == 'platform_print') {
|
||||||
mitt.emit('letPrintReceipt', data?.content?.data);
|
mitt.emit('letPrintReceipt', data?.content?.data);
|
||||||
}
|
}
|
||||||
|
if (data?.content?.msg == '订单支付成功') {
|
||||||
|
mitt.emit('pay_user_success', data?.content?.data);
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,6 +49,7 @@ user_channel.on('close', function () {
|
||||||
|
|
||||||
const KeyboardEvent = (e) => {
|
const KeyboardEvent = (e) => {
|
||||||
console.log('按下', e.keyCode);
|
console.log('按下', e.keyCode);
|
||||||
|
// ElMessage.warning('按下', e.keyCode)
|
||||||
if (e.keyCode == 16) mitt.emit('shift');
|
if (e.keyCode == 16) mitt.emit('shift');
|
||||||
if (e.keyCode == 120) mitt.emit('F9');
|
if (e.keyCode == 120) mitt.emit('F9');
|
||||||
if (e.keyCode == 13) mitt.emit('enter');
|
if (e.keyCode == 13) mitt.emit('enter');
|
||||||
|
|
|
@ -113,10 +113,10 @@ const testObj = {
|
||||||
|
|
||||||
export const printTicket = (obj = {}, test = false) => {
|
export const printTicket = (obj = {}, test = false) => {
|
||||||
let str = "";
|
let str = "";
|
||||||
if(!obj || !obj.order_id) obj = testObj;
|
if (!obj || !obj.order_id) obj = testObj;
|
||||||
str += Esc.Size2(2) + Esc.Center() + Esc.boldFontOn() + obj.system_store_name + Esc.Size1() + "\n";
|
str += Esc.Size2(2) + Esc.Center() + Esc.boldFontOn() + obj.system_store_name + Esc.Size1() + "\n";
|
||||||
str += Esc.fillLine(" ") + Esc.boldFontOff() + "\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() + "\n";
|
||||||
str += Esc.Left() + "单号: " + obj.order_id + "\n";
|
str += Esc.Left() + "单号: " + obj.order_id + "\n";
|
||||||
str += Esc.Left() + "下单时间: " + obj.create_time + "\n";
|
str += Esc.Left() + "下单时间: " + obj.create_time + "\n";
|
||||||
|
|
||||||
|
@ -128,19 +128,22 @@ export const printTicket = (obj = {}, test = false) => {
|
||||||
str += Esc.Left() + item.store_name + "\n";
|
str += Esc.Left() + item.store_name + "\n";
|
||||||
let total = +item.price || 0;
|
let total = +item.price || 0;
|
||||||
total *= +item.cart_num;
|
total *= +item.cart_num;
|
||||||
str += Esc.inline3(`${item.price || '0.00'}元`, `${item.cart_num}${item.unit_name||''}`, `${total}元`, " ", 1) + "\n";
|
str += Esc.inline3(`${item.price || '0.00'}元`, `${item.cart_num}${item.unit_name || ''}`, `${total}元`, " ", 1) + "\n";
|
||||||
})
|
})
|
||||||
|
|
||||||
str += Esc.fillLine("=") + "\n";
|
str += Esc.fillLine("=") + "\n";
|
||||||
|
|
||||||
// str += Esc.Left() + "合计: " + obj.total_price + "元" + "\n";
|
if (obj.deduction_price) { // 有优惠
|
||||||
str += Esc.Left() + "合计: " + obj.pay_price + "元" + "\n";
|
str += Esc.Left() + "合计: " + obj.total_price + "元" + "\n";
|
||||||
|
str += Esc.Left() + "优惠: " + obj.deduction_price + "元" + "\n";
|
||||||
|
}
|
||||||
|
else str += Esc.Left() + "合计: " + obj.pay_price + "元" + "\n";
|
||||||
str += Esc.Left() + "实付款: " + obj.pay_price + "元" + "\n";
|
str += Esc.Left() + "实付款: " + obj.pay_price + "元" + "\n";
|
||||||
str += Esc.Left() + "支付方式: " + obj.pay_type_name + "\n";
|
str += Esc.Left() + "支付方式: " + obj.pay_type_name + "\n";
|
||||||
// str += Esc.Left() + "支付单号: " + obj.order_id + "\n";
|
// str += Esc.Left() + "支付单号: " + obj.order_id + "\n";
|
||||||
str += Esc.Left() + "店铺电话: " + obj.system_store_phone + "\n";
|
str += Esc.Left() + "店铺电话: " + obj.system_store_phone + "\n";
|
||||||
|
|
||||||
if(obj.shipping_type == 1){ // 快递
|
if (obj.shipping_type == 1) { // 快递
|
||||||
str += Esc.fillLine("=") + "\n";
|
str += Esc.fillLine("=") + "\n";
|
||||||
str += Esc.Left() + "收货人: " + obj.real_name + "\n";
|
str += Esc.Left() + "收货人: " + obj.real_name + "\n";
|
||||||
str += Esc.Left() + "收货电话: " + obj.user_phone + "\n";
|
str += Esc.Left() + "收货电话: " + obj.user_phone + "\n";
|
||||||
|
|
|
@ -120,7 +120,9 @@ const props = {
|
||||||
const userShip = ref([])
|
const userShip = ref([])
|
||||||
const getUserShip = () => {
|
const getUserShip = () => {
|
||||||
userShipApi().then(res => {
|
userShipApi().then(res => {
|
||||||
userShip.value = res.data.lists;
|
userShip.value = res.data.lists?.filter((item) => {
|
||||||
|
return item.id == 0 || item.id == 4
|
||||||
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
getUserShip()
|
getUserShip()
|
||||||
|
@ -142,6 +144,12 @@ const addUser = () => {
|
||||||
forms.brigade = formDataInfo.selectedValues[4]
|
forms.brigade = formDataInfo.selectedValues[4]
|
||||||
forms.store_id = userStore.userInfo.store_id;
|
forms.store_id = userStore.userInfo.store_id;
|
||||||
userAddApi(forms).then(res=>{
|
userAddApi(forms).then(res=>{
|
||||||
|
formDataInfo.mobile = '';
|
||||||
|
formDataInfo.code = '';
|
||||||
|
formDataInfo.user_ship = '';
|
||||||
|
formDataInfo.real_name = '';
|
||||||
|
formDataInfo.selectedValues = [];
|
||||||
|
formDataRef.value.resetFields();
|
||||||
emit('close')
|
emit('close')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -188,7 +196,7 @@ defineExpose({
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="用户类型" prop="user_ship">
|
<el-form-item label="用户类型" prop="user_ship">
|
||||||
<el-select v-model="formDataInfo.user_ship" placeholder="请选择用户类型" style="width: 100%;">
|
<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||item.id==2||item.id==3" />
|
<el-option v-for="item in userShip" :key="item.id" :label="item.title" :value="item.id" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="用户地址" prop="selectedValues">
|
<el-form-item label="用户地址" prop="selectedValues">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, onUnmounted, ref } from "vue";
|
import { nextTick, onMounted, onUnmounted, ref } from "vue";
|
||||||
import { useUserStore } from "@/store/user.js";
|
import { useUserStore } from "@/store/user.js";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
|
@ -35,6 +35,7 @@ const toPay = () => {
|
||||||
data: {
|
data: {
|
||||||
uid: formData.value.id,
|
uid: formData.value.id,
|
||||||
price: payInfo.value.price,
|
price: payInfo.value.price,
|
||||||
|
user_ship: formData.value.user_ship
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
payRef.value.drawer = true;
|
payRef.value.drawer = true;
|
||||||
|
@ -305,14 +306,53 @@ const getUserInfo = () => {
|
||||||
const dialogFormShip = ref(false);
|
const dialogFormShip = ref(false);
|
||||||
const shipForm = ref({
|
const shipForm = ref({
|
||||||
user_ship: '',
|
user_ship: '',
|
||||||
|
user_ship_name: '',
|
||||||
limit: '',
|
limit: '',
|
||||||
money: '',
|
money: '',
|
||||||
|
type: '',
|
||||||
})
|
})
|
||||||
const onUpdateShip = ()=>{
|
const onUpdateShip = () => {
|
||||||
console.log('变化', shipForm.value.money);
|
shipForm.value.money = Number(shipForm.value.money).toFixed(2);
|
||||||
|
if (+shipForm.value.money < +shipForm.value.limit || +shipForm.value.money > 10000) {
|
||||||
|
+shipForm.value.limit > 0 ? shipForm.value.money = shipForm.value.limit : shipForm.value.money = '';
|
||||||
|
// return ElMessage.error(`该类型至少需要充值${shipForm.value.limit}元`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const changeShip = (e)=>{
|
const changeShip = (e) => {
|
||||||
console.log('changeShip', shipForm.value.user_ship, e);
|
let t = userShip.value.find(item => item.id == e);
|
||||||
|
if (t) {
|
||||||
|
shipForm.value.limit = t.limit;
|
||||||
|
shipForm.value.user_ship_name = t.title;
|
||||||
|
shipForm.value.money = t.limit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const shipRecharge = () => {
|
||||||
|
if (shipForm.value.user_ship === '' || shipForm.value.user_ship === null || shipForm.value.user_ship === undefined) return ElMessage.error("请选择会员类型");
|
||||||
|
if (shipForm.value.money == 0 || shipForm.value.money == '') return ElMessage.error("请输入充值金额");
|
||||||
|
if (+shipForm.value.money < +shipForm.value.limit || +shipForm.value.money > 10000) {
|
||||||
|
+shipForm.value.limit > 0 ? shipForm.value.money = shipForm.value.limit : shipForm.value.money = '';
|
||||||
|
return ElMessage.error(`该类型至少需要充值${shipForm.value.limit}元`)
|
||||||
|
}
|
||||||
|
payRef.value.setForm({
|
||||||
|
data: {
|
||||||
|
uid: formData.value.id,
|
||||||
|
price: shipForm.value.money,
|
||||||
|
user_ship: shipForm.value.user_ship
|
||||||
|
}
|
||||||
|
});
|
||||||
|
payRef.value.drawer = true;
|
||||||
|
nextTick(() => {
|
||||||
|
dialogFormShip.value = false;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const rechargeMoney = (type) => {
|
||||||
|
shipForm.value.type = type;
|
||||||
|
if (type == 'add') {
|
||||||
|
shipForm.value.user_ship = formData.value.user_ship;
|
||||||
|
shipForm.value.user_ship_name = formData.value.user_ship_name;
|
||||||
|
changeShip(shipForm.value.user_ship)
|
||||||
|
}
|
||||||
|
dialogFormShip.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -329,6 +369,13 @@ onMounted(() => {
|
||||||
})
|
})
|
||||||
getAddress();
|
getAddress();
|
||||||
initProduct(true);
|
initProduct(true);
|
||||||
|
shipForm.value = {
|
||||||
|
user_ship: '',
|
||||||
|
user_ship_name: '',
|
||||||
|
limit: '',
|
||||||
|
money: '',
|
||||||
|
type: ''
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -409,17 +456,18 @@ onUnmounted(() => {
|
||||||
<div class="info-item-title">用户类型:</div>
|
<div class="info-item-title">用户类型:</div>
|
||||||
<div class="info-item-info">
|
<div class="info-item-info">
|
||||||
<template v-if="updateShip == false">
|
<template v-if="updateShip == false">
|
||||||
<el-tag type="primary" size="large" v-if="formData.user_ship != 1">{{
|
<el-tag type="primary" size="large"
|
||||||
formData.user_ship_name
|
v-if="formData.user_ship == 0 || formData.user_ship == 4">{{
|
||||||
}}</el-tag>
|
formData.user_ship_name
|
||||||
|
}}</el-tag>
|
||||||
<el-tag type="success" size="large" v-else>{{ formData.user_ship_name }}</el-tag>
|
<el-tag type="success" size="large" v-else>{{ formData.user_ship_name }}</el-tag>
|
||||||
<el-button type="primary" v-if="formData.user_ship != 1" style="margin-left: 1rem;"
|
<el-button type="primary" v-if="formData.user_ship == 0 || formData.user_ship == 4"
|
||||||
@click="updateShip = true">修改</el-button>
|
style="margin-left: 1rem;" @click="updateShip = true">修改</el-button>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<el-select v-model="formData.user_ship" placeholder="请选择用户类型" style="width: 10rem;">
|
<el-select v-model="formData.user_ship" placeholder="请选择用户类型" style="width: 10rem;">
|
||||||
<el-option v-for="item in userShip" :key="item.id" :label="item.title"
|
<el-option v-for="item in userShip" :key="item.id" :label="item.title"
|
||||||
:value="item.id" :disabled="item.id == 1 || item.id == 2 || item.id == 3" />
|
:value="item.id" :disabled="item.id != 0 && item.id != 4" />
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-button type="primary" style="margin-left: 1rem;"
|
<el-button type="primary" style="margin-left: 1rem;"
|
||||||
@click="updateUserShip">确认</el-button>
|
@click="updateUserShip">确认</el-button>
|
||||||
|
@ -460,10 +508,13 @@ onUnmounted(() => {
|
||||||
@click="updateAddress">确认</el-button>
|
@click="updateAddress">确认</el-button>
|
||||||
<el-button v-if="!isDisabled" style="margin-left: 1rem;" @click="cancelUpdate">取消</el-button>
|
<el-button v-if="!isDisabled" style="margin-left: 1rem;" @click="cancelUpdate">取消</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-button type="primary" class="big-btn" @click="dialogFormShip = true">成为会员</el-button>
|
<el-button v-if="formData.user_ship != 0 && formData.user_ship != 4" type="success" class="big-btn"
|
||||||
|
size="large" @click="rechargeMoney('add')">增加经营资金</el-button>
|
||||||
|
<el-button v-else type="primary" class="big-btn" size="large"
|
||||||
|
@click="rechargeMoney('recharge')">成为会员</el-button>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="table-title">供销经营礼包<span class="tips">首次购买1000元以上成为行业会员</span></div>
|
<!-- <div class="table-title" v-if="formData.user_ship != 0 && formData.user_ship != 4">供销经营礼包</div>
|
||||||
<div class="table-info">
|
<div class="table-info" v-if="formData.user_ship != 0 && formData.user_ship != 4">
|
||||||
<div class="pay-btn">
|
<div class="pay-btn">
|
||||||
<div class="pay-item" :class="{ 'pay-item-active': payInfo.type == 1 }"
|
<div class="pay-item" :class="{ 'pay-item-active': payInfo.type == 1 }"
|
||||||
@click="payInfo.type = 1">
|
@click="payInfo.type = 1">
|
||||||
|
@ -547,29 +598,35 @@ onUnmounted(() => {
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<el-dialog v-model="dialogFormShip" title="成为会员" width="500">
|
<el-dialog v-model="dialogFormShip" :title="shipForm.type == 'add' ? '增加经营资金' : '成为会员'" width="500">
|
||||||
<el-form :model="shipForm" label-width="80px">
|
<el-form :model="shipForm" label-width="80px">
|
||||||
<el-form-item label="手机号:">
|
<el-form-item label="手机号:">
|
||||||
<el-input v-model="formData.phone" autocomplete="off" readonly />
|
<el-input v-model="formData.phone" autocomplete="off" readonly />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="会员类型:">
|
<el-form-item label="手机号:" v-if="shipForm.type == 'add'">
|
||||||
|
<el-input v-model="shipForm.user_ship_name" autocomplete="off" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="会员类型:" v-else required>
|
||||||
<el-select v-model="shipForm.user_ship" placeholder="请选择用户类型" style="flex: 1" @change="changeShip">
|
<el-select v-model="shipForm.user_ship" placeholder="请选择用户类型" style="flex: 1" @change="changeShip">
|
||||||
<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"
|
||||||
:disabled="item.id == 0" />
|
:disabled="item.id == 0 || item.id == 4" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="充值金额:">
|
<el-form-item label="充值金额:" required>
|
||||||
<!-- <input type="number" class="ship-input" v-model="payInfo.price" placeholder="自定义金额"> -->
|
<!-- <input type="number" class="ship-input" v-model="payInfo.price" placeholder="自定义金额"> -->
|
||||||
<el-input v-model="shipForm.money" type="number" @blur="onUpdateShip" autocomplete="off">
|
<el-input v-model="shipForm.money" type="number" @blur="onUpdateShip" @focus="shipForm.money = ''"
|
||||||
|
autocomplete="off">
|
||||||
<template #prepend>¥</template>
|
<template #prepend>¥</template>
|
||||||
<template #append>元</template>
|
<template #append>元</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
|
<span v-if="shipForm.limit">{{ `${shipForm.user_ship_name}角色至少要充值${shipForm.limit}元, 最大不超过10000元`
|
||||||
|
}}</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="dialogFormShip = false">取消</el-button>
|
<el-button @click="dialogFormShip = false">取消</el-button>
|
||||||
<el-button type="primary" @click="onOutPut">
|
<el-button type="primary" @click="shipRecharge">
|
||||||
确认
|
确认
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -728,7 +785,6 @@ onUnmounted(() => {
|
||||||
.big-btn {
|
.big-btn {
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 3rem;
|
|
||||||
border-radius: 3rem;
|
border-radius: 3rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -768,7 +824,7 @@ onUnmounted(() => {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ship-input{
|
.ship-input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { useRouter } from "vue-router";
|
||||||
import mitt from "@/utils/mitt.js";
|
import mitt from "@/utils/mitt.js";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import add from './add.vue';
|
import add from './add.vue';
|
||||||
|
import { apiProvince, apiCity, apiArea, apiStreet, apiVillage, apiBrigade } from '@/api/public'
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -30,6 +31,7 @@ const where = ref({
|
||||||
page_size: 20,
|
page_size: 20,
|
||||||
mobile: "",
|
mobile: "",
|
||||||
user_ship: "",
|
user_ship: "",
|
||||||
|
street: null
|
||||||
});
|
});
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
@ -89,6 +91,101 @@ getUserShip()
|
||||||
const resetWhere = ()=>{
|
const resetWhere = ()=>{
|
||||||
where.value.mobile = "";
|
where.value.mobile = "";
|
||||||
where.value.user_ship = "";
|
where.value.user_ship = "";
|
||||||
|
where.value.street = null;
|
||||||
|
selectedValues.value = [];
|
||||||
|
getOrderList(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const selectedValues = ref([])
|
||||||
|
const options = ref([]);
|
||||||
|
// 异步加载数据的方法
|
||||||
|
const loadOptions = async (node, resolve) => {
|
||||||
|
const level = node.level;
|
||||||
|
let response;
|
||||||
|
if (level !== 0 && !node.data.code) return resolve([]);
|
||||||
|
// if (level === 0) {
|
||||||
|
// response = await apiProvince();
|
||||||
|
// response = response.data.map((item) => {
|
||||||
|
// return {
|
||||||
|
// code: item.province_code,
|
||||||
|
// name: item.province_name
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// } else
|
||||||
|
if (level === 0) {
|
||||||
|
response = await apiCity({
|
||||||
|
province_code: 510000 // 四川省
|
||||||
|
});
|
||||||
|
response = response.data.map((item) => {
|
||||||
|
return {
|
||||||
|
code: item.city_code,
|
||||||
|
name: item.city_name
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if (level === 1) {
|
||||||
|
response = await apiArea({
|
||||||
|
city_code: node.data.code
|
||||||
|
});
|
||||||
|
response = response.data.map((item) => {
|
||||||
|
return {
|
||||||
|
code: item.area_code,
|
||||||
|
name: item.area_name
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else if (level === 2) {
|
||||||
|
response = await apiStreet({
|
||||||
|
area_code: node.data.code
|
||||||
|
});
|
||||||
|
response = response.data.map((item) => {
|
||||||
|
return {
|
||||||
|
code: item.street_code,
|
||||||
|
name: item.street_name,
|
||||||
|
leaf: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else if (level === 3) {
|
||||||
|
response = await apiVillage({
|
||||||
|
street_code: node.data.code
|
||||||
|
});
|
||||||
|
response = response.data.map((item) => {
|
||||||
|
return {
|
||||||
|
code: item.village_code,
|
||||||
|
name: item.village_name,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else if (level === 4) {
|
||||||
|
response = await apiBrigade({
|
||||||
|
village_code: node.data.code
|
||||||
|
});
|
||||||
|
response = response.data.map((item) => {
|
||||||
|
return {
|
||||||
|
code: item.id,
|
||||||
|
name: item.brigade_name,
|
||||||
|
leaf: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve(response);
|
||||||
|
};
|
||||||
|
const propOptions = {
|
||||||
|
value: 'code',
|
||||||
|
label: 'name',
|
||||||
|
children: 'children',
|
||||||
|
multiple: false,
|
||||||
|
lazy: true,
|
||||||
|
lazyLoad: loadOptions
|
||||||
|
};
|
||||||
|
const changeAddress = ()=>{
|
||||||
|
if(selectedValues.value.length){
|
||||||
|
where.value.street = selectedValues.value[selectedValues.value.length - 1];
|
||||||
|
}else{
|
||||||
|
where.value.street = "";
|
||||||
|
}
|
||||||
getOrderList(true);
|
getOrderList(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,8 +216,13 @@ onUnmounted(() => {
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-button @click="resetWhere" style="margin-left: 1rem;">重置</el-button>
|
<el-button @click="resetWhere" style="margin-left: 1rem;">重置</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="header-row">
|
||||||
|
<div class="label">用户地区</div>
|
||||||
|
<el-cascader style="flex: 1;" :options="options" v-model="selectedValues"
|
||||||
|
:props="propOptions" :load="loadOptions" class="w-full" @change="changeAddress" />
|
||||||
|
</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="搜索手机号" @keydown.enter="getOrderList(true)"
|
||||||
@clear="getOrderList(true)" clearable>
|
@clear="getOrderList(true)" clearable>
|
||||||
<template #append>
|
<template #append>
|
||||||
<el-button type="primary" style="
|
<el-button type="primary" style="
|
||||||
|
@ -138,7 +240,7 @@ onUnmounted(() => {
|
||||||
<el-avatar class="avatar" :src="item.avatar" />
|
<el-avatar class="avatar" :src="item.avatar" />
|
||||||
<div style="display: flex; flex-direction: column; justify-content: space-around;flex:1;">
|
<div style="display: flex; flex-direction: column; justify-content: space-around;flex:1;">
|
||||||
<div class="top flex">
|
<div class="top flex">
|
||||||
<div class="r-1"><span class="bold">{{ item.nickname }}</span><span>{{ ' (ID:' + item.id
|
<div class="r-1"><span class="bold">{{ item.real_name || item.nickname }}</span><span>{{ ' (ID:' + item.id
|
||||||
+')'}}</span>
|
+')'}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div>手机号: {{ item.mobile }}</div>
|
<div>手机号: {{ item.mobile }}</div>
|
||||||
|
@ -150,7 +252,7 @@ onUnmounted(() => {
|
||||||
<div>返还金: <span class="red">{{ item.return_money?.toFixed(2) }}</span></div>
|
<div>返还金: <span class="red">{{ item.return_money?.toFixed(2) }}</span></div>
|
||||||
<div>礼品券: <span class="red">{{ item.get_frozen?.toFixed(2) }}</span></div>
|
<div>礼品券: <span class="red">{{ item.get_frozen?.toFixed(2) }}</span></div>
|
||||||
<div>
|
<div>
|
||||||
<el-tag type="primary" v-if="item.user_ship != 1">{{ item.user_ship_name }}</el-tag>
|
<el-tag type="primary" v-if="item.user_ship == 0 || item.user_ship == 4">{{ item.user_ship_name }}</el-tag>
|
||||||
<el-tag type="success" v-else>{{ item.user_ship_name }}</el-tag>
|
<el-tag type="success" v-else>{{ item.user_ship_name }}</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue