detail.php 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836
  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. <el-tag size="small">
  264. {{ scope.row.goods_attr_name || '无规格' }}
  265. </el-tag>
  266. </template>
  267. </el-table-column>
  268. <el-table-column label="单价" width="210">
  269. <template slot-scope="scope">
  270. <div>{{ scope.row.price }}
  271. <span v-if="scope.row.adjust_money != 0">(调价:¥{{ scope.row.adjust_money }})</span>
  272. </div>
  273. </template>
  274. </el-table-column>
  275. <el-table-column label="购买数量" width="210">
  276. <template slot-scope="scope">
  277. <div>{{ scope.row.num }}</div>
  278. </template>
  279. </el-table-column>
  280. <el-table-column label="优惠" width="210">
  281. <template slot-scope="scope">
  282. <div>¥{{(scope.row.original_goods_price - scope.row.goods_price - orderDetail.score_money).toFixed(2)}}</div>
  283. </template>
  284. </el-table-column>
  285. <el-table-column label="小计" width="210">
  286. <template slot-scope="scope">
  287. <div>{{ getOrderPrice(scope.row) }}</div>
  288. </template>
  289. </el-table-column>
  290. <el-table-column label="状态">
  291. <template slot-scope="scope">
  292. <div>{{ order_status_list[scope.row.order_status] }}</div>
  293. </template>
  294. </el-table-column>
  295. <el-table-column label="操作">
  296. <template slot-scope="scope">
  297. <span><el-button type="text" size="mini" @click="handle('refund', scope.row)" v-if="(getStatusType(scope.row.order_status)) && scope.row.is_feedback == 0 && optionLimit == 0 ">主动退款</el-button></span>
  298. </template>
  299. </el-table-column>
  300. </el-table>
  301. </div>
  302. </el-card>
  303. <el-card v-if="orderDetail.express.length > 0" class="card-box marign-b-20" shadow="never">
  304. <div slot="header" class="clearfix row-card-header">
  305. <span>物流包裹</span>
  306. </div>
  307. <template>
  308. <el-tabs class="package" v-model="activePackage" type="card">
  309. <template v-for="(item,index) in orderDetail.express">
  310. <el-tab-pane :label="'包裹'+(index+1)" :key="index">
  311. <el-row style="width: 100%;">
  312. <el-col :span="24">
  313. <div class="package-item">
  314. <span>发货方式:</span><span
  315. class="text-color-primary">{{send_type[item.shipping_type]}}</span>
  316. </div>
  317. <div class="package-item">
  318. <span>发货人:</span><span>{{item.operator_username}}</span>
  319. </div>
  320. <div class="package-item">
  321. <span>发货时间:</span><span>{{ item.created_at|dateTimeFormat('Y-m-d H:i:s')}}</span>
  322. </div>
  323. <div class="package-item">
  324. <span>运单编号:</span><span v-if="item.express_no" class="range-right">{{item.express_no}}</span>
  325. <el-button
  326. v-if="orderDetail && orderDetail.order_status == 2 && item.created_at == item.updated_at"
  327. type="text" @click="handle('shipping', item)" style="padding: 0px;">修改物流
  328. </el-button>
  329. </div>
  330. <div class="package-item" flex="dir:left">
  331. <span style="line-height: 50px;">包裹商品:</span>
  332. <ul flex="dir:left cross:center" style="width:100%;overflow-y:auto;">
  333. <template v-for="val in (JSON.parse(item.order_detail_ids))">
  334. <li><el-image :src="goodDetails[val].pic_url"></el-image></li>
  335. <li class="range-right" style="width: 150px;padding-bottom:5px">
  336. <com-ellipsis :line="1" :text="goodDetails[val].goods_name"></com-ellipsis>
  337. 数量:<span style="color: red">{{goodDetails[val].num}}</span>
  338. <com-ellipsis :line="1">
  339. <template v-if="goodDetails[val].attr_list && goodDetails[val].attr_list.length > 0">
  340. <template v-for="(attrItem, attrIndex) in goodDetails[val].attr_list" size="small">
  341. {{ attrItem }}
  342. </template>
  343. </template>
  344. </com-ellipsis>
  345. </li>
  346. </template>
  347. </ul>
  348. </div>
  349. <div class="package-item">
  350. <!-- <span>商家备注:</span><span class="range-right">{{item.memo}}</span> -->
  351. <template v-for="(val,index2) in (JSON.parse(item.memo))">
  352. <div class="package-item">
  353. <span class="merchant-remarks">商家备注{{index2+1}}:{{val}}</span>
  354. </div>
  355. </template>
  356. </div>
  357. <div class="package-item" style="width:100%;">
  358. <span>物流状态:</span>
  359. <span class="text-color-success">{{item.now_state?item.now_state:'暂无物流信息'}}</span>
  360. <div v-if="item.express_log && item.express_log.length > 0" style="padding: 20px;font-size: 12px">
  361. <div style="padding: 2px;height:200px;overflow-y:auto;">
  362. <div>
  363. <el-timeline>
  364. <el-timeline-item
  365. v-for="(express_log, val) in item.express_log"
  366. :key="val"
  367. :size="normal"
  368. :color="val==0?'#409eff':''"
  369. :timestamp="express_log.AcceptTime">
  370. {{express_log.AcceptStation}}
  371. </el-timeline-item>
  372. </el-timeline>
  373. </div>
  374. </div>
  375. </div>
  376. </div>
  377. </el-col>
  378. </el-row>
  379. </el-tab-pane>
  380. </template>
  381. </el-tabs>
  382. </template>
  383. </el-card>
  384. <el-card v-if="orderAction.length > 0" class="card-box marign-b-20" shadow="never">
  385. <div slot="header" class="clearfix row-card-header">
  386. <span>订单操作日志</span>
  387. </div>
  388. <el-table :data="orderAction" v-loading="logLoading" style="width: 100%;" size="small" stripe>
  389. <el-table-column prop="member_name" label="用户" width="90">
  390. <template slot-scope="scope">
  391. <div>{{ scope.row.member_name }}</div>
  392. </template>
  393. </el-table-column>
  394. <el-table-column prop="created_at" label="操作时间" width="160">
  395. <template slot-scope="scope">
  396. <div>{{ scope.row.created_at|dateTimeFormat('Y-m-d H:i:s') }}</div>
  397. </template>
  398. </el-table-column>
  399. <el-table-column prop="action" label="详情">
  400. <template slot-scope="scope">
  401. <div>{{ scope.row.action }}</div>
  402. </template>
  403. </el-table-column>
  404. </el-table>
  405. </el-card>
  406. <el-card v-if="orderDetail">
  407. <el-button type="primary" v-if="orderDetail.order_status == 1 && optionLimit == 0" size="small"
  408. @click="handle('shipping', orderDetail)">发货
  409. </el-button>
  410. <el-button type="primary" v-if="orderDetail.order_status == 2 && optionLimit == 0" size="small"
  411. @click="handle('take-delivery', orderDetail)">确认收货
  412. </el-button>
  413. <el-button type="primary" v-if="orderDetail.order_status == 3 && optionLimit == 0" size="small"
  414. @click="handle('sales', orderDetail)">订单完成
  415. </el-button>
  416. </el-card>
  417. </el-card>
  418. <!-- 修改物流发货 -->
  419. <order-shipping :is_show="isShowChangeShipping" :change-shipping-loading="changeShippingLoading"
  420. :order_info="orderDetail" :shipping_form="shipping_form" @submit="handleShipping"
  421. @close="isShowChangeShipping = false"></order-shipping>
  422. <!-- 商家备注 -->
  423. <el-dialog title="商家备注" width="600px" :visible.sync="isShowRemark">
  424. <el-form :model="remark_form" label-width="80px" size="small">
  425. <el-form-item label="备注" prop="seller_remark">
  426. <el-input type="textarea" v-model="remark_form.seller_remark"></el-input>
  427. </el-form-item>
  428. </el-form>
  429. <div slot="footer" class="dialog-footer">
  430. <el-button @click="isShowRemark = false">取 消</el-button>
  431. <el-button type="primary" @click="handle('remark',remark_form,true)" :loading="remarkLoading">确 定</el-button>
  432. </div>
  433. </el-dialog>
  434. <!-- 主动退款-->
  435. <order-proactive-refund
  436. :is_show="isShowChangeRefund"
  437. :change-refund-loading="changeRefundLoading"
  438. :order_info="orderDetail" :goods_id = "goodsId" :refund_reason = "refundReason"
  439. @close="isShowChangeRefund = false" @success="handleSuccess">
  440. </order-proactive-refund>
  441. </div>
  442. <script>
  443. const app = new Vue({
  444. el: '#app',
  445. data() {
  446. return {
  447. id: 0,
  448. count: 6,
  449. detail: {},
  450. store: {},
  451. isShowChangeShipping: false,
  452. changeShippingLoading: false,
  453. changeRefundLoading: false,
  454. isShowChangeRefund: false,
  455. goodsId: 0,
  456. refundReason: {},
  457. remarkLoading: false,
  458. isShowRemark: false,
  459. shipping_form: {},
  460. remark_form: {
  461. seller_remark: null,
  462. },
  463. refundableStatus: ['1', '6', '7'], // 退款状态1 待发货 6 待自提 7 自提完成
  464. activePackage: '0',
  465. cardLoading: false,
  466. logLoading: false,
  467. goodDetails: [],
  468. orderAction: [],
  469. repeal_list: {
  470. '1': '售后中',
  471. '2': '售后完成',
  472. },
  473. marketing_type_map:{},
  474. stepArr: [],
  475. stepArrActive: 0,
  476. orderDetail: {
  477. base_user: {},
  478. express: []
  479. },
  480. orderExpress: [],
  481. order_status_list: {
  482. '0': "待付款",
  483. '1': "待发货",
  484. '2': "已发货",
  485. '3': "已收货",
  486. '4': "已完成",
  487. '-1': "售后申请",
  488. '-2': "退款中",
  489. '-3': "售后完成",
  490. '-4': "已关闭",
  491. '-5': "撤销申请",
  492. },
  493. payment_type_list: {
  494. '0': "在线支付",
  495. '1': "微信",
  496. '2': "支付宝",
  497. '3': "银联卡",
  498. '5': "余额支付",
  499. '7': "汇聚支付",
  500. '8': "汇聚快捷支付",
  501. '100': "线下支付"
  502. },
  503. shipping_type_list: {
  504. '1': "物流配送",
  505. '2': "买家自提",
  506. '3': "货到付款",
  507. '4': "本地配送"
  508. },
  509. send_type: {
  510. '0': "无需物流",
  511. '1': "快递",
  512. },
  513. activities: [{
  514. content: '支持使用图标',
  515. timestamp: '2018-04-12 20:46',
  516. size: 'normal',
  517. color: '#409eff'
  518. }, {
  519. content: '支持自定义颜色',
  520. timestamp: '2018-04-03 20:46',
  521. }, {
  522. content: '支持自定义尺寸',
  523. timestamp: '2018-04-03 20:46',
  524. size: 'large'
  525. }, {
  526. content: '默认样式的节点',
  527. timestamp: '2018-04-03 20:46'
  528. }, {
  529. content: '默认样式的节点',
  530. timestamp: '2018-04-03 20:46'
  531. }, {
  532. content: '默认样式的节点',
  533. timestamp: '2018-04-03 20:46'
  534. }, {
  535. content: '默认样式的节点',
  536. timestamp: '2018-04-03 20:46'
  537. }, {
  538. content: '默认样式的节点',
  539. timestamp: '2018-04-03 20:46'
  540. }],
  541. optionLimit: 0,
  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. handleSuccess() {
  558. this.isShowChangeRefund = false;
  559. this.getDetail();
  560. },
  561. getStatusType(val)
  562. {
  563. return this.refundableStatus.includes(val);
  564. },
  565. getDetail() {
  566. let self = this;
  567. self.cardLoading = true;
  568. request({
  569. params: {
  570. r: 'store/client/order/detail',
  571. id: self.id
  572. },
  573. method: 'get',
  574. }).then(e => {
  575. self.cardLoading = false;
  576. if (e.data.code == 0) {
  577. var data = e.data.data;
  578. self.orderDetail = data.order;
  579. self.optionLimit = data.order.option_limit
  580. self.store = data.store;
  581. self.orderAction = data.order_action;
  582. Object.keys(self.orderDetail.detail).forEach(function (item) {
  583. self.goodDetails[self.orderDetail.detail[item].id] = self.orderDetail.detail[item];
  584. });
  585. self.order_status_list = data.order_status_list;
  586. self.stepArr = data.stepArr;
  587. self.marketing_type_map = data.marketing_type_map;
  588. self.payment_type_list = data.payment_type_list;
  589. self.shipping_type_list = data.shipping_type_list;
  590. self.remark_form.seller_remark = self.orderDetail.seller_remark;
  591. self.refundReason = data.refund_reason;
  592. if (!isEmpty(data.step_arr)) self.getStepArr(data.step_arr, data.order);
  593. } else {
  594. self.$message.error(e.data.msg);
  595. }
  596. }).catch(e => {
  597. console.log(e);
  598. });
  599. },
  600. getStepArr(stepArr, order) {
  601. var newStepArr = [];
  602. var index = 0;
  603. stepArr.forEach(function (item) {
  604. let step = {};
  605. var field_key = item.field;
  606. step['title'] = item.title;
  607. step['created_at'] = order[field_key];
  608. step['is_step'] = order[field_key] !=='0' ? 1 : 0;
  609. newStepArr.push(step);
  610. if (step['is_step'] == 1) index++;
  611. });
  612. this.stepArrActive = index;
  613. this.stepArr = newStepArr;
  614. },
  615. handle(type, data = null, submit = false) {
  616. let id = data ? parseInt(data.id) : '';
  617. let url = 'store/client/order/operate'
  618. switch (type) {
  619. // 订单详情
  620. case 'detail':
  621. let params = {
  622. r: 'store/client/order/detail'
  623. };
  624. if (id) params = Object.assign(params, {
  625. id: id
  626. });
  627. navigateTo(params);
  628. break;
  629. // 删除订单
  630. case 'destroy':
  631. param = {
  632. id: data.id,
  633. type
  634. };
  635. this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {
  636. type: 'warning'
  637. }).then(() => {
  638. this.send(param)
  639. }).catch((err) => {
  640. })
  641. break;
  642. // 取消订单
  643. case 'cancel':
  644. param = {
  645. id: id
  646. };
  647. this.$confirm('确定关闭订单吗?', '警告', {
  648. type: 'warning'
  649. }).then(() => {
  650. this.send('store/client/order/close', param)
  651. }).catch((err) => {
  652. })
  653. break;
  654. // 修改订单价格
  655. case 'change_price':
  656. if (submit) {
  657. this.changePriceLoading = true;
  658. this.send('store/client/order/change-price', this.change_price_form, (resp) => {
  659. if (resp.code == 0) this.isShowChangePrice = false;
  660. });
  661. setTimeout(() => {
  662. this.changePriceLoading = false;
  663. }, 100);
  664. } else {
  665. this.isShowChangePrice = true
  666. var objString = JSON.stringify(data);
  667. this.change_price_form = JSON.parse(objString);
  668. }
  669. break;
  670. // 修改收货地址
  671. case 'change_address':
  672. if (submit) {
  673. this.changeAddressLoading = true;
  674. this.send('store/client/order/change-address', data, (resp) => {
  675. if (resp.code == 0) this.isShowChangeAddress = false;
  676. });
  677. setTimeout(() => {
  678. this.changeAddressLoading = false;
  679. }, 100);
  680. } else {
  681. this.isShowChangeAddress = true
  682. var objString = JSON.stringify(data);
  683. this.change_address_form = JSON.parse(objString);
  684. }
  685. break;
  686. // 订单备注
  687. case 'remark':
  688. if (submit) {
  689. this.remarkLoading = true;
  690. this.remark_form.id = this.id;
  691. this.send('store/client/order/remark', this.remark_form, (resp) => {
  692. if (resp.code == 0) this.isShowRemark = false;
  693. });
  694. setTimeout(() => {
  695. this.remarkLoading = false;
  696. }, 100);
  697. } else {
  698. this.isShowRemark = true
  699. }
  700. break;
  701. // 物流发货
  702. case 'shipping':
  703. if (submit) {
  704. this.changeShippingLoading = true;
  705. this.send('store/client/order/shipping', data, (resp) => {
  706. if (resp.code == 0) this.isShowChangeShipping = false;
  707. });
  708. setTimeout(() => {
  709. this.changeShippingLoading = false;
  710. }, 100);
  711. } else {
  712. this.isShowChangeShipping = true
  713. var objString = JSON.stringify(data);
  714. this.shipping_form = JSON.parse(objString);
  715. }
  716. break;
  717. // 收货
  718. case 'take-delivery':
  719. param = {
  720. id: id
  721. };
  722. this.$confirm('确定收货吗?', '警告', {
  723. type: 'warning'
  724. }).then(() => {
  725. this.send('store/client/order/take-delivery', param)
  726. }).catch((err) => {
  727. })
  728. break;
  729. // 订单完成
  730. case 'sales':
  731. param = {
  732. id: id
  733. };
  734. this.$confirm('确定完成订单吗?', '警告', {
  735. type: 'warning'
  736. }).then(() => {
  737. this.send('store/client/order/sales-order', param)
  738. }).catch((err) => {
  739. })
  740. break;
  741. case 'refund':
  742. if (submit) {
  743. this.changeRefundLoading = true;
  744. setTimeout(() => {
  745. this.changeRefundLoading = false;
  746. }, 100);
  747. } else {
  748. this.isShowChangeRefund = true;
  749. this.goodsId = Number(data.id);
  750. }
  751. break;
  752. }
  753. },
  754. send(url, params, callback) {
  755. let self = this;
  756. request({
  757. params: {
  758. r: url,
  759. },
  760. method: 'post',
  761. data: params
  762. }).then(e => {
  763. if (e.data.code == 0) {
  764. self.$message.success(e.data.msg);
  765. self.getDetail();
  766. } else {
  767. self.$message.error(e.data.msg);
  768. }
  769. if (callback) callback(e.data);
  770. }).catch(e => {
  771. console.log(e);
  772. });
  773. },
  774. format(num){
  775. return num.toFixed(2);
  776. },
  777. getOrderPrice(data){
  778. let text = '';
  779. switch (data.marketing_type) {
  780. case 'ScoreMall' :
  781. text = data.extra_info;
  782. break;
  783. default :
  784. text = '¥'+data.goods_price;
  785. }
  786. return text;
  787. },
  788. }
  789. });
  790. </script>