订单模块联调

This commit is contained in:
cuiyouliang 2025-06-06 11:48:43 +08:00
parent 4c69fcbe62
commit f3501d4385
9 changed files with 189 additions and 212 deletions

View File

@ -5,7 +5,6 @@
</template> </template>
<script> <script>
import { getDicts } from '@/api/system/dict/data';
export default { export default {
props: ['radioData', 'size', 'value', 'showAll', 'filter'], props: ['radioData', 'size', 'value', 'showAll', 'filter'],
emits: ['change', 'input'], emits: ['change', 'input'],
@ -24,32 +23,15 @@ export default {
} }
} }
}, },
created() { async created() {
if (this.radioData) { if (this.radioData) {
this.getEmuList(); const resDic = await this.getDictionaryByKey(this.radioData);
this.dictList = resDic;
} }
}, },
methods: { methods: {
change(val) { change(val) {
this.$emit('change', val); this.$emit('change', val);
},
getEmuList() {
getDicts(this.radioData)
.then((res) => {
const { code, data = [] } = res || {};
if (code == 200) {
const dicArr = data.map((p) => {
return { label: p.dictLabel, value: p.dictValue, elTagType: p.listClass, elTagClass: p.cssClass };
});
this.dictList = dicArr || [];
} else {
this.dictList = [];
}
})
.catch(() => {
this.dictList = [];
});
} }
} }
}; };

View File

@ -7,7 +7,7 @@ import auth from './auth';
import animate from '@/animate'; import animate from '@/animate';
import { download as dl } from '@/utils/request'; import { download as dl } from '@/utils/request';
import { useDict } from '@/utils/dict'; import { useDict, getDictionaryByKey } from '@/utils/dict';
import { getConfigKey, updateConfigByKey } from '@/api/system/config'; import { getConfigKey, updateConfigByKey } from '@/api/system/config';
import { import {
parseTime, parseTime,
@ -56,4 +56,5 @@ export default function installPlugin(app: App) {
app.config.globalProperties.addDateRange2 = addDateRange2; app.config.globalProperties.addDateRange2 = addDateRange2;
app.config.globalProperties.getHiddenName = getHiddenName; app.config.globalProperties.getHiddenName = getHiddenName;
app.config.globalProperties.getHiddenDetailAddress = getHiddenDetailAddress; app.config.globalProperties.getHiddenDetailAddress = getHiddenDetailAddress;
app.config.globalProperties.getDictionaryByKey = getDictionaryByKey;
} }

View File

@ -21,6 +21,7 @@ export const useMallStore = defineStore('mall', () => {
if (!force && state.value.areaSelect.length > 0) { if (!force && state.value.areaSelect.length > 0) {
return Promise.resolve(); return Promise.resolve();
} }
return areaSelect({}).then((res) => { return areaSelect({}).then((res) => {
state.value.areaSelect = res.data; state.value.areaSelect = res.data;
}); });

View File

@ -1,5 +1,7 @@
import { getDicts } from '@/api/system/dict/data'; import { getDicts } from '@/api/system/dict/data';
import { useDictStore } from '@/store/modules/dict'; import { useDictStore } from '@/store/modules/dict';
import { TUIChatService } from '@tencentcloud/chat-uikit-engine';
import { IChatResponese } from '@/TUIKit/interface';
/** /**
* *
*/ */
@ -24,3 +26,21 @@ export const useDict = (...args: string[]): { [key: string]: DictDataOption[] }
}); });
return res.value; return res.value;
}; };
// 根据key获取指定枚举值
export const getDictionaryByKey = (args: string): DictDataOption[] => {
return new Promise((resolve, reject) => {
const dicts = useDictStore().getDict(args);
if (dicts) {
resolve(dicts);
} else {
getDicts(args).then((resp) => {
const resDic = resp.data.map(
(p): DictDataOption => ({ label: p.dictLabel, value: p.dictValue, elTagType: p.listClass, elTagClass: p.cssClass })
);
useDictStore().setDict(args, resDic);
resolve(resDic);
});
}
});
};

View File

@ -17,7 +17,7 @@
import { useMallStore } from '@/store/modules/mall'; import { useMallStore } from '@/store/modules/mall';
export default { export default {
name: 'AddressSelector', name: 'AddressSelector',
props: ['value', 'props', 'size'], props: ['modelValue', 'props', 'size'],
computed: { computed: {
areaSelect: { areaSelect: {
get() { get() {
@ -26,18 +26,19 @@ export default {
}, },
tempValue: { tempValue: {
get() { get() {
return this.value; return this.modelValue;
}, },
set(v) { set(v) {
this.$emit('input', v); this.$emit('update:modelValue', v);
} }
}, },
menuOptions() { menuOptions() {
if (!this.areaSelect || this.areaSelect.length === 0) { if (!this.areaSelect || this.areaSelect.length === 0) {
return []; return [];
} else {
const afterHandled = this.recurs(this.areaSelect);
return afterHandled;
} }
this.recurs(this.areaSelect);
return this.areaSelect;
} }
}, },
created() { created() {
@ -45,12 +46,16 @@ export default {
}, },
methods: { methods: {
recurs(list) { recurs(list) {
list.forEach((it) => { return list.map((it) => {
it.label = it.name; const resItem = {
it.value = it.name; ...it,
label: it.name,
value: it.name
};
if (it.children) { if (it.children) {
this.recurs(it.children); resItem.children = this.recurs(it.children);
} }
return resItem;
}); });
} }
} }

View File

@ -167,7 +167,6 @@ function imLogin(loginInfo) {
// TUIUserService.switchUserStatus({ displayOnlineStatus: true }); // TUIUserService.switchUserStatus({ displayOnlineStatus: true });
}) })
.catch((error: any) => { .catch((error: any) => {
console.info('111111111111111111111111', error);
ElMessage({ ElMessage({
message: '登录失败', message: '登录失败',
grouping: true, grouping: true,

View File

@ -2,10 +2,12 @@
<div class="order_detail_wrapper"> <div class="order_detail_wrapper">
<el-main v-loading="loading"> <el-main v-loading="loading">
<el-card class="mt10"> <el-card class="mt10">
<div slot="header" class="clearfix"> <template v-slot:header>
<div class="clearfix">
<span style="font-size: 16px; font-weight: bold">订单进程</span> <span style="font-size: 16px; font-weight: bold">订单进程</span>
<el-button style="float: right;" size="small" @click="$router.back()">返回</el-button> <el-button style="float: right" size="small" @click="$router.back()">返回</el-button>
</div> </div>
</template>
<el-steps :active="active" align-center> <el-steps :active="active" align-center>
<el-step title="买家下单" :description="parseTime(orderDetail.createTime, '')"></el-step> <el-step title="买家下单" :description="parseTime(orderDetail.createTime, '')"></el-step>
<el-step title="买家付款" :description="parseTime(orderDetail.payTime, '')"></el-step> <el-step title="买家付款" :description="parseTime(orderDetail.payTime, '')"></el-step>
@ -23,8 +25,7 @@
<el-descriptions-item label="用户手机号">{{ orderDetail.userPhone }}</el-descriptions-item> <el-descriptions-item label="用户手机号">{{ orderDetail.userPhone }}</el-descriptions-item>
<el-descriptions-item label="下单时间">{{ parseTime(orderDetail.createTime, '') }}</el-descriptions-item> <el-descriptions-item label="下单时间">{{ parseTime(orderDetail.createTime, '') }}</el-descriptions-item>
<el-descriptions-item label="支付方式">{{ getPayType(orderDetail) }}</el-descriptions-item> <el-descriptions-item label="支付方式">{{ getPayType(orderDetail) }}</el-descriptions-item>
<el-descriptions-item label="支付时间">{{ parseTime(orderDetail.payTime, '') <el-descriptions-item label="支付时间">{{ parseTime(orderDetail.payTime, '') }}</el-descriptions-item>
}}</el-descriptions-item>
<el-descriptions-item label="订单状态">{{ getOrderStatus(orderDetail) }}</el-descriptions-item> <el-descriptions-item label="订单状态">{{ getOrderStatus(orderDetail) }}</el-descriptions-item>
</el-descriptions> </el-descriptions>
</el-card> </el-card>
@ -37,22 +38,23 @@
</el-descriptions> </el-descriptions>
</el-card> </el-card>
<el-card class="mt10"> <el-card class="mt10">
<div slot="header" style="font-size: 16px;font-weight: bold;">商品信息</div> <template v-slot:header>
<div style="font-size: 16px; font-weight: bold">商品信息</div>
</template>
<el-table :data="products"> <el-table :data="products">
<el-table-column label="商品图片" prop="pic"> <el-table-column label="商品图片" prop="pic">
<template slot-scope="{row}"><el-image class="small-img circle-img" :src="row.pic" <template v-slot="{ row }"><el-image class="small-img circle-img" :src="row.pic" :preview-src-list="[row.pic]" /></template>
:preview-src-list="[row.pic]" /></template>
</el-table-column> </el-table-column>
<el-table-column label="商品ID" prop="productId"></el-table-column> <el-table-column label="商品ID" prop="productId"></el-table-column>
<el-table-column label="商品名称" prop="productName"></el-table-column> <el-table-column label="商品名称" prop="productName"></el-table-column>
<el-table-column label="商品规格" align="center" prop="spData" width="180"> <el-table-column label="商品规格" align="center" prop="spData" width="180">
<template slot-scope="scope"> <template v-slot="scope">
<div v-for="(item, key) in JSON.parse(scope.row.spData)">{{ key }}{{ item }}</div> <div v-for="(item, key) in JSON.parse(scope.row.spData)">{{ key }}{{ item }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="购买数量" prop="buyNum"></el-table-column> <el-table-column label="购买数量" prop="buyNum"></el-table-column>
<el-table-column label="实付金额" prop="payAmount"> <el-table-column label="实付金额" prop="payAmount">
<template slot-scope="scope"> <template v-slot="scope">
<span>{{ orderDetail.payAmount }}</span> <span>{{ orderDetail.payAmount }}</span>
</template> </template>
</el-table-column> </el-table-column>
@ -60,8 +62,7 @@
</el-card> </el-card>
<el-card class="mt10"> <el-card class="mt10">
<el-descriptions title="物流信息" :column="3" border label-class-name="my-label" contentClassName="my-content"> <el-descriptions title="物流信息" :column="3" border label-class-name="my-label" contentClassName="my-content">
<el-descriptions-item label="发货时间">{{ parseTime(orderDetail.deliveryTime, '') <el-descriptions-item label="发货时间">{{ parseTime(orderDetail.deliveryTime, '') }}</el-descriptions-item>
}}</el-descriptions-item>
<el-descriptions-item label="快递单号">{{ orderDetail.expressNo }}</el-descriptions-item> <el-descriptions-item label="快递单号">{{ orderDetail.expressNo }}</el-descriptions-item>
<el-descriptions-item label="物流公司">{{ orderDetail.expressName }}</el-descriptions-item> <el-descriptions-item label="物流公司">{{ orderDetail.expressName }}</el-descriptions-item>
<!-- <el-descriptions-item label="物流进度">--> <!-- <el-descriptions-item label="物流进度">-->
@ -80,12 +81,11 @@
</template> </template>
<script> <script>
import { getOmsOrder } from "@/api/oms/order"; import { getOmsOrder } from '@/api/oms/order';
import { getConfigKey } from "@/api/system/config"; const key = 'express-set-key';
const key = "express-set-key"
export default { export default {
name: "OrderDetail", name: 'OrderDetail',
dicts: ['oms_order_status', 'oms_pay_type'], dicts: ['oms_order_status', 'oms_pay_type'],
data() { data() {
return { return {
@ -95,74 +95,54 @@ export default {
aliLogisticsInfoList: [], aliLogisticsInfoList: [],
loading: false, loading: false,
experssList: [], experssList: [],
active: 1 active: 1,
} payTypeMap: [],
orderStatusMap: []
};
}, },
created() { async created() {
// this.getExpressData() const { id } = this.$route.query;
const { id } = this.$route.query this.queryDetail(id);
this.queryDetail(id).then((expressNo) => { const orderStatusMap = await this.getDictionaryByKey('oms_order_status');
}) const payTypeMap = await this.getDictionaryByKey('oms_pay_type');
this.orderStatusMap = orderStatusMap;
}, this.payTypeMap = payTypeMap;
computed: {
orderStatusMap() {
let obj = this.dict.type.oms_order_status.map(item => [item.value, item.label])
let map = new Map(obj)
return map;
},
payTypeMap() {
let obj = this.dict.type.oms_pay_type.map(item => [item.value, item.label])
let map = new Map(obj)
return map
},
// expressMap() {
// let obj = this.experssList.map(item => [item.expressCode, item.expressName])
// let map = new Map(obj)
// return map
// }
}, },
computed: {},
methods: { methods: {
queryDetail(id) { queryDetail(id) {
this.loading = true this.loading = true;
return new Promise(resolve => return new Promise((resolve) =>
getOmsOrder(id).then(res => { getOmsOrder(id).then((res) => {
const { productInfo, addressInfo } = res; const { productInfo, addressInfo } = res;
this.orderDetail = res; this.orderDetail = res;
// if (allLogistics) { this.products = productInfo;
// this.aliLogisticsInfoList = JSON.parse(allLogistics) this.addressInfo = addressInfo;
// }
this.products = productInfo
this.addressInfo = addressInfo
if (this.orderDetail.orderStatus <= 3) { if (this.orderDetail.orderStatus <= 3) {
this.active = this.orderDetail.orderStatus + 1 this.active = this.orderDetail.orderStatus + 1;
} else { } else {
this.active = 1 this.active = 1;
} }
this.loading = false this.loading = false;
}) })
) );
}, },
getOrderStatus(row) { getOrderStatus(row) {
return this.orderStatusMap.get(row.orderStatus + '') const { label = '' } =
this.orderStatusMap.find((item) => {
return row.orderStatus == item.value;
}) || {};
return label;
}, },
getPayType(row) { getPayType(row) {
return this.payTypeMap.get(row.payType + '') const { label = '' } =
}, this.payTypeMap.find((item) => {
// getExpressName(row) { return row.orderStatus == item.value;
// return this.expressMap.get(row.expressName + '') }) || {};
// }, return label;
// getExpressData() {
// getConfigKey(key).then(res => {
// if (res.msg) {
// this.experssList = JSON.parse(res.msg)
// } else {
// // this.list = [...defaultList]
// }
// })
// }
} }
} }
};
</script> </script>
<style lang="stylus"> <style lang="stylus">

View File

@ -248,7 +248,6 @@ import {
} from '@/api/oms/order'; } from '@/api/oms/order';
import AddressSelector from '@/views/components/AddressSelector/index.vue'; import AddressSelector from '@/views/components/AddressSelector/index.vue';
import dateUtil, { dateFormat } from '@/utils/DateUtil'; import dateUtil, { dateFormat } from '@/utils/DateUtil';
import { isStarRepo } from '@/utils/is-star-plugin';
import { useUserStore } from '@/store/modules/user'; import { useUserStore } from '@/store/modules/user';
export default { export default {
@ -363,17 +362,8 @@ export default {
} }
} }
}, },
async created() { mounted() {
const res = await isStarRepo( this.show = true;
'zccbbg',
'RuoYi-Mall',
this.userId,
'https://mall.ichengle.top/order/order',
'ruoyi-mall-商城',
'https://gitee.com/zccbbg/RuoYi-Mall'
);
this.show = res;
if (res) {
const { phone, status, today } = this.$route.query; const { phone, status, today } = this.$route.query;
if (phone) { if (phone) {
this.queryParams.userPhone = phone; this.queryParams.userPhone = phone;
@ -385,7 +375,6 @@ export default {
this.setToday(); this.setToday();
} }
this.getList(); this.getList();
}
}, },
methods: { methods: {
/** 日期组件设置为今天 */ /** 日期组件设置为今天 */

View File

@ -25,7 +25,7 @@ export default defineConfig(({ mode, command }) => {
proxy: { proxy: {
[env.VITE_APP_BASE_API]: { [env.VITE_APP_BASE_API]: {
// target: 'http://192.168.1.250:8080', // target: 'http://192.168.1.250:8080',
target: 'http://111.62.22.190:8080', target: 'http://192.168.1.250:8080',
changeOrigin: true, changeOrigin: true,
ws: true, ws: true,
rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), ''), rewrite: (path) => path.replace(new RegExp('^' + env.VITE_APP_BASE_API), ''),