detail.php 34 KB

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