detail.php 35 KB

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