index.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893
  1. <template>
  2. <div class="app-container">
  3. <el-page-header @back="goBack" content="订单详情"></el-page-header>
  4. <div class="order-main">
  5. <el-row style="padding: 15px 15px 10px">
  6. <el-col :span="24">
  7. <div class="order-main-title">
  8. <span>订单编号:{{ orderDetail.orderId }}</span>
  9. <span>下单时间:{{ orderDetail.createTime }}</span>
  10. <span>商户:{{ orderDetail.companyWechatName || '无' }}</span>
  11. <span>网点:{{ orderDetail.websitName || '无' }}</span>
  12. <div class="fr">
  13. <el-link type="primary" :underline="false" @click="showDialog('remark')">订单备注</el-link>
  14. </div>
  15. </div>
  16. </el-col>
  17. </el-row>
  18. <div style="width: 100%; padding: 10px 15px 15px 15px">
  19. <el-row>
  20. <el-col :span="8" style="border-right: 1px solid #e8e8e8;">
  21. <div class="order-main-status">
  22. <span>{{ orderDetail.orderStatus | ORDER_CURRENT_STATUS_FILTER }}</span>
  23. </div>
  24. <div class="order-main-opt-btn">
  25. <template v-if="orderDetail.orderStatus === 'NOPAY'">
  26. <el-popconfirm title="确定收款吗?" @confirm="confirmOrder">
  27. <el-button slot="reference" size="small">确认收款</el-button>
  28. </el-popconfirm>
  29. <el-button size="small" @click="showDialog('price')" style="margin-left: 10px;">修改价格</el-button>
  30. <el-popconfirm title="确定取消订单吗?" @confirm="cancelOrder" style="margin-left: 10px;">
  31. <el-button slot="reference" size="small" type="danger">取消订单</el-button>
  32. </el-popconfirm>
  33. </template>
  34. <template v-if="orderDetail.orderStatus === 'DFH'">
  35. <el-button size="small" type="primary" @click="showDialog('send')">发货</el-button>
  36. <el-popconfirm title="确定取消订单吗?" @confirm="cancelOrder" style="margin-left: 10px;">
  37. <el-button slot="reference" size="small" type="danger">取消订单</el-button>
  38. </el-popconfirm>
  39. </template>
  40. <template v-if="orderDetail.orderStatus === 'YFH' || orderDetail.orderStatus === 'OVER'">
  41. <el-button size="small" @click="showDialog('query')">查看物流</el-button>
  42. </template>
  43. </div>
  44. </el-col>
  45. <el-col :span="16" style="padding-top: 10px;">
  46. <el-steps :active="orderDetail.orderStatus != 'CLOSE' ? curOrderStatus : -1" align-center>
  47. <el-step title="买家下单" :description="orderDetail.createTime"></el-step>
  48. <el-step title="买家付款" :description="orderDetail.payTime ? orderDetail.payTime : ''"></el-step>
  49. <el-step title="商家发货" :description="orderDetail.deliverTime ? orderDetail.deliverTime : ''"></el-step>
  50. <el-step title="交易成功" :description="orderDetail.overTime ? orderDetail.overTime : ''"></el-step>
  51. </el-steps>
  52. </el-col>
  53. </el-row>
  54. </div>
  55. </div>
  56. <div class="order-receive-info" style="padding-bottom: 15px;">
  57. <el-row :gutter="30">
  58. <el-col :xs="24" :sm="12" :lg="12">
  59. <div class="main-detail">
  60. <div class="title">订单信息</div>
  61. <div class="item">
  62. <div class="label">收货人信息:</div>
  63. <div class="value">{{ orderDetail.receUserName }} ({{ orderDetail.recePhone }})</div>
  64. </div>
  65. <div class="item">
  66. <div class="label">收货人地址:</div>
  67. <div class="value">{{ orderDetail.province + orderDetail.city + orderDetail.area + orderDetail.street +
  68. orderDetail.receAddress + orderDetail.houseNo }}</div>
  69. </div>
  70. <div class="item">
  71. <div class="label">销售员信息:</div>
  72. <div class="value">{{ orderDetail.workerName }} ({{ orderDetail.workerPhone }})</div>
  73. </div>
  74. <div class="item">
  75. <div class="label">团长信息:</div>
  76. <div class="value">{{ orderDetail.promotionGroupUserName }} ({{ orderDetail.promotionGroupMobile }})</div>
  77. </div>
  78. <div class="item">
  79. <div class="label">下单渠道:</div>
  80. <div class="value">{{ orderDetail.source }}</div>
  81. </div>
  82. <div class="item">
  83. <div class="label">支付方式:</div>
  84. <div class="value">{{ orderDetail.payType }}</div>
  85. </div>
  86. <div class="item">
  87. <div class="label">是否开票:</div>
  88. <div class="value">{{ orderDetail.tax ? '是' : '否' }}</div>
  89. </div>
  90. <div class="item" v-if="orderDetail.dispatchType">
  91. <div class="label">工单派单方式:</div>
  92. <div class="value">{{ orderDetail.dispatchType }}</div>
  93. </div>
  94. </div>
  95. </el-col>
  96. <el-col :xs="24" :sm="12" :lg="12" v-if="orderDetail.orderStatus === 'YFH' || orderDetail.orderStatus === 'OVER'">
  97. <div class="main-detail">
  98. <div class="title">物流信息</div>
  99. <div class="item">
  100. <div class="label">快递单号:</div>
  101. <div class="value">{{ orderDetail.logisticsNo }}</div>
  102. </div>
  103. <div class="item">
  104. <div class="label">快递公司:</div>
  105. <div class="value">{{ orderDetail.companyName }}</div>
  106. </div>
  107. <div class="item">
  108. <div class="label">货件仓储:</div>
  109. <div class="value">{{ orderDetail.storageName }}</div>
  110. </div>
  111. </div>
  112. </el-col>
  113. </el-row>
  114. </div>
  115. <div class="order-detail" v-if="compensateList.length > 0" style="margin-bottom: 20px;">
  116. <!-- 理赔表格 -->
  117. <el-table :data="compensateList" style="width: 100%;" size="small" border>
  118. <el-table-column prop="goodsName" label="理赔商品" align="center"></el-table-column>
  119. <el-table-column prop="num" label="理赔数量" align="center"></el-table-column>
  120. <el-table-column prop="createTime" label="理赔时间" align="center"></el-table-column>
  121. <el-table-column prop="refundAmount" label="理赔金额" align="center"></el-table-column>
  122. <el-table-column prop="operatorUser" label="操作人" align="center"></el-table-column>
  123. <el-table-column prop="remark" label="备注" align="center"></el-table-column>
  124. </el-table>
  125. </div>
  126. <div class="order-detail">
  127. <!-- 订单表格 -->
  128. <el-table :data="orderDetail.orderDetails" style="width: 100%" border>
  129. <el-table-column label="商品信息" min-width="200">
  130. <template slot-scope="scope">
  131. <el-row>
  132. <el-col :span="6">
  133. <el-image style="width: 40px; height: 40px" :src="scope.row.imgUrl">
  134. <div slot="error" class="image-slot">
  135. <i class="el-icon-picture-outline"></i>
  136. </div>
  137. </el-image>
  138. </el-col>
  139. <el-col :span="18">
  140. <div>{{ scope.row.goodsName }}</div>
  141. </el-col>
  142. </el-row>
  143. </template>
  144. </el-table-column>
  145. <el-table-column prop="goodsSpecName" label="规格" align="center"></el-table-column>
  146. <el-table-column prop="price" label="单价" align="center"></el-table-column>
  147. <el-table-column prop="num" label="数量" align="center"></el-table-column>
  148. <el-table-column prop="shareAmount" label="分销金额" align="center">
  149. <template slot-scope="scope">
  150. {{ orderDetail.workerId || orderDetail.promotionGroupUserId ? scope.row.shareAmount : '0' }}
  151. </template>
  152. </el-table-column>
  153. <el-table-column prop="discountAmount" label="优惠金额" align="center"></el-table-column>
  154. <!-- <el-table-column prop="zkAmount" label="折扣优惠" align="center"></el-table-column> -->
  155. <el-table-column prop="applyAmount" label="优惠价格申请" align="center" min-width="110"></el-table-column>
  156. <el-table-column prop="profitAmount" label="预计盈利" align="center">
  157. <template slot-scope="scope">
  158. {{ orderDetail.workerId || orderDetail.promotionGroupUserId ? scope.row.profitAmount : scope.row.payAmount }}
  159. </template>
  160. </el-table-column>
  161. <el-table-column prop="payAmount" label="商品总金额" align="center" min-width="100"></el-table-column>
  162. <el-table-column prop="freight" label="运费" align="center"></el-table-column>
  163. <el-table-column prop="refundNum" label="退款数量" align="center"></el-table-column>
  164. <el-table-column prop="refundAmount" label="退款金额" align="center"></el-table-column>
  165. <el-table-column label="操作" align="center" width="160" v-if="orderDetail.orderStatus != 'CLOSE'">
  166. <template slot-scope="scope">
  167. <el-button v-if="!~['TIMEOUT', 'CLOSE'].indexOf(orderDetail.orderStatus)" size="mini" type="primary"
  168. @click="handleRefund(scope.row)"
  169. :disabled="!orderDetail.refundAble || scope.row.refundNum >= scope.row.num">退款</el-button>
  170. <el-button v-if="!~['TIMEOUT'].indexOf(orderDetail.orderStatus)" size="mini"
  171. @click="handleCompensate(scope.row)">理赔</el-button>
  172. </template>
  173. </el-table-column>
  174. </el-table>
  175. <div class="order-amount-info">
  176. <el-row>
  177. <el-col :span="19">
  178. <div style="width: 1px;height: 1px;"></div>
  179. </el-col>
  180. <el-col :span="5">
  181. <div style="padding-bottom: 10px;">商品总价:¥ {{ orderDetail.totalAmount }}</div>
  182. <div style="padding-bottom: 10px;">运费:¥ {{ orderDetail.freight }}</div>
  183. <div style="padding-bottom: 10px;" v-if="orderDetail.discountAmount">
  184. 优惠:¥ {{ orderDetail.discountAmount }}
  185. <span v-if="orderDetail.exchangeCode">(优惠码:{{ orderDetail.exchangeCode }})</span>
  186. <span v-if="orderDetail.promotionDiscountRate">({{ orderDetail.promotionDiscountRate * 10 }}折)</span>
  187. </div>
  188. <div style="font-size: 14px;">
  189. <span style="padding-right: 15px;">实际收款</span><span style="color: red;font-size: 18px;">¥ {{
  190. orderDetail.payAmount }}</span>
  191. </div>
  192. </el-col>
  193. </el-row>
  194. </div>
  195. </div>
  196. <div class="order-evaluate-info" v-if="evaluateDetail">
  197. <div class="title">
  198. <div class="left">评价信息<span>{{ evaluateDetail.createTime }}</span></div>
  199. <div class="right">
  200. <span>是否客户端展示</span>
  201. <el-switch v-model="evaluateDetail.isShow" @change="changeShow"></el-switch>
  202. </div>
  203. </div>
  204. <div class="main">
  205. <div class="rate-list">
  206. <div style="display: flex; align-items: center; margin-bottom: 5px;">商品质量:<el-rate
  207. :value="evaluateDetail.commentGoods" disabled disabled-void-color="#DDDDDD"></el-rate></div>
  208. <div style="display: flex; align-items: center; margin-bottom: 5px;">服务质量:<el-rate
  209. :value="evaluateDetail.commentService" disabled disabled-void-color="#DDDDDD"></el-rate></div>
  210. <div style="display: flex; align-items: center;">配送质量:<el-rate :value="evaluateDetail.commentExpress" disabled
  211. disabled-void-color="#DDDDDD"></el-rate></div>
  212. </div>
  213. <div class="tag-list" v-if="orderDetail.orderCommentTags && orderDetail.orderCommentTags.length > 0">
  214. <el-tag v-for="(item, index) in orderDetail.orderCommentTags" :key="index">{{ item }}</el-tag>
  215. </div>
  216. </div>
  217. <div class="content">{{ evaluateDetail.content }}</div>
  218. <div class="img-list" v-if="orderDetail.orderCommentImgs && orderDetail.orderCommentImgs.length > 0">
  219. <el-image v-for="(item, index) in orderDetail.orderCommentImgs" :key="index" :src="item"
  220. :preview-src-list="orderDetail.orderCommentImgs" fit="cover"></el-image>
  221. </div>
  222. </div>
  223. <el-dialog :title="dialogTitle" :visible.sync="remarkVisible" :show-close="false" :width="dialogWidth"
  224. :close-on-click-modal="false">
  225. <el-form :model="orderForm" :rules="orderFormRules" ref="orderForm" v-if="curOpenDialogType !== 'query'"
  226. label-width="90px" label-position="left">
  227. <el-form-item prop="remark" v-if="curOpenDialogType === 'remark'">
  228. <el-input type="textarea" :autosize="{ minRows: 8, maxRows: 16 }" placeholder="请输入备注内容" v-model="remark"
  229. maxlength="100" show-word-limit>
  230. </el-input>
  231. </el-form-item>
  232. <el-form-item prop="payAmount" v-if="curOpenDialogType === 'price'">
  233. <el-input v-model="orderForm.payAmount" autocomplete="off" placeholder="请输入价格"></el-input>
  234. </el-form-item>
  235. <el-form-item label="收货人" prop="receUserName" v-if="curOpenDialogType === 'info'">
  236. <el-input v-model="orderForm.receUserName" autocomplete="off" placeholder="请输入收货人"></el-input>
  237. </el-form-item>
  238. <el-form-item label="收货电话" prop="recePhone" v-if="curOpenDialogType === 'info'">
  239. <el-input v-model="orderForm.recePhone" autocomplete="off" placeholder="请输入收货电话"></el-input>
  240. </el-form-item>
  241. <el-form-item label="收货地址" prop="receAddress" v-if="curOpenDialogType === 'info'">
  242. <el-input v-model="orderForm.receAddress" autocomplete="off" placeholder="请输入收货地址"></el-input>
  243. </el-form-item>
  244. <el-form-item label="快递单号" prop="logisticsNo" v-if="curOpenDialogType === 'send'">
  245. <el-input v-model="orderForm.logisticsNo" autocomplete="off" placeholder="请输入快递单号"></el-input>
  246. </el-form-item>
  247. <el-form-item label="物流公司" prop="companyCode" v-if="curOpenDialogType === 'send'">
  248. <el-select v-model="orderForm.companyCode" placeholder="请选择物流公司" style="width: 100%;">
  249. <el-option :label="item.name" :value="item.code" v-for="(item, index) in companyList"
  250. :key="index"></el-option>
  251. </el-select>
  252. </el-form-item>
  253. <el-form-item label="仓储" prop="storageId" v-if="curOpenDialogType === 'send'">
  254. <el-select v-model="orderForm.storageId" placeholder="请选择仓储" style="width: 100%;">
  255. <el-option :label="item.storageName" :value="item.storageId" v-for="(item, index) in storageList"
  256. :key="index"></el-option>
  257. </el-select>
  258. </el-form-item>
  259. <el-form-item label="是否派单" prop="workOrder" v-if="curOpenDialogType === 'send'">
  260. <el-radio-group v-model="orderForm.workOrder">
  261. <el-radio :label="true">是</el-radio>
  262. <el-radio :label="false">否</el-radio>
  263. </el-radio-group>
  264. </el-form-item>
  265. </el-form>
  266. <el-table v-loading="logisticsLoading" :data="logistics" style="width: 100%" size="mini"
  267. v-if="curOpenDialogType === 'query'">
  268. <el-table-column prop="comName" label="物流公司" align="center"></el-table-column>
  269. <el-table-column prop="areaName" label="地区名称" align="center"></el-table-column>
  270. <el-table-column prop="time" label="物流时间" align="center"></el-table-column>
  271. <el-table-column prop="state" label="物流状态" align="center">
  272. <template slot-scope="scope">
  273. {{ scope.row.state | EXPRESS_CURRENT_STATE_FILTER }}
  274. </template>
  275. </el-table-column>
  276. <el-table-column prop="context" label="物流详情" align="center"></el-table-column>
  277. </el-table>
  278. <div slot="footer" class="dialog-footer">
  279. <el-button type="primary" @click="saveForm" v-if="curOpenDialogType !== 'query'">保 存</el-button>
  280. <el-button @click="cancelForm">{{ curOpenDialogType === 'query' ? '关 闭' : '取 消' }}</el-button>
  281. </div>
  282. </el-dialog>
  283. <el-dialog title="理赔" :visible.sync="compensateFormVisible" width="30%" :close-on-click-modal="false">
  284. <el-form ref="compensateForm" :model="compensateForm" :rules="compensateFormRules" label-position="left">
  285. <el-form-item label="理赔数量" prop="num">
  286. <el-input v-model="compensateForm.num" autocomplete="off"></el-input>
  287. </el-form-item>
  288. <el-form-item label="理赔金额" prop="amount">
  289. <el-input v-model="compensateForm.amount" autocomplete="off"></el-input>
  290. </el-form-item>
  291. <el-form-item label="备注" prop="remark">
  292. <el-input v-model="compensateForm.remark" autocomplete="off" type="textarea" :rows="3"></el-input>
  293. </el-form-item>
  294. </el-form>
  295. <div slot="footer" class="dialog-footer">
  296. <el-button @click="cancelCompensateForm">取 消</el-button>
  297. <el-button type="primary" @click="submitCompensateForm">确 定</el-button>
  298. </div>
  299. </el-dialog>
  300. </div>
  301. </template>
  302. <script>
  303. import {
  304. cancelOrder,
  305. changePrice,
  306. changeReceiveInfo,
  307. confirmOrder,
  308. getOrderDetail, goodsDeliver,
  309. saveRemark, orderRefund, orderCompensate, getCompensateList,
  310. changeShow
  311. } from "@/api/order";
  312. import { getExpress, getCompanyList } from "@/api/common";
  313. import * as Storage from "@/api/storage";
  314. import { mapGetters } from 'vuex'
  315. export default {
  316. name: "detail",
  317. data() {
  318. return {
  319. orderId: '',
  320. orderDetail: {},
  321. evaluateDetail: null,
  322. dialogTitle: '',
  323. remarkVisible: false,
  324. remark: '',
  325. price: 0,
  326. orderForm: {
  327. orderId: '',
  328. payAmount: '',
  329. receAddress: '',
  330. receUserName: '',
  331. recePhone: '',
  332. logisticsNo: '',
  333. companyCode: '',
  334. workOrder: true,
  335. },
  336. orderFormRules: {
  337. payAmount: [
  338. {
  339. validator: (rule, value, callback) => {
  340. if (this.curOpenDialogType !== 'price') {
  341. callback()
  342. } else {
  343. if (!value) {
  344. callback(new Error('请输入价格'))
  345. } else {
  346. if (!this.isNumber(value)) {
  347. callback(new Error('请输入数字值'))
  348. } else {
  349. callback()
  350. }
  351. }
  352. }
  353. }, trigger: 'blur'
  354. }
  355. ],
  356. receUserName: [
  357. { require: true, message: '请输入收货人', trigger: 'blur' }
  358. ],
  359. recePhone: [
  360. { require: true, message: '请输入收货电话', trigger: 'blur' }
  361. ],
  362. receAddress: [
  363. { require: true, message: '请输入收货地址', trigger: 'blur' }
  364. ],
  365. logisticsNo: [
  366. {
  367. validator: (rule, value, callback) => {
  368. if (this.curOpenDialogType !== 'send') {
  369. callback()
  370. } else {
  371. if (!value) {
  372. callback(new Error('请输入快递单号'))
  373. } else {
  374. callback()
  375. }
  376. }
  377. }, trigger: 'blur'
  378. }
  379. ],
  380. storageId: [
  381. {
  382. validator: (rule, value, callback) => {
  383. if (this.curOpenDialogType !== 'send') {
  384. callback()
  385. } else {
  386. if (!value) {
  387. callback(new Error('请选择仓储'))
  388. } else {
  389. callback()
  390. }
  391. }
  392. }, trigger: 'change'
  393. }
  394. ],
  395. companyCode: [
  396. {
  397. validator: (rule, value, callback) => {
  398. if (this.curOpenDialogType !== 'send') {
  399. callback()
  400. } else {
  401. if (!value) {
  402. callback(new Error('请选择快递公司'))
  403. } else {
  404. callback()
  405. }
  406. }
  407. }, trigger: 'change'
  408. }
  409. ]
  410. },
  411. curOpenDialogType: 'order',
  412. logistics: [],
  413. storageList: [],
  414. dialogWidth: '50%',
  415. logisticsLoading: false,
  416. companyList: [],
  417. compensateFormVisible: false,
  418. compensateForm: {
  419. id: null,
  420. num: '',
  421. amount: '',
  422. remark: '',
  423. },
  424. compensateFormRules: {
  425. num: [
  426. { required: true, message: '请输入理赔数量', trigger: 'blur' },
  427. {
  428. validator: (rule, value, callback) => {
  429. if (value > (this.compensateItem.num - this.compensateItem.refundNum)) {
  430. callback(new Error('最多还可以理赔' + (this.compensateItem.num - this.compensateItem.refundNum) + '件商品'));
  431. } else {
  432. callback();
  433. }
  434. }, trigger: 'blur'
  435. }
  436. ],
  437. amount: [
  438. { required: true, message: '请输入理赔金额', trigger: 'blur' },
  439. ]
  440. },
  441. compensateItem: {
  442. num: '',
  443. refundNum: '',
  444. },
  445. compensateList: [],
  446. }
  447. },
  448. created() {
  449. this.orderId = this.$route.query.orderId
  450. this.getDetail();
  451. this.getStorageList();
  452. this.getCompanyList();
  453. this.getCompensateList();
  454. },
  455. methods: {
  456. getDetail() {
  457. getOrderDetail({ orderId: this.orderId }).then((res) => {
  458. this.orderDetail = res.data
  459. this.orderDetail.workerName = this.orderDetail.workerName ? this.orderDetail.workerName : '暂无'
  460. this.orderDetail.workerPhone = this.orderDetail.workerPhone ? this.orderDetail.workerPhone : ''
  461. this.evaluateDetail = res.data.orderComment;
  462. })
  463. },
  464. showDialog(type) {
  465. this.dialogWidth = type === 'query' ? '80%' : '50%'
  466. this.remarkVisible = true
  467. this.curOpenDialogType = type
  468. if (type === 'remark') {
  469. this.dialogTitle = '订单备注'
  470. this.remark = this.orderDetail.remark
  471. } else if (type === 'price') {
  472. this.dialogTitle = '修改价格'
  473. this.orderForm.payAmount = this.orderDetail.payAmount
  474. } else if (type === 'info') {
  475. this.dialogTitle = '收货人信息'
  476. this.orderForm.receUserName = this.orderDetail.receUserName
  477. this.orderForm.recePhone = this.orderDetail.recePhone
  478. this.orderForm.receAddress = this.orderDetail.receAddress
  479. } else if (type === 'send') {
  480. this.dialogTitle = '发货信息'
  481. } else if (type === 'query') {
  482. this.logisticsLoading = true
  483. this.dialogTitle = '物流信息'
  484. getExpress({
  485. logisticsNo: this.orderDetail.logisticsNo,
  486. companyCode: this.orderDetail.companyCode
  487. }).then(res => {
  488. this.logistics = res.data
  489. this.logisticsLoading = false
  490. })
  491. }
  492. },
  493. cancelForm() {
  494. this.remarkVisible = false
  495. if (this.curOpenDialogType === 'query') {
  496. return
  497. }
  498. this.$refs.orderForm.resetFields()
  499. if (this.curOpenDialogType === 'remark') {
  500. this.remark = ''
  501. } else if (this.curOpenDialogType === 'price') {
  502. this.price = ''
  503. }
  504. },
  505. saveForm() {
  506. const params = {
  507. orderId: this.orderId
  508. }
  509. if (this.curOpenDialogType === 'remark') {
  510. params.remark = this.remark
  511. saveRemark(params).then(() => {
  512. this.cancelForm();
  513. this.getDetail();
  514. this.$successMsg('保存成功');
  515. })
  516. } else if (this.curOpenDialogType === 'price') {
  517. params.price = this.orderForm.payAmount
  518. this.$refs.orderForm.validate((valid) => {
  519. if (valid) {
  520. changePrice(params).then(() => {
  521. this.cancelForm();
  522. this.getDetail();
  523. this.$successMsg('保存成功');
  524. })
  525. }
  526. })
  527. } else if (this.curOpenDialogType === 'info') {
  528. params.receUserName = this.orderForm.receUserName
  529. params.recePhone = this.orderForm.recePhone
  530. params.receAddress = this.orderForm.receAddress
  531. params.orderStatus = this.orderDetail.orderStatus
  532. this.$refs.orderForm.validate((valid) => {
  533. if (valid) {
  534. changeReceiveInfo(params).then(() => {
  535. this.cancelForm();
  536. this.getDetail();
  537. this.$successMsg('保存成功');
  538. })
  539. }
  540. })
  541. } else if (this.curOpenDialogType === 'send') {
  542. params.logisticsNo = this.orderForm.logisticsNo
  543. params.storageId = this.orderForm.storageId
  544. params.companyCode = this.orderForm.companyCode
  545. params.workOrder = this.orderForm.workOrder
  546. this.$refs.orderForm.validate((valid) => {
  547. if (valid) {
  548. goodsDeliver(params).then(() => {
  549. this.cancelForm();
  550. this.getDetail();
  551. this.$successMsg('保存成功');
  552. })
  553. }
  554. })
  555. }
  556. },
  557. cancelOrder() {
  558. cancelOrder({ orderId: this.orderId }).then(() => {
  559. this.getDetail();
  560. this.$successMsg('取消成功');
  561. })
  562. },
  563. confirmOrder() {
  564. confirmOrder({ orderId: this.orderId }).then(() => {
  565. this.getDetail();
  566. this.$successMsg('确认收款成功');
  567. })
  568. },
  569. goBack() {
  570. // this.$router.go(-1);
  571. this.$router.push({
  572. name:"order_list"
  573. })
  574. },
  575. isNumber(val) {
  576. const regPos = /^\d+(\.\d+)?$/
  577. const regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/
  578. if (regPos.test(val) || regNeg.test(val)) {
  579. return true
  580. } else {
  581. return false
  582. }
  583. },
  584. getStorageList() {
  585. Storage.getList({ pageNum: 1, pageSize: 100 }).then(res => {
  586. this.storageList = res.data.records
  587. })
  588. },
  589. // 获取物流公司列表
  590. getCompanyList() {
  591. getCompanyList().then(res => {
  592. this.companyList = res.data;
  593. })
  594. },
  595. // 退款
  596. handleRefund(row) {
  597. console.log(row);
  598. if (row.num == 1) {
  599. this.$confirm('此操作将退款此商品, 是否继续?', '退款', {
  600. confirmButtonText: '确定',
  601. cancelButtonText: '取消',
  602. type: 'warning'
  603. }).then(() => {
  604. this.orderRefund(1, row.orderDetailId);
  605. }).catch(() => { });
  606. }
  607. else {
  608. this.$prompt('请输入退款数量', '退款', {
  609. confirmButtonText: '确定',
  610. cancelButtonText: '取消',
  611. inputValidator: function (value) {
  612. if (!value) return '请输入退款数量';
  613. if (value == 0) return '退款数量不能小于1';
  614. if (value > (row.num - row.refundNum)) {
  615. return '最多还可以退款' + (row.num - row.refundNum) + '件商品'
  616. }
  617. },
  618. }).then(({ value }) => {
  619. this.orderRefund(value, row.orderDetailId);
  620. }).catch(() => { });
  621. }
  622. },
  623. // 退款
  624. orderRefund(num, id) {
  625. orderRefund({
  626. num: num,
  627. orderDetailId: id,
  628. }).then(res => {
  629. this.getDetail();
  630. this.$successMsg('退款成功');
  631. })
  632. },
  633. // 理赔
  634. handleCompensate(row) {
  635. this.compensateFormVisible = true;
  636. this.compensateForm.id = row.orderDetailId;
  637. this.compensateItem.num = row.num;
  638. this.compensateItem.refundNum = row.refundNum;
  639. },
  640. // 取消 理赔
  641. cancelCompensateForm() {
  642. this.compensateFormVisible = false;
  643. this.compensateForm = {
  644. id: null,
  645. num: '',
  646. amount: '',
  647. remark: '',
  648. }
  649. },
  650. // 提交 理赔
  651. submitCompensateForm() {
  652. this.$refs.compensateForm.validate((valid) => {
  653. if (valid) {
  654. let params = {
  655. adminUserId: this.userid,
  656. orderDetailId: this.compensateForm.id,
  657. num: this.compensateForm.num,
  658. refundAmount: this.compensateForm.amount,
  659. remark: this.compensateForm.remark,
  660. }
  661. orderCompensate(params).then(res => {
  662. this.cancelCompensateForm();
  663. this.getDetail();
  664. this.getCompensateList();
  665. this.$successMsg('理赔成功');
  666. })
  667. }
  668. });
  669. },
  670. // 获取理赔列表
  671. getCompensateList() {
  672. getCompensateList({ orderId: this.orderId }).then(res => {
  673. this.compensateList = res.data;
  674. })
  675. },
  676. // 切换评价信息是否显示
  677. changeShow() {
  678. changeShow({
  679. isShow: this.evaluateDetail.isShow,
  680. orderId: this.orderId,
  681. }).then(res => {
  682. this.getDetail();
  683. this.$successMsg();
  684. })
  685. }
  686. },
  687. computed: {
  688. ...mapGetters([
  689. 'userid',
  690. 'name'
  691. ]),
  692. curOrderStatus() {
  693. switch (this.orderDetail.orderStatus) {
  694. case 'NOPAY':
  695. return 1
  696. break;
  697. case 'DFH':
  698. return 2
  699. break;
  700. case 'YFH':
  701. return 3
  702. break;
  703. case 'OVER':
  704. return 4
  705. break;
  706. default:
  707. return 1
  708. }
  709. },
  710. totalAmountCompute() {
  711. if (!this.orderDetail.totalAmount) {
  712. return 0
  713. }
  714. const totalAmount = parseFloat(this.orderDetail.totalAmount)
  715. const freight = parseFloat(this.orderDetail.freight)
  716. return (totalAmount - freight).toFixed(2)
  717. }
  718. }
  719. }
  720. </script>
  721. <style scoped lang="scss">
  722. .order-main {
  723. margin-top: 15px;
  724. border: 1px solid #e5e5e5;
  725. .order-main-title {
  726. font-size: 14px;
  727. }
  728. .order-main-title span {
  729. margin-right: 15px;
  730. }
  731. .order-main-status {
  732. padding: 15px 0;
  733. font-size: 24px;
  734. color: #409EFF;
  735. }
  736. .order-main-opt-btn {
  737. padding: 15px 0;
  738. }
  739. }
  740. .order-receive-info {
  741. margin: 15px 0;
  742. padding: 15px;
  743. background: #f5f7fa;
  744. :first-child div span {
  745. padding-right: 15px;
  746. }
  747. .el-row {
  748. padding-top: 15px;
  749. }
  750. }
  751. .order-detail {
  752. background: #f5f7fa;
  753. .order-amount-info {
  754. padding: 15px 0;
  755. font-size: 12px;
  756. font-weight: bold;
  757. }
  758. ::v-deep .el-table tr,
  759. ::v-deep .el-table th {
  760. background-color: #f5f7fa;
  761. }
  762. }
  763. .main-detail {
  764. .title {
  765. font-size: 16px;
  766. font-weight: 700;
  767. margin-bottom: 20px;
  768. }
  769. .item {
  770. display: flex;
  771. font-size: 14px;
  772. color: #666;
  773. padding-bottom: 12px;
  774. .label {
  775. white-space: nowrap;
  776. }
  777. }
  778. }
  779. .order-evaluate-info {
  780. margin: 15px 0;
  781. padding: 30px 15px;
  782. background: #f5f7fa;
  783. .title {
  784. display: flex;
  785. justify-content: space-between;
  786. align-items: center;
  787. .left {
  788. font-size: 16px;
  789. font-weight: 700;
  790. span {
  791. font-weight: normal;
  792. margin-left: 20px;
  793. font-size: 14px;
  794. color: #666;
  795. }
  796. }
  797. .right {
  798. display: flex;
  799. align-items: center;
  800. font-size: 14px;
  801. span {
  802. margin-right: 10px;
  803. }
  804. }
  805. }
  806. .main {
  807. margin-top: 20px;
  808. display: flex;
  809. .rate-list {
  810. font-size: 14px;
  811. flex-shrink: 0;
  812. }
  813. .tag-list {
  814. margin-left: 30px;
  815. ::v-deep .el-tag {
  816. margin-right: 10px;
  817. margin-bottom: 10px;
  818. }
  819. }
  820. }
  821. .content {
  822. width: 400px;
  823. line-height: 20px;
  824. font-size: 14px;
  825. color: #333;
  826. margin-top: 10px;
  827. }
  828. .img-list {
  829. display: flex;
  830. flex-wrap: wrap;
  831. margin-top: 10px;
  832. width: 400px;
  833. ::v-deep .el-image {
  834. width: 100px;
  835. height: 100px;
  836. margin-right: 10px;
  837. margin-bottom: 10px;
  838. border: 1px solid #eaeaea;
  839. }
  840. }
  841. }
  842. </style>