detail.php 36 KB

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