Commit fc49f000cec9c18351f716e129e4fe3581ea5fe5

Authored by YunaiV
1 parent bddbedd7

trade:前端订单管理,联调接口

yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/enums/TerminalEnum.java
@@ -15,10 +15,12 @@ import java.util.Arrays; @@ -15,10 +15,12 @@ import java.util.Arrays;
15 @Getter 15 @Getter
16 public enum TerminalEnum implements IntArrayValuable { 16 public enum TerminalEnum implements IntArrayValuable {
17 17
18 - MINI_PROGRAM(1, "小程序"),  
19 - H5(2, "H5"),  
20 - IOS(3, "苹果"),  
21 - ANDROID(3, "安卓"),; 18 + WECHAT_MINI_PROGRAM(10, "微信小程序"),
  19 + WECHAT_WAP(11, "微信公众号"),
  20 + H5(20, "H5 网页"),
  21 + IOS(31, "苹果 App"),
  22 + ANDROID(32, "安卓 App"),
  23 + ;
22 24
23 public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TerminalEnum::getTerminal).toArray(); 25 public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TerminalEnum::getTerminal).toArray();
24 26
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java
@@ -45,7 +45,7 @@ public class TradeOrderDO extends BaseDO { @@ -45,7 +45,7 @@ public class TradeOrderDO extends BaseDO {
45 * 45 *
46 * 枚举 {@link TradeOrderTypeEnum} 46 * 枚举 {@link TradeOrderTypeEnum}
47 */ 47 */
48 - private Integer type; // TODO order_promotion_type 48 + private Integer type;
49 /** 49 /**
50 * 订单来源 50 * 订单来源
51 * 51 *
yudao-ui-admin/src/utils/dict.js
@@ -8,6 +8,7 @@ import store from '@/store' @@ -8,6 +8,7 @@ import store from '@/store'
8 export const DICT_TYPE = { 8 export const DICT_TYPE = {
9 USER_TYPE: 'user_type', 9 USER_TYPE: 'user_type',
10 COMMON_STATUS: 'common_status', 10 COMMON_STATUS: 'common_status',
  11 + TERMINAL: 'terminal',
11 12
12 // ========== SYSTEM 模块 ========== 13 // ========== SYSTEM 模块 ==========
13 SYSTEM_USER_SEX: 'system_user_sex', 14 SYSTEM_USER_SEX: 'system_user_sex',
yudao-ui-admin/src/views/mall/trade/order/index.vue
@@ -29,35 +29,29 @@ @@ -29,35 +29,29 @@
29 </el-col> 29 </el-col>
30 <el-col :span="6" :xs="24"> 30 <el-col :span="6" :xs="24">
31 <el-form-item label="订单来源"> 31 <el-form-item label="订单来源">
32 - <el-select v-model="queryParams.orderSource" clearable style="width: 240px">  
33 - <el-option v-for="dict in dicData.orderSource" v-bind="dict" :key="dict.value"/> 32 + <el-select v-model="queryParams.terminal" clearable style="width: 240px">
  33 + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.TERMINAL)"
  34 + :key="dict.value" :label="dict.label" :value="dict.value"/>
34 </el-select> 35 </el-select>
35 </el-form-item> 36 </el-form-item>
36 </el-col> 37 </el-col>
37 <el-col :span="6" :xs="24"> 38 <el-col :span="6" :xs="24">
38 - <el-form-item label="付款方式">  
39 - <el-select v-model="queryParams.payWay" clearable style="width: 240px">  
40 - <el-option v-for="dict in dicData.payWay" v-bind="dict" :key="dict.value"/>  
41 - </el-select>  
42 - </el-form-item>  
43 - </el-col>  
44 - <el-col :span="6" :xs="24">  
45 - <el-form-item label="营销类型">  
46 - <el-select v-model="queryParams.marketingType" clearable style="width: 240px">  
47 - <el-option v-for="dict in dicData.marketingType" v-bind="dict" :key="dict.value"/> 39 + <el-form-item label="支付方式">
  40 + <el-select v-model="queryParams.payChannelCode" clearable style="width: 240px">
  41 + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.PAY_CHANNEL_CODE_TYPE)"
  42 + :key="dict.value" :label="dict.label" :value="dict.value"/>
48 </el-select> 43 </el-select>
49 </el-form-item> 44 </el-form-item>
50 </el-col> 45 </el-col>
51 <el-col :span="6" :xs="24"> 46 <el-col :span="6" :xs="24">
52 <el-form-item label="下单时间"> 47 <el-form-item label="下单时间">
53 <el-date-picker v-model="queryParams.date" type="daterange" range-separator="至" 48 <el-date-picker v-model="queryParams.date" type="daterange" range-separator="至"
54 - start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="rangePickerOptions" style="width: 240px"/> 49 + start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="datePickerOptions" style="width: 240px"/>
55 </el-form-item> 50 </el-form-item>
56 </el-col> 51 </el-col>
57 <el-col :span="6" :xs="24" style="line-height: 32px"> 52 <el-col :span="6" :xs="24" style="line-height: 32px">
58 <el-button type="primary" icon="el-icon-search" size="mini">搜索</el-button> 53 <el-button type="primary" icon="el-icon-search" size="mini">搜索</el-button>
59 <el-button icon="el-icon-refresh" size="mini">重置</el-button> 54 <el-button icon="el-icon-refresh" size="mini">重置</el-button>
60 - <el-button icon="el-icon-document" size="mini">导出订单</el-button>  
61 </el-col> 55 </el-col>
62 </el-form> 56 </el-form>
63 </el-row> 57 </el-row>
@@ -66,61 +60,75 @@ @@ -66,61 +60,75 @@
66 <el-tabs v-model="activeTabName" type="card"> 60 <el-tabs v-model="activeTabName" type="card">
67 <el-tab-pane v-for="tabPane in tabPanes" :label="tabPane.text" :name="tabPane.name"> 61 <el-tab-pane v-for="tabPane in tabPanes" :label="tabPane.text" :name="tabPane.name">
68 <!-- table --> 62 <!-- table -->
69 - <el-table :data="tableData" :show-header="false" class="order-table"> 63 + <el-table :data="list" :show-header="false" class="order-table">
70 <el-table-column> 64 <el-table-column>
71 <template slot-scope="{ row }"> 65 <template slot-scope="{ row }">
72 <el-row type="flex" align="middle"> 66 <el-row type="flex" align="middle">
73 <el-col :span="5"> 67 <el-col :span="5">
74 - 订单号:{{row.orderNo}}  
75 - <el-popover title="支付流水号:" :content="row.orderNo" placement="right" width="200" trigger="click"> 68 + 订单号:{{row.no}}
  69 + <el-popover title="支付单号:" :content="row.payOrderId + ''" placement="right" width="200" trigger="click">
76 <el-button slot="reference" type="text">更多</el-button> 70 <el-button slot="reference" type="text">更多</el-button>
77 </el-popover> 71 </el-popover>
78 </el-col> 72 </el-col>
79 - <el-col :span="5">下单时间:{{row.time}}</el-col>  
80 - <el-col :span="4">订单来源:{{row.orderSource}}</el-col>  
81 - <el-col :span="4">支付方式:{{row.payWay}}</el-col> 73 + <el-col :span="5">下单时间:{{ parseTime(row.createTime) }}</el-col>
  74 + <el-col :span="4">订单来源:
  75 + <dict-tag :type="DICT_TYPE.TERMINAL" :value="row.terminal" />
  76 + </el-col>
  77 + <el-col :span="4">支付方式:
  78 + <dict-tag v-if="row.payChannelCode" :type="DICT_TYPE.PAY_CHANNEL_CODE_TYPE" :value="row.payChannelCode" />
  79 + <span v-else>未支付</span>
  80 + </el-col>
82 <el-col :span="6" align="right"> 81 <el-col :span="6" align="right">
83 - <el-button type="text">关闭订单</el-button>  
84 - <el-button type="text">修改地址</el-button>  
85 - <el-button type="text">调整价格</el-button> 82 + <el-button type="text" @click="goToDetail(row)">详情</el-button>
86 <el-dropdown style="margin-left: 10px"> 83 <el-dropdown style="margin-left: 10px">
87 <el-button type="text"> 84 <el-button type="text">
88 更多操作<i class="el-icon-arrow-down el-icon--right"></i> 85 更多操作<i class="el-icon-arrow-down el-icon--right"></i>
89 </el-button> 86 </el-button>
90 <el-dropdown-menu slot="dropdown"> 87 <el-dropdown-menu slot="dropdown">
91 - <el-dropdown-item><el-button type="text">打印发货单</el-button></el-dropdown-item>  
92 - <el-dropdown-item><el-button type="text" @click="goToDetail(row)">详情</el-button></el-dropdown-item> 88 + <!-- TODO @芋艿:【暂未开发】关闭订单 -->
  89 + <el-dropdown-item><el-button type="text">关闭订单</el-button></el-dropdown-item>
  90 + <!-- TODO @芋艿:【暂未开发】修改地址 -->
  91 + <el-dropdown-item><el-button type="text">修改地址</el-button></el-dropdown-item>
  92 + <!-- TODO @芋艿:【暂未开发】调整价格 -->
  93 + <el-dropdown-item><el-button type="text">调整价格</el-button></el-dropdown-item>
  94 + <!-- TODO @芋艿:【暂未开发】备注 -->
93 <el-dropdown-item><el-button type="text">备注</el-button></el-dropdown-item> 95 <el-dropdown-item><el-button type="text">备注</el-button></el-dropdown-item>
  96 + <!-- TODO @芋艿:【暂未开发】关闭订单 -->
  97 + <el-dropdown-item><el-button type="text">打印发货单</el-button></el-dropdown-item>
94 </el-dropdown-menu> 98 </el-dropdown-menu>
95 </el-dropdown> 99 </el-dropdown>
96 </el-col> 100 </el-col>
97 </el-row> 101 </el-row>
98 <!-- 订单下的商品 --> 102 <!-- 订单下的商品 -->
99 - <el-table :data="row.goods" border :show-header="true"> 103 + <el-table :data="row.items" border :show-header="true">
100 <el-table-column label="商品" prop="goods" header-align="center" width="auto" min-width="300"> 104 <el-table-column label="商品" prop="goods" header-align="center" width="auto" min-width="300">
101 <template slot-scope="{ row, $index }"> 105 <template slot-scope="{ row, $index }">
102 <div class="goods-info"> 106 <div class="goods-info">
103 - <img :src="row.picture"/>  
104 - <span class="ellipsis-2" :title="row.name">{{row.name}}</span> 107 + <img :src="row.picUrl"/>
  108 + <span class="ellipsis-2" :title="row.spuName">{{row.spuName}}</span>
  109 + <!-- TODO @小程:下面是商品属性,想当度一行,放在商品名下面 -->
  110 + <el-tag size="medium" v-for="property in row.properties">{{property.propertyName}}:{{property.valueName}}</el-tag>
105 </div> 111 </div>
106 </template> 112 </template>
107 </el-table-column> 113 </el-table-column>
108 <el-table-column label="单价(元)/数量" prop="fee" align="center" width="115"> 114 <el-table-column label="单价(元)/数量" prop="fee" align="center" width="115">
109 <template slot-scope="{ row }"> 115 <template slot-scope="{ row }">
110 - <div>{{row.price}}</div>  
111 - <div>{{row.count}}</div> 116 + <div>¥{{ (row.originalUnitPrice / 100.0).toFixed(2) }}</div>
  117 + <div>{{row.count}} 件</div>
112 </template> 118 </template>
113 </el-table-column> 119 </el-table-column>
114 - <el-table-column label="维权" prop="safeguard" align="center" width="100"/> 120 + <!-- TODO @小程:这里应该是一个订单下,多个商品,只展示订单上的总金额,就是 order.payPrice -->
115 <el-table-column label="实付金额(元)" prop="amount" align="center" width="100"/> 121 <el-table-column label="实付金额(元)" prop="amount" align="center" width="100"/>
  122 + <!-- TODO @小程:这里应该是一个订单下,多个商品,只展示订单上的收件信息;使用 order.receiverXXX 开头的字段 -->
116 <el-table-column label="买家/收货人" prop="buyer" header-align="center" width="auto" min-width="300"> 123 <el-table-column label="买家/收货人" prop="buyer" header-align="center" width="auto" min-width="300">
117 <template slot-scope="{ row }"> 124 <template slot-scope="{ row }">
  125 + <!-- TODO @芋艿:以后增加一个会员详情界面 -->
118 <div>{{row.buyer}}</div> 126 <div>{{row.buyer}}</div>
119 <div>{{row.receiver}}{{row.tel}}</div> 127 <div>{{row.receiver}}{{row.tel}}</div>
120 <div class="ellipsis-2" :title="row.address">{{row.address}}</div> 128 <div class="ellipsis-2" :title="row.address">{{row.address}}</div>
121 </template> 129 </template>
122 </el-table-column> 130 </el-table-column>
123 - <el-table-column label="配送方式" prop="sendWay" align="center" width="100"/> 131 + <!-- TODO @小程:这里应该是一个订单下,多个商品,交易状态是统一的;使用 order.status 字段 -->
124 <el-table-column label="交易状态" prop="status" align="center" width="100"/> 132 <el-table-column label="交易状态" prop="status" align="center" width="100"/>
125 </el-table> 133 </el-table>
126 </template> 134 </template>
@@ -132,7 +140,10 @@ @@ -132,7 +140,10 @@
132 </template> 140 </template>
133 141
134 <script> 142 <script>
135 - const dicData = { 143 +import { getOrderPage } from "@/api/mall/trade/order";
  144 +import { datePickerOptions } from "@/utils/constants";
  145 +
  146 +const dicData = {
136 searchType: [ 147 searchType: [
137 { label: '订单号', value: 'ddh' }, 148 { label: '订单号', value: 'ddh' },
138 { label: '交易流水号', value: 'jylsh' }, 149 { label: '交易流水号', value: 'jylsh' },
@@ -143,14 +154,6 @@ @@ -143,14 +154,6 @@
143 { label: '会员昵称', value: 'hync' }, 154 { label: '会员昵称', value: 'hync' },
144 { label: '商品编号', value: 'spbh' } 155 { label: '商品编号', value: 'spbh' }
145 ], 156 ],
146 - orderType: [  
147 - { label: '全部', value: 'qb' },  
148 - { label: '物流订单', value: 'wldd' },  
149 - { label: '自提订单', value: 'ztdd' },  
150 - { label: '外卖订单', value: 'wmdd' },  
151 - { label: '虚拟订单', value: 'xndd' },  
152 - { label: '收银订单', value: 'sydd' }  
153 - ],  
154 orderStatus: [ 157 orderStatus: [
155 { label: '全部', value: 'qb' }, 158 { label: '全部', value: 'qb' },
156 { label: '待支付', value: 'dzf' }, 159 { label: '待支付', value: 'dzf' },
@@ -161,75 +164,25 @@ @@ -161,75 +164,25 @@
161 { label: '已关闭', value: 'ygb' }, 164 { label: '已关闭', value: 'ygb' },
162 { label: '退款中', value: 'tkz' } 165 { label: '退款中', value: 'tkz' }
163 ], 166 ],
164 - orderSource: [  
165 - { label: '全部', value: 'qb' },  
166 - { label: '微信公众号', value: 'wxgzh' },  
167 - { label: '微信小程序', value: 'wxxcx' },  
168 - { label: 'PC', value: 'pc' },  
169 - { label: 'H5', value: 'h5' },  
170 - { label: 'APP', value: 'app' },  
171 - { label: '收银台', value: 'syt' },  
172 - { label: '代客下单', value: 'dkxd' }  
173 - ],  
174 - payWay: [  
175 - { label: '全部', value: 'qb' },  
176 - { label: '在线支付', value: 'zxzf' },  
177 - { label: '余额支付', value: 'yezf' },  
178 - { label: '线下支付', value: 'xxzf' },  
179 - { label: '积分兑换', value: 'jfdh' },  
180 - { label: '支付宝支付', value: 'zfbzf' },  
181 - { label: '微信支付', value: 'wxzf' }  
182 - ],  
183 - marketingType: [  
184 - { label: '全部', value: 'qb' },  
185 - { label: '一口价', value: 'ykj' },  
186 - { label: '专题', value: 'zt' },  
187 - { label: '团购', value: 'tg' },  
188 - { label: '拼团', value: 'pt' },  
189 - { label: '拼团返利', value: 'ptfl' },  
190 - { label: '盲盒', value: 'mh' },  
191 - { label: '砍价', value: 'kj' },  
192 - { label: '礼品卡优惠', value: 'lpkyh' },  
193 - { label: '秒杀', value: 'ms' },  
194 - { label: '积分兑换', value: 'jfdh' },  
195 - { label: '组合套餐', value: 'zhtc' },  
196 - { label: '预售', value: 'ys' }  
197 - ]  
198 - }  
199 - const rangePickerOptions = {  
200 - shortcuts: [{  
201 - text: '最近一周',  
202 - onClick(picker) {  
203 - const end = new Date();  
204 - const start = new Date();  
205 - start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);  
206 - picker.$emit('pick', [start, end]);  
207 - }  
208 - }, {  
209 - text: '最近一个月',  
210 - onClick(picker) {  
211 - const end = new Date();  
212 - const start = new Date();  
213 - start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);  
214 - picker.$emit('pick', [start, end]);  
215 - }  
216 - }, {  
217 - text: '最近三个月',  
218 - onClick(picker) {  
219 - const end = new Date();  
220 - const start = new Date();  
221 - start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);  
222 - picker.$emit('pick', [start, end]);  
223 - }  
224 - }]  
225 } 167 }
226 export default { 168 export default {
227 name: "index", 169 name: "index",
228 data () { 170 data () {
229 return { 171 return {
230 dicData, 172 dicData,
231 - rangePickerOptions, 173 + // 遮罩层
  174 + loading: true,
  175 + // 导出遮罩层
  176 + exportLoading: false,
  177 + // 显示搜索条件
  178 + showSearch: true,
  179 + // 总条数
  180 + total: 0,
  181 + // 交易售后列表
  182 + list: [],
232 queryParams: { 183 queryParams: {
  184 + pageNo: 1,
  185 + pageSize: 10,
233 searchType: 'ddh', 186 searchType: 'ddh',
234 orderType: '' 187 orderType: ''
235 }, 188 },
@@ -244,87 +197,31 @@ @@ -244,87 +197,31 @@
244 { text: '已关闭', name: 'closed' }, 197 { text: '已关闭', name: 'closed' },
245 { text: '退款中', name: 'refund' } 198 { text: '退款中', name: 'refund' }
246 ], 199 ],
247 - tableData: [  
248 - {  
249 - orderInfo: '',  
250 - orderNo: '20221026220424001',  
251 - payNo: '20221026220424001',  
252 - time: '2022-10-26 22:04:20',  
253 - orderSource: 'PC',  
254 - payWay: '微信支付',  
255 - goods: [  
256 - {  
257 - name: '颜衫短袖男polo衫夏季翻领衣服潮牌休闲上衣夏天翻领半袖男士t恤',  
258 - picture: 'https://b2c-v5-yanshi.oss-cn-hangzhou.aliyuncs.com/upload/1/common/images/20220723/20220723115621165854858145027_SMALL.webp',  
259 - price: '199',  
260 - count: '5件',  
261 - amount: 460,  
262 - safeguard: '主动退款',  
263 - buyer: '小明',  
264 - receiver: '小花',  
265 - tel: '15823655095',  
266 - address: '北京市-北京市-东城区 观音桥',  
267 - sendWay: '物流配送',  
268 - status: '已完成'  
269 - },  
270 - {  
271 - name: '颜衫短袖男polo衫夏季翻领衣服潮牌休闲上衣夏天翻领半袖男士t恤',  
272 - picture: 'https://b2c-v5-yanshi.oss-cn-hangzhou.aliyuncs.com/upload/1/common/images/20220723/20220723115621165854858145027_SMALL.webp',  
273 - price: '199',  
274 - count: '5件',  
275 - amount: 460,  
276 - safeguard: '主动退款',  
277 - buyer: '小明',  
278 - receiver: '小花',  
279 - tel: '15823655095',  
280 - address: '北京市-北京市-东城区 观音桥',  
281 - sendWay: '物流配送',  
282 - status: '已完成'  
283 - }  
284 - ]  
285 - },  
286 - {  
287 - orderInfo: '',  
288 - orderNo: '20221026220424001',  
289 - payNo: '20221026220424001',  
290 - time: '2022-10-26 22:04:20',  
291 - orderSource: 'PC',  
292 - payWay: '微信支付',  
293 - goods: [  
294 - {  
295 - name: '颜衫短袖男polo衫夏季翻领衣服潮牌休闲上衣夏天翻领半袖男士t恤',  
296 - picture: 'https://b2c-v5-yanshi.oss-cn-hangzhou.aliyuncs.com/upload/1/common/images/20220723/20220723115621165854858145027_SMALL.webp',  
297 - price: '199',  
298 - count: '5件',  
299 - amount: 460,  
300 - safeguard: '主动退款',  
301 - buyer: '小明',  
302 - receiver: '小花',  
303 - tel: '15823655095',  
304 - address: '北京市-北京市-东城区 观音桥',  
305 - sendWay: '物流配送',  
306 - status: '已完成'  
307 - },  
308 - {  
309 - name: '颜衫短袖男polo衫夏季翻领衣服潮牌休闲上衣夏天翻领半袖男士t恤',  
310 - picture: 'https://b2c-v5-yanshi.oss-cn-hangzhou.aliyuncs.com/upload/1/common/images/20220723/20220723115621165854858145027_SMALL.webp',  
311 - price: '199',  
312 - count: '5件',  
313 - amount: 460,  
314 - safeguard: '主动退款',  
315 - buyer: '小明',  
316 - receiver: '小花',  
317 - tel: '15823655095',  
318 - address: '北京市-北京市-东城区 观音桥',  
319 - sendWay: '物流配送',  
320 - status: '已完成'  
321 - }  
322 - ]  
323 - }  
324 - ] 200 + // 静态变量
  201 + datePickerOptions: datePickerOptions
325 } 202 }
326 }, 203 },
  204 + created() {
  205 + this.getList();
  206 + // 设置 statuses 过滤
  207 + // for (const dict of getDictDatas(DICT_TYPE.TRADE_AFTER_SALE_STATUS)) {
  208 + // this.statusTabs.push({
  209 + // label: dict.label,
  210 + // value: dict.value
  211 + // })
  212 + // }
  213 + },
327 methods: { 214 methods: {
  215 + /** 查询列表 */
  216 + getList() {
  217 + this.loading = true;
  218 + // 执行查询
  219 + getOrderPage(this.queryParams).then(response => {
  220 + this.list = response.data.list;
  221 + this.total = response.data.total;
  222 + this.loading = false;
  223 + });
  224 + },
328 goToDetail (row) { 225 goToDetail (row) {
329 this.$router.push({ path: '/mall/trade/order/detail', query: { orderNo: row.orderNo }}) 226 this.$router.push({ path: '/mall/trade/order/detail', query: { orderNo: row.orderNo }})
330 } 227 }