detail.php 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('component/order-shipping', __DIR__);
  4. ?>
  5. <style>
  6. .card-box {
  7. border: none;
  8. }
  9. .marign-b-20 {
  10. margin-bottom: 20px;
  11. }
  12. .step-box {
  13. margin-top: 10px;
  14. padding-top: 10px;
  15. }
  16. .step-inactive {
  17. position: absolute;
  18. top: 50%;
  19. left: 50%;
  20. width: 34px;
  21. height: 34px;
  22. border-radius: 50%;
  23. background-color: #e8e8e8;
  24. transform: translate(-50%, -50%);
  25. }
  26. .step-inside {
  27. position: absolute;
  28. top: 50%;
  29. left: 50%;
  30. width: 25px;
  31. height: 25px;
  32. border-radius: 50%;
  33. background-color: #cccbcb;
  34. transform: translate(-50%, -50%);
  35. text-align: center;
  36. line-height: 24px;
  37. z-index: 9;
  38. color: #fff;
  39. font-size: 12px;
  40. }
  41. .step-active {
  42. background-color: var(--primary, #fb6638);
  43. }
  44. .step-outside {
  45. background-color: transparent;
  46. }
  47. .step-box .el-step__title {
  48. font-size: 14px;
  49. }
  50. .text-item {
  51. padding: 10px 0;
  52. font-size: 12px;
  53. }
  54. .row-card-header {
  55. font-weight: 700;
  56. font-size: 14px;
  57. }
  58. .text-item > span:nth-child(1) {
  59. display: inline-block;
  60. width: 105px;
  61. padding-right: 20px;
  62. text-align: right;
  63. }
  64. .el-row-flex {
  65. display: flex;
  66. flex-flow: row wrap;
  67. }
  68. .el-row-flex .card-box {
  69. height: 100%;
  70. }
  71. .order-goods .el-table th > .cell,
  72. .order-goods .el-table {
  73. font-size: 13px;
  74. }
  75. .package-item {
  76. padding: 10px 0;
  77. font-size: 12px;
  78. }
  79. .package-item > span:nth-child(1) {
  80. display: inline-block;
  81. width: 105px;
  82. padding: 0 20px;
  83. text-align: left;
  84. }
  85. .package-item img {
  86. width: 55px;
  87. height: 55px;
  88. border-radius: 5px;
  89. margin-right: 10px;
  90. }
  91. .range-right {
  92. margin-right: 20px;
  93. }
  94. .com-order-refund-status {
  95. position: absolute;
  96. bottom: 0px;
  97. left: 0px;
  98. height: 20px;
  99. width: 50px;
  100. background-color: #FF7171;
  101. color: #fff;
  102. text-align: center;
  103. border-radius: 0 0 5px 5px;
  104. font-size: 12px;
  105. }
  106. .package .el-tab-pane {
  107. display: flex;
  108. }
  109. .package-item ::-webkit-scrollbar {
  110. width: 5px;
  111. }
  112. .el-timeline {
  113. font-size: 12px;
  114. }
  115. .com-order-count-price{
  116. float: right;
  117. margin-right: 100px;
  118. }
  119. .com-order-count-price .el-form-item{
  120. margin-bottom:0px;
  121. }
  122. </style>
  123. <div id="app" v-cloak>
  124. <el-card shadow="never" style="border: none;" body-style="background-color: #f3f3f3;padding: 10px 0 0;"
  125. v-loading="cardLoading">
  126. <div slot="header">
  127. <span>订单详情</span>
  128. </div>
  129. <el-card class="card-box step-box marign-b-20" shadow="never">
  130. <el-steps :active="stepArrActive">
  131. <el-step v-for="(item,index) in stepArr" :key="index" :title="item.title"
  132. :description="item.created_at|dateTimeFormat('Y-m-d H:i:s')">
  133. <template slot="icon">
  134. <div class="step-inactive" :class="item.is_step == 1 ? 'step-outside' : ''">
  135. <div class="step-inside" :class="item.is_step == 1 ? 'step-active' : ''">{{ index + 1 }}
  136. </div>
  137. </div>
  138. </template>
  139. </el-step>
  140. </el-steps>
  141. </el-card>
  142. <el-row :gutter="20" class="el-row-flex marign-b-20">
  143. <el-col :span="8">
  144. <el-card class="card-box" shadow="never">
  145. <div slot="header" class="clearfix row-card-header">
  146. <span>订单信息</span>
  147. </div>
  148. <div class="text-item">
  149. <span>订单状态</span><span>{{ orderDetail ? order_status_list[orderDetail.order_status] : '--' }}</span>
  150. </div>
  151. <div class="text-item">
  152. <span>订单编号</span><span>{{ orderDetail.order_no }}</span>
  153. </div>
  154. <div class="text-item">
  155. <span>交易单号</span><span>{{ orderDetail.out_trade_no || '--' }}</span>
  156. </div>
  157. <div class="text-item">
  158. <span>订单类型</span><span>普通订单</span>
  159. </div>
  160. <div class="text-item">
  161. <span>订单来源</span><span>{{marketing_type_map[orderDetail.marketing_type]? marketing_type_map[orderDetail.marketing_type] : '--' }}</span>
  162. </div>
  163. <div class="text-item">
  164. <span>支付方式</span><span>{{ payment_type_list[orderDetail.payment_type] }}</span>
  165. </div>
  166. <div class="text-item">
  167. <span>卖家备注</span>
  168. <span>{{ orderDetail.seller_remark || '--' }}</span>
  169. <span><el-button type="text" size="mini" @click="handle('remark')">备注</el-button></span>
  170. </div>
  171. </el-card>
  172. </el-col>
  173. <el-col :span="8">
  174. <el-card class="card-box " shadow="never">
  175. <div slot="header" class="clearfix row-card-header">
  176. <span>买家及收货信息</span>
  177. </div>
  178. <div class="text-item">
  179. <span>买家</span><span>{{ orderDetail.base_user.nickname }}</span>
  180. </div>
  181. <div class="text-item">
  182. <span>买家备注</span><span>{{ orderDetail.remark || '--' }}</span>
  183. </div>
  184. <div class="text-item">
  185. <span>配送方式</span><span>{{ shipping_type_list[orderDetail.shipping_type] }}</span>
  186. </div>
  187. <div class="text-item">
  188. <span>收货人</span><span>{{ orderDetail.receiver_name || '--' }}</span>
  189. </div>
  190. <div class="text-item">
  191. <span>收货地址</span><span>{{ orderDetail.region_name }} {{ orderDetail.address }}</span>
  192. </div>
  193. <div class="text-item">
  194. <span>手机号码</span><span>{{ orderDetail.mobile }}</span>
  195. </div>
  196. </el-card>
  197. </el-col>
  198. <el-col :span="8">
  199. <el-card class="card-box" shadow="never">
  200. <div slot="header" class="clearfix row-card-header">
  201. <span>结算信息</span>
  202. </div>
  203. <div class="text-item">
  204. <span>商品小计</span>
  205. <span>¥{{orderDetail.goods_price}}</span>
  206. </div>
  207. <div class="text-item">
  208. <span>运费</span>
  209. <span>¥{{orderDetail.shipping_money}}</span>
  210. </div>
  211. <div class="text-item" v-if="orderDetail.score_money > 0">
  212. <span>积分抵扣</span>
  213. <span>- ¥{{orderDetail.score_money}}</span>
  214. </div>
  215. <div class="text-item" v-if="orderDetail.coupon_money > 0">
  216. <span>优惠券抵扣</span>
  217. <span>¥{{orderDetail.coupon_money}}</span>
  218. </div>
  219. <div class="text-item">
  220. <span>实付款</span>
  221. <span>¥{{orderDetail.pay_money}}</span>
  222. </div>
  223. </el-card>
  224. </el-col>
  225. </el-row>
  226. <el-card class="card-box marign-b-20" shadow="never">
  227. <div slot="header" class="clearfix row-card-header">
  228. <span>商品信息</span>
  229. </div>
  230. <div v-if="orderDetail.detail" class="order-goods">
  231. <el-table :data="orderDetail.detail" style="width: 100%;"
  232. :header-cell-style="{background:'#F7F7F7','border-bottom': 0}">
  233. <el-table-column label="商品" width="260">
  234. <template slot-scope="scope">
  235. <div style="position: relative;display: flex;align-items: center;">
  236. <el-image style="width: 66px; height: 50px;border-radius: 5px;"
  237. :src="scope.row.pic_url"></el-image>
  238. <span v-if="repeal_list[scope.row.is_feedback]" class="com-order-refund-status">{{ repeal_list[scope.row.is_feedback] }}</span>
  239. <com-ellipsis :line="2" style="margin-left: 10px;">
  240. {{ scope.row.goods_name }}
  241. </com-ellipsis>
  242. </div>
  243. </template>
  244. </el-table-column>
  245. <el-table-column label="单价" width="210">
  246. <template slot-scope="scope">
  247. <div>{{ getOrderPrice(scope.row) }}
  248. <span v-if="scope.row.adjust_money != 0">(调价:¥{{ scope.row.adjust_money }})</span>
  249. </div>
  250. </template>
  251. </el-table-column>
  252. <el-table-column label="购买数量" width="210">
  253. <template slot-scope="scope">
  254. <div>{{ scope.row.num }}</div>
  255. </template>
  256. </el-table-column>
  257. <el-table-column label="优惠" width="210">
  258. <template slot-scope="scope">
  259. <div>¥{{(scope.row.original_goods_price - scope.row.goods_price - orderDetail.score_money).toFixed(2)}}</div>
  260. </template>
  261. </el-table-column>
  262. <el-table-column label="小计" width="210">
  263. <template slot-scope="scope">
  264. <div>{{ getOrderPrice(orderDetail) }}</div>
  265. </template>
  266. </el-table-column>
  267. <el-table-column label="状态">
  268. <template slot-scope="scope">
  269. <div>{{ order_status_list[scope.row.order_status] }}</div>
  270. </template>
  271. </el-table-column>
  272. </el-table>
  273. </div>
  274. </el-card>
  275. <el-card v-if="orderDetail.express.length > 0" class="card-box marign-b-20" shadow="never">
  276. <div slot="header" class="clearfix row-card-header">
  277. <span>物流包裹</span>
  278. </div>
  279. <template>
  280. <el-tabs class="package" v-model="activePackage" type="card">
  281. <template v-for="(item,index) in orderDetail.express">
  282. <el-tab-pane :label="'包裹'+(index+1)" :key="index">
  283. <el-row style="width: 100%;">
  284. <el-col :span="24">
  285. <div class="package-item">
  286. <span>发货方式:</span><span
  287. class="text-color-primary">{{send_type[item.shipping_type]}}</span>
  288. </div>
  289. <div class="package-item">
  290. <span>发货人:</span><span>{{item.operator_username}}</span>
  291. </div>
  292. <div class="package-item">
  293. <span>发货时间:</span><span>{{ item.created_at|dateTimeFormat('Y-m-d H:i:s')}}</span>
  294. </div>
  295. <div class="package-item">
  296. <span>运单编号:</span><span v-if="item.express_no" class="range-right">{{item.express_no}}</span>
  297. <el-button
  298. v-if="orderDetail && orderDetail.order_status == 2 && item.created_at == item.updated_at"
  299. type="text" @click="handle('shipping', item)" style="padding: 0px;">修改物流
  300. </el-button>
  301. </div>
  302. <div class="package-item" flex="dir:left">
  303. <span style="line-height: 50px;">包裹商品:</span>
  304. <ul flex="dir:left cross:center" style="with=100%;overflow-y:auto;">
  305. <template v-for="val in (JSON.parse(item.order_detail_ids))">
  306. <li><el-image :src="goodDetails[val].pic_url"></el-image></li>
  307. <li class="range-right" style="width: 150px;padding-bottom:5px">
  308. <com-ellipsis :line="1" :text="goodDetails[val].goods_name"></com-ellipsis>
  309. 数量:<span style="color: red">{{goodDetails[val].num}}</span>
  310. <com-ellipsis :line="1">
  311. <template v-if="goodDetails[val].attr_list && goodDetails[val].attr_list.length > 0">
  312. <template v-for="(attrItem, attrIndex) in goodDetails[val].attr_list" size="small">
  313. {{ attrItem }}
  314. </template>
  315. </template>
  316. </com-ellipsis>
  317. </li>
  318. </template>
  319. </ul>
  320. </div>
  321. <div class="package-item">
  322. <span>商家备注:</span><span class="range-right">{{item.memo}}</span>
  323. </div>
  324. <div class="package-item" style="width:100%;">
  325. <span>物流状态:</span>
  326. <span class="text-color-success">{{item.now_state?item.now_state:'暂无物流信息'}}</span>
  327. <div v-if="item.express_log && item.express_log.length > 0" style="padding: 20px;font-size: 12px">
  328. <div style="padding: 2px;height:200px;overflow-y:auto;">
  329. <div>
  330. <el-timeline>
  331. <el-timeline-item
  332. v-for="(express_log, val) in item.express_log"
  333. :key="val"
  334. :size="normal"
  335. :color="val==0?'#409eff':''"
  336. :timestamp="express_log.AcceptTime">
  337. {{express_log.AcceptStation}}
  338. </el-timeline-item>
  339. </el-timeline>
  340. </div>
  341. </div>
  342. </div>
  343. </div>
  344. </el-col>
  345. </el-row>
  346. </el-tab-pane>
  347. </template>
  348. </el-tabs>
  349. </template>
  350. </el-card>
  351. <el-card v-if="orderAction.length > 0" class="card-box marign-b-20" shadow="never">
  352. <div slot="header" class="clearfix row-card-header">
  353. <span>订单操作日志</span>
  354. </div>
  355. <el-table :data="orderAction" v-loading="logLoading" style="width: 100%;" size="small" stripe>
  356. <el-table-column prop="member_name" label="用户" width="90">
  357. <template slot-scope="scope">
  358. <div>{{ scope.row.member_name }}</div>
  359. </template>
  360. </el-table-column>
  361. <el-table-column prop="created_at" label="操作时间" width="160">
  362. <template slot-scope="scope">
  363. <div>{{ scope.row.created_at|dateTimeFormat('Y-m-d H:i:s') }}</div>
  364. </template>
  365. </el-table-column>
  366. <el-table-column prop="action" label="详情">
  367. <template slot-scope="scope">
  368. <div>{{ scope.row.action }}</div>
  369. </template>
  370. </el-table-column>
  371. </el-table>
  372. </el-card>
  373. <el-card v-if="orderDetail">
  374. <el-button type="primary" v-if="orderDetail.order_status == 1" size="small"
  375. @click="handle('shipping', orderDetail)">发货
  376. </el-button>
  377. <el-button type="primary" v-if="orderDetail.order_status == 2" size="small"
  378. @click="handle('take-delivery', orderDetail)">确认收货
  379. </el-button>
  380. <el-button type="primary" v-if="orderDetail.order_status == 3" size="small"
  381. @click="handle('sales', orderDetail)">订单完成
  382. </el-button>
  383. </el-card>
  384. </el-card>
  385. <!-- 修改物流发货 -->
  386. <order-shipping :is_show="isShowChangeShipping" :change-shipping-loading="changeShippingLoading"
  387. :order_info="orderDetail" :shipping_form="shipping_form" @submit="handleShipping"
  388. @close="isShowChangeShipping = false"></order-shipping>
  389. <!-- 商家备注 -->
  390. <el-dialog title="商家备注" width="600px" :visible.sync="isShowRemark">
  391. <el-form :model="remark_form" label-width="80px" size="small">
  392. <el-form-item label="备注" prop="seller_remark">
  393. <el-input type="textarea" v-model="remark_form.seller_remark"></el-input>
  394. </el-form-item>
  395. </el-form>
  396. <div slot="footer" class="dialog-footer">
  397. <el-button @click="isShowRemark = false">取 消</el-button>
  398. <el-button type="primary" @click="handle('remark',remark_form,true)" :loading="remarkLoading">确 定</el-button>
  399. </div>
  400. </el-dialog>
  401. </div>
  402. <script>
  403. const app = new Vue({
  404. el: '#app',
  405. data() {
  406. return {
  407. id: 0,
  408. count: 6,
  409. detail: {},
  410. isShowChangeShipping: false,
  411. changeShippingLoading: false,
  412. remarkLoading: false,
  413. isShowRemark: false,
  414. shipping_form: {},
  415. remark_form: {
  416. seller_remark: null,
  417. },
  418. activePackage: '0',
  419. cardLoading: false,
  420. logLoading: false,
  421. goodDetails: [],
  422. orderAction: [],
  423. repeal_list: {
  424. '1': '售后中',
  425. '2': '售后完成',
  426. },
  427. marketing_type_map:{},
  428. stepArr: [
  429. {
  430. title: '买家下单',
  431. created_at: '0',
  432. is_step: 0,
  433. },
  434. {
  435. title: '买家付款',
  436. created_at: '0',
  437. is_step: 0,
  438. },
  439. {
  440. title: '商家发货',
  441. created_at: '0',
  442. is_step: 0,
  443. },
  444. {
  445. title: '交易完成',
  446. created_at: '0',
  447. is_step: 0,
  448. }
  449. ],
  450. stepArrActive: 0,
  451. orderDetail: {
  452. base_user: {},
  453. express: []
  454. },
  455. orderExpress: [],
  456. order_status_list: {
  457. '0': "待付款",
  458. '1': "待发货",
  459. '2': "已发货",
  460. '3': "已收货",
  461. '4': "已完成",
  462. '-1': "售后申请",
  463. '-2': "退款中",
  464. '-3': "售后完成",
  465. '-4': "已关闭",
  466. '-5': "撤销申请",
  467. },
  468. payment_type_list: {
  469. '0': "在线支付",
  470. '1': "微信",
  471. '2': "支付宝",
  472. '3': "银联卡",
  473. '5': "余额支付",
  474. '7': "汇聚支付",
  475. '8': "汇聚快捷支付",
  476. '100': "线下支付"
  477. },
  478. shipping_type_list: {
  479. '1': "物流配送",
  480. '2': "买家自提",
  481. '3': "货到付款",
  482. '4': "本地配送"
  483. },
  484. send_type: {
  485. '0': "无需物流",
  486. '1': "快递",
  487. },
  488. activities: [{
  489. content: '支持使用图标',
  490. timestamp: '2018-04-12 20:46',
  491. size: 'normal',
  492. color: '#409eff'
  493. }, {
  494. content: '支持自定义颜色',
  495. timestamp: '2018-04-03 20:46',
  496. }, {
  497. content: '支持自定义尺寸',
  498. timestamp: '2018-04-03 20:46',
  499. size: 'large'
  500. }, {
  501. content: '默认样式的节点',
  502. timestamp: '2018-04-03 20:46'
  503. }, {
  504. content: '默认样式的节点',
  505. timestamp: '2018-04-03 20:46'
  506. }, {
  507. content: '默认样式的节点',
  508. timestamp: '2018-04-03 20:46'
  509. }, {
  510. content: '默认样式的节点',
  511. timestamp: '2018-04-03 20:46'
  512. }, {
  513. content: '默认样式的节点',
  514. timestamp: '2018-04-03 20:46'
  515. }]
  516. };
  517. },
  518. created() {
  519. this.id = getQuery('id');
  520. },
  521. mounted() {
  522. this.getDetail();
  523. },
  524. methods: {
  525. load() {
  526. // this.count += 2
  527. },
  528. handleShipping(data) {
  529. this.handle('shipping', data, true);
  530. },
  531. getDetail() {
  532. let self = this;
  533. self.cardLoading = true;
  534. request({
  535. params: {
  536. r: 'mall/order/detail',
  537. id: self.id
  538. },
  539. method: 'get',
  540. }).then(e => {
  541. self.cardLoading = false;
  542. if (e.data.code == 0) {
  543. var data = e.data.data;
  544. self.orderDetail = data.order;
  545. self.orderAction = data.order_action;
  546. Object.keys(self.orderDetail.detail).forEach(function (item) {
  547. self.goodDetails[self.orderDetail.detail[item].id] = self.orderDetail.detail[item];
  548. });
  549. self.order_status_list = data.order_status_list;
  550. self.marketing_type_map = data.marketing_type_map;
  551. self.payment_type_list = data.payment_type_list;
  552. self.shipping_type_list = data.shipping_type_list;
  553. self.remark_form.seller_remark = self.orderDetail.seller_remark;
  554. if (!isEmpty(data.step_arr)) self.getStepArr(data.step_arr, data.order);
  555. } else {
  556. self.$message.error(e.data.msg);
  557. }
  558. }).catch(e => {
  559. console.log(e);
  560. });
  561. },
  562. getStepArr(stepArr, order) {
  563. var newStepArr = [];
  564. var index = 0;
  565. stepArr.forEach(function (item) {
  566. let step = {};
  567. var field_key = item.field;
  568. step['title'] = item.title;
  569. step['created_at'] = order[field_key];
  570. step['is_step'] = order[field_key] ? 1 : 0;
  571. newStepArr.push(step);
  572. if (step['is_step'] == 1) index++;
  573. });
  574. this.stepArrActive = index;
  575. this.stepArr = newStepArr;
  576. },
  577. handle(type, data = null, submit = false) {
  578. let id = data ? parseInt(data.id) : '';
  579. let url = 'mall/order/operate'
  580. switch (type) {
  581. // 订单详情
  582. case 'detail':
  583. let params = {
  584. r: 'mall/order/detail'
  585. };
  586. if (id) params = Object.assign(params, {
  587. id: id
  588. });
  589. navigateTo(params);
  590. break;
  591. // 删除订单
  592. case 'destroy':
  593. param = {
  594. id: data.id,
  595. type
  596. };
  597. this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {
  598. type: 'warning'
  599. }).then(() => {
  600. this.send(param)
  601. }).catch((err) => {
  602. })
  603. break;
  604. // 取消订单
  605. case 'cancel':
  606. param = {
  607. id: id
  608. };
  609. this.$confirm('确定关闭订单吗?', '警告', {
  610. type: 'warning'
  611. }).then(() => {
  612. this.send('mall/order/close', param)
  613. }).catch((err) => {
  614. })
  615. break;
  616. // 修改订单价格
  617. case 'change_price':
  618. if (submit) {
  619. this.changePriceLoading = true;
  620. this.send('mall/order/change-price', this.change_price_form, (resp) => {
  621. if (resp.code == 0) this.isShowChangePrice = false;
  622. });
  623. setTimeout(() => {
  624. this.changePriceLoading = false;
  625. }, 100);
  626. } else {
  627. this.isShowChangePrice = true
  628. var objString = JSON.stringify(data);
  629. this.change_price_form = JSON.parse(objString);
  630. }
  631. break;
  632. // 修改收货地址
  633. case 'change_address':
  634. if (submit) {
  635. this.changeAddressLoading = true;
  636. this.send('mall/order/change-address', data, (resp) => {
  637. if (resp.code == 0) this.isShowChangeAddress = false;
  638. });
  639. setTimeout(() => {
  640. this.changeAddressLoading = false;
  641. }, 100);
  642. } else {
  643. this.isShowChangeAddress = true
  644. var objString = JSON.stringify(data);
  645. this.change_address_form = JSON.parse(objString);
  646. }
  647. break;
  648. // 订单备注
  649. case 'remark':
  650. if (submit) {
  651. this.remarkLoading = true;
  652. this.remark_form.id = this.id;
  653. this.send('mall/order/remark', this.remark_form, (resp) => {
  654. if (resp.code == 0) this.isShowRemark = false;
  655. });
  656. setTimeout(() => {
  657. this.remarkLoading = false;
  658. }, 100);
  659. } else {
  660. this.isShowRemark = true
  661. }
  662. break;
  663. // 物流发货
  664. case 'shipping':
  665. if (submit) {
  666. this.changeShippingLoading = true;
  667. this.send('mall/order/shipping', data, (resp) => {
  668. if (resp.code == 0) this.isShowChangeShipping = false;
  669. });
  670. setTimeout(() => {
  671. this.changeShippingLoading = false;
  672. }, 100);
  673. } else {
  674. this.isShowChangeShipping = true
  675. var objString = JSON.stringify(data);
  676. this.shipping_form = JSON.parse(objString);
  677. }
  678. break;
  679. // 收货
  680. case 'take-delivery':
  681. param = {
  682. id: id
  683. };
  684. this.$confirm('确定收货吗?', '警告', {
  685. type: 'warning'
  686. }).then(() => {
  687. this.send('mall/order/take-delivery', param)
  688. }).catch((err) => {
  689. })
  690. break;
  691. // 订单完成
  692. case 'sales':
  693. param = {
  694. id: id
  695. };
  696. this.$confirm('确定完成订单吗?', '警告', {
  697. type: 'warning'
  698. }).then(() => {
  699. this.send('mall/order/sales-order', param)
  700. }).catch((err) => {
  701. })
  702. break;
  703. }
  704. },
  705. send(url, params, callback) {
  706. let self = this;
  707. request({
  708. params: {
  709. r: url,
  710. },
  711. method: 'post',
  712. data: params
  713. }).then(e => {
  714. if (e.data.code == 0) {
  715. self.$message.success(e.data.msg);
  716. self.getDetail();
  717. } else {
  718. self.$message.error(e.data.msg);
  719. }
  720. if (callback) callback(e.data);
  721. }).catch(e => {
  722. console.log(e);
  723. });
  724. },
  725. format(num){
  726. return num.toFixed(2);
  727. },
  728. getOrderPrice(data){
  729. let text = '';
  730. switch (data.marketing_type) {
  731. case 'ScoreMall' :
  732. text = data.extra_info;
  733. break;
  734. default :
  735. text = '¥'+data.goods_price;
  736. }
  737. return text;
  738. },
  739. }
  740. });
  741. </script>