orderList.vue 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270
  1. <template>
  2. <div>
  3. <el-row>
  4. <el-col :span="18">
  5. <div v-loading="isLoading">
  6. <div class="empty-data" v-if="list && list.length < 1">
  7. <img src="../../../static/image/empty-data.png" />
  8. </div>
  9. <div :class="curIdx === i ? 'order_item active-order-item' : 'order_item'" @click="chooseOrder(item,i)" v-for="(item,i) in list" :key="i">
  10. <div class="order_item_header">
  11. <div class="order_item_header_l">
  12. <div v-if="item.daySeq" class="Serial_number">#{{item.daySeq}}</div>
  13. <img :src="item.logo || item.waimaiLogo" class="logo">
  14. <span class="name">{{item.shopName}}</span>
  15. <div class="sign_time" v-if="item.waimaiOrderId && item.takeType==1">{{item.exceptTime}}前送达</div>
  16. <div class="sign_txt" v-if="item.waimaiOrderId && item.takeType==0">立即送达</div>
  17. <!-- <div class="sign_d">预约 09/10 17:30自动发起配送</div> -->
  18. </div>
  19. <!-- 订单查询 -->
  20. <div class="order_item_header_r" v-if="tabNum === -1">
  21. <span class="header_r">{{showDeliveryStatus(item)}}</span>
  22. <el-button size='small' class="btn" @click.stop="orderPrinter(item.waimaiOrderId)">补打发票</el-button>
  23. </div>
  24. <!-- 新订单 -->
  25. <div class="order_item_header_r" v-if="tabNum === 0">
  26. <!-- <span class="header_r">已发单1分钟</span> -->
  27. <el-button size='small' class="btn" @click.stop="deleteItem(item)">发起配送</el-button>
  28. </div>
  29. <!-- 预约单 -->
  30. <div class="order_item_header_r" v-if="tabNum === 1">
  31. <!-- <span class="header_r">已发单1分钟</span> -->
  32. <el-button size='small' @click.stop="iGnoreOrder(item.id)">忽略订单</el-button>
  33. <el-button size='small' @click.stop="itemAddRemark(item.id, item)">添加备注</el-button>
  34. <el-button size='small' class="btn" @click.stop="settingTime(item)">定时发单</el-button>
  35. <el-button size='small' class="btn" @click.stop="deleteItem(item)">发起配送</el-button>
  36. </div>
  37. <!-- 待接单 -->
  38. <div class="order_item_header_r" v-if="tabNum === 2">
  39. <span class="header_r">已发单{{item.takeTimeTxt}}</span>
  40. <el-button size='small' @click.stop="cancelOrder(item.id)">取消订单</el-button>
  41. <el-button size='small' @click.stop="orderPrinter(item.waimaiOrderId)">补打发票</el-button>
  42. <el-button size='small' class="btn" @click.stop="addTip(item.id)">加&nbsp;小&nbsp;费</el-button>
  43. </div>
  44. <!-- 取货中 -->
  45. <div class="order_item_header_r" v-if="tabNum === 3">
  46. <span v-show="Number(item.riderArriveMinute)" class="header_r">预计{{Number(item.riderArriveMinute)}}分钟取件</span>
  47. <el-button size='small' @click.stop="cancelOrder(item.id)">取消订单</el-button>
  48. <el-button size='small' class="btn" @click.stop="orderPrinter(item.waimaiOrderId)">补打发票</el-button>
  49. </div>
  50. <!-- 配送中 -->
  51. <div class="order_item_header_r" v-if="tabNum === 4">
  52. <span class="header_r" v-if="item.exceptTime">预计{{item.exceptTime}}送达</span>
  53. <el-button size='small' class="btn" @click.stop="orderPrinter(item.waimaiOrderId)">补打发票</el-button>
  54. </div>
  55. <!-- 异常单 -->
  56. <div class="order_item_header_r" v-if="tabNum === 5">
  57. <span class="header_r">{{showCancelType(item.cancelType)}}</span>
  58. <el-button size='small' class="btn" @click.stop="orderBack(item.id)">撤回订单</el-button>
  59. </div>
  60. <!-- 取消单 -->
  61. <div class="order_item_header_r" v-if="tabNum === 6">
  62. <span class="header_r">{{showCancelType(item.cancelType)}}</span>
  63. <!-- <el-button size='small' class="btn" @click.stop="orderBack(item.id)">撤回订单</el-button> -->
  64. </div>
  65. </div>
  66. <div class="order_item_cont">
  67. <div class="content">{{item.receiptContactName}}<span>{{item.receiptPhone}}</span></div>
  68. <div class="address">
  69. {{item.receiptProvinceName}}
  70. {{item.receiptCityName}}
  71. {{item.receiptDistrictName}}
  72. {{item.receiptAddress}}
  73. <span v-if="item.orderDistance" @click.stop="checkMap(item)">
  74. <i class="el-icon-location"></i>
  75. <span v-if="item.orderDistance < 1000">
  76. {{item.orderDistance}}m
  77. </span>
  78. <span v-else>
  79. {{item.orderDistance / 1000}}km
  80. </span>
  81. </span>
  82. </div>
  83. <div v-if="item.caution" class="itme_r">备注:{{item.caution}}</div>
  84. </div>
  85. </div>
  86. <div v-if="item.caution" class="itme_r">备注:{{item.caution}}</div>
  87. </div>
  88. </el-col>
  89. <!-- 订单追踪、订单详情 -->
  90. <el-col :span="6">
  91. <div class="order_detail">
  92. <div class="detail_title">
  93. <div v-show="needTrack" class="detail_txt" @click="orderDetailStutus=0" :class="{'detail_txt_ac':!orderDetailStutus}">订单跟踪</div>
  94. <div class="detail_txt" @click="orderDetailStutus=1" :class="{'detail_txt_ac':!!orderDetailStutus}">订单详情</div>
  95. </div>
  96. <order-track v-show="showTrack" :tabNum="tabNum" :trackOrder="trackOrder" v-if="!orderDetailStutus && needTrack"></order-track>
  97. <order-detail v-show="showDetail" :tabNum="tabNum" :orderDetail="orderDetail" v-else></order-detail>
  98. <!-- 订单跟踪、订单详情底部按钮 -->
  99. <div v-show="showDetail || showTrack">
  100. <!-- 新订单 -->
  101. <div class="btns" v-if="tabNum === 0">
  102. <el-button size='small' @click.native="itemAddRemark(list[curIdx].id, list[curIdx])" class="btn_bots">添加备注</el-button>
  103. <el-button size='small' @click.native="iGnoreOrder(list[curIdx].id)" class="btn_bots">忽略订单</el-button>
  104. <el-button size='small' @click.native="orderPrinter(list[curIdx].waimaiOrderId)" class="btn_bots">补打发票</el-button>
  105. <el-button size='small' @click.native="deleteItem(list[curIdx])" class="btn_bots btn">发起配送</el-button>
  106. </div>
  107. <!-- 预约单 -->
  108. <div class="btns" v-if="tabNum === 1">
  109. <div class="btn_bot">
  110. <el-dropdown>
  111. <span class="el-dropdown-link">更多</span>
  112. <el-dropdown-menu slot="dropdown">
  113. <el-dropdown-item @click.native="orderPrinter(list[curIdx].waimaiOrderId)"><span style="color:#FC7200;">补打发票</span></el-dropdown-item>
  114. <el-dropdown-item @click.native="iGnoreOrder(list[curIdx].id)">忽略订单</el-dropdown-item>
  115. </el-dropdown-menu>
  116. </el-dropdown>
  117. </div>
  118. <el-button size='small' @click.native="itemAddRemark(list[curIdx].id, list[curIdx])" class="btn_bots">添加备注</el-button>
  119. <el-button size='small' @click.native="settingTime(list[curIdx])" class="btn_bots btn">定时发单</el-button>
  120. <el-button size='small' @click.native="deleteItem(list[curIdx])" class="btn_bots btn">发起配送</el-button>
  121. </div>
  122. <!-- 订单查询 -->
  123. <div class="btns" v-if="tabNum === -1">
  124. <el-button size='small' @click.native="orderPrinter(list[curIdx].waimaiOrderId)" class="btn_bots btn">补打发票</el-button>
  125. </div>
  126. <!-- 待接单 -->
  127. <div class="btns" v-if="tabNum === 2">
  128. <el-button size='small' @click.native="cancelOrder(list[curIdx].id)" class="btn_bots">取消订单</el-button>
  129. <el-button size='small' @click.native="orderPrinter(list[curIdx].waimaiOrderId)" class="btn_bots">补打发票</el-button>
  130. <el-button size='small' @click.native="addTip(list[curIdx].id)" class="btn_bots btn">加小费</el-button>
  131. </div>
  132. <!-- 取货中 -->
  133. <div class="btns" v-if="tabNum === 3">
  134. <el-button size='small' @click.native="cancelOrder(list[curIdx].id)" class="btn_bots">取消订单</el-button>
  135. <el-button size='small' @click.native="orderPrinter(list[curIdx].waimaiOrderId)" class="btn_bots btn">补打发票</el-button>
  136. </div>
  137. <!-- 配送中 -->
  138. <div class="btns" v-if="tabNum === 4">
  139. <el-button size='small' @click.native="orderPrinter(list[curIdx].waimaiOrderId)" class="btn_bots btn">补打发票</el-button>
  140. </div>
  141. <!-- 异常单 -->
  142. <div class="btns" v-if="tabNum === 5">
  143. <el-button size='small' @click.native="orderPrinter(list[curIdx].waimaiOrderId)" class="btn_bots">补打发票</el-button>
  144. <el-button size='small' @click.native="orderBack(list[curIdx].id)" class="btn_bots btn">撤回订单</el-button>
  145. </div>
  146. <!-- 已取消 -->
  147. <div class="btns" v-if="tabNum === 6">
  148. <!-- <el-button size='small' @click.native="orderPrinter(list[curIdx].waimaiOrderId)" class="btn_bots btn">再来一单</el-button> -->
  149. </div>
  150. </div>
  151. </div>
  152. </el-col>
  153. </el-row>
  154. <!-- 发起配送 -->
  155. <send-order-popup ref="sendOrderPopup"></send-order-popup>
  156. <!-- 骑手、商家、发件人地图 -->
  157. <order-map ref="orderMap"></order-map>
  158. <!-- 备注弹出层 -->
  159. <el-dialog width="580px" center title="新增备注" destroy-on-close :visible.sync="dialogTableVisible">
  160. <div>
  161. <el-input placeholder="请添加备注信息,最多输入20个字!" v-model="remark" :maxlength="20" />
  162. </div>
  163. <div style="text-align: center;margin-top: 20px;">
  164. <el-button @click.stop="dialogTableVisible = false">取消</el-button>
  165. <el-button type="primary" class="submit-btn" @click.stop="commitRemark(orderId, item)">确定</el-button>
  166. </div>
  167. </el-dialog>
  168. <!-- 忽略订单弹出层 -->
  169. <el-dialog width="580px" center title="忽略订单" destroy-on-close :visible.sync="ignoreStatus">
  170. <div class="ignore-modal">
  171. <div class="title">请选择忽略该笔订单的原因</div>
  172. <div class="check-item">
  173. <img src="../../../static/image/check-radio.png" @click.stop="changeRadio(1)" v-if="radio != 1" class="radio" />
  174. <img src="../../../static/image/check-radio-active.png" v-if="radio == 1" class="radio" />
  175. <span>通过其他配送方式完成</span>
  176. </div>
  177. <div class="check-item">
  178. <img src="../../../static/image/check-radio.png" @click.stop="changeRadio(2)" v-if="radio != 2" class="radio" />
  179. <img src="../../../static/image/check-radio-active.png" v-if="radio == 2" class="radio" />
  180. <span>取消该笔订单(由于用户取消或其他原因)</span>
  181. </div>
  182. </div>
  183. <div style="text-align: center;margin-top: 20px;">
  184. <el-button @click.stop="ignoreStatus = false">取消</el-button>
  185. <el-button type="primary" class="submit-btn" @click.stop="commitIGnore(orderId)">确定</el-button>
  186. </div>
  187. </el-dialog>
  188. <!-- 设置预约发单时间弹出层 -->
  189. <el-dialog width="580px" center title="设置预约时间" destroy-on-close :visible.sync="settingTimeStatus">
  190. <div>
  191. <span>提前发起配送时间:</span>
  192. <el-select size="small" style="width: 80px;;" v-model="timeValue" placeholder="请选择">
  193. <el-option v-for="(item, index) in timeList" :key="index" :label="item" :value="item"></el-option>
  194. </el-select>
  195. <span>小时</span>
  196. </div>
  197. <p style="color: #F74141;">提示:设置后系统将根据您设置的提前时间自动发单。</p>
  198. <div style="text-align: center;margin-top: 20px;">
  199. <el-button @click.stop="settingTimeStatus = false">取消</el-button>
  200. <el-button type="primary" class="submit-btn" @click.stop="commitTimeValue(orderId)">确定</el-button>
  201. </div>
  202. </el-dialog>
  203. <!-- 取消订单弹出层 -->
  204. <el-dialog width="680px" center title="取消原因" destroy-on-close :visible.sync="cancelStatus">
  205. <div class="cancel-list">
  206. <div class="item" @click.stop="changeReason(item)" :class="[(index + 1 ) % 3 == 0 ? 'no-margin': '', item.id == reasonIndex ? 'active' : '']" v-for="(item, index) in cancelList" :key="index">{{ item.name }}</div>
  207. </div>
  208. <div class="text-area">
  209. <el-input show-word-limit :rows="4" type="textarea" resize="none" :maxlength="50" placeholder="请输入其他原因" v-model="cancelReason"></el-input>
  210. </div>
  211. <div style="text-align: center;margin-top: 20px;">
  212. <el-button @click.stop="cancelStatus = false">取消</el-button>
  213. <el-button type="primary" class="submit-btn" @click.stop="commitCancelReason(orderId)">确定</el-button>
  214. </div>
  215. </el-dialog>
  216. <!-- 加小费弹出层 -->
  217. <el-dialog width="580px" center title="加小费" destroy-on-close :visible.sync="addTipStatus">
  218. <div>
  219. <div class="tip-title">小费金额</div>
  220. <div class="tip-list">
  221. <div class="tip-item" @click.stop="tipActive = index" :class="tipActive == index ? 'tip-active' : ''" v-for="(item, index) in tipList" :key="index">{{ item }}元</div>
  222. <div class="tip-item" @click.stop="tipActive = -1" :class="tipActive == -1 ? 'tip-active' : ''">
  223. <el-input placeholder="其他金额" v-model="tipAmount" />
  224. </div>
  225. </div>
  226. <!-- 支付方式 -->
  227. <div class="choose-self" style="border: none;">
  228. <div class="self-top">
  229. <span>支付方式</span>
  230. </div>
  231. <div class="pay-list">
  232. <div class="pay-item" @click.stop="paymentType = item.id" :class="paymentType == item.id ? 'pay-active' : '' " v-for="(item, index) in payList" :key="index">
  233. <img :src="item.icon" class="pay-icon" />
  234. <span>{{ item.name }}</span>
  235. </div>
  236. </div>
  237. </div>
  238. </div>
  239. <div style="text-align: center;margin-top: 20px;">
  240. <el-button @click.stop="addTipStatus = false">取消</el-button>
  241. <el-button type="primary" class="submit-btn" @click.stop="richMoney(orderId)">确定</el-button>
  242. </div>
  243. </el-dialog>
  244. <!-- 支付二维码弹出层 -->
  245. <qr-code v-if="showCode" @paySuccess="paySuccess" @refreshCode="recharge" @closeCode="showCode = false" ref="code" :payAmount="payAmount" :link="link" :paymentType="paymentType" :orderSn="orderSn"></qr-code>
  246. </div>
  247. </template>
  248. <script>
  249. import moment from "moment";
  250. import bus from "../../common/bus.js";
  251. import orderMap from "./orderAMap.vue";
  252. import OrderDetail from "./orderDetail.vue";
  253. import orderTrack from "./orderTrack.vue";
  254. import { mapState } from "vuex";
  255. import sendOrderPopup from "./sendOrderPopup.vue";
  256. import qrCode from "../../common/qrCode.vue";
  257. import {
  258. sendValuation,
  259. waimaiprinter,
  260. addRemark,
  261. ignoreOrder,
  262. rollOrder,
  263. setDeliveryTime,
  264. cancelTimingPublish,
  265. cancelOrder,
  266. trackOrder,
  267. detailOrder,
  268. tips,
  269. getPayResult,
  270. getMapData,
  271. } from "../../api/order.js";
  272. export default {
  273. name: "OrderList",
  274. data() {
  275. return {
  276. payAmount: 0,
  277. paymentType: 1, // 1 支付宝 0 微信
  278. payList: [
  279. {
  280. id: 1,
  281. name: "支付宝支付",
  282. icon: "../../../static/image/alipay.png",
  283. },
  284. {
  285. id: 2,
  286. name: "微信支付",
  287. icon: "../../../static/image/we-chat.png",
  288. },
  289. {
  290. id: 4,
  291. name: "余额支付",
  292. icon: "../../../static/image/yu-e.png",
  293. },
  294. ],
  295. tipActive: 0,
  296. tipList: [1, 2, 5, 10, 15, 20, 30, 50],
  297. tipAmount: "", // 小费金额
  298. addTipTimer: null, // 加小费刷新支付计时器
  299. addTipStatus: false, // 加小费弹出层
  300. reasonIndex: null, // 取消原因索引
  301. chooseReason: "", // 选择取消原因
  302. cancelReason: "", // 输入取消原因
  303. cancelList: [
  304. { id: 1, name: "无骑手接单" },
  305. { id: 2, name: "骑手接单后不取货" },
  306. { id: 3, name: "骑手电车装不下" },
  307. { id: 4, name: "计划有变,无需配送" },
  308. { id: 5, name: "骑手服务态度恶劣" },
  309. { id: 6, name: "骑手要求取消订单" },
  310. { id: 7, name: "信息填写错误" },
  311. { id: 8, name: "其他原因" },
  312. ],
  313. timeList: [1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 6, 7, 8, 9, 10, 11, 12],
  314. timeValue: 1, // 定时发单,默认1小时
  315. cancelStatus: false, // 取消订单弹出层
  316. settingTimeStatus: false, // 定时发单弹出层
  317. needTrack: false,
  318. orderDetailStutus: 0,
  319. isLoading: false,
  320. dialogTableVisible: false,
  321. ignoreStatus: false, // 忽略订单弹出层
  322. remark: "",
  323. orderId: "",
  324. item: {},
  325. radio: "",
  326. needTrack: false,
  327. curIdx: 0,
  328. trackOrder: {},
  329. orderDetail: {},
  330. showDetail: false,
  331. showTrack: false,
  332. showCode: false,
  333. link: "",
  334. };
  335. },
  336. props: {
  337. tabNum: Number,
  338. list: Array,
  339. },
  340. components: {
  341. sendOrderPopup,
  342. orderMap,
  343. OrderDetail,
  344. orderTrack,
  345. qrCode,
  346. },
  347. watch: {
  348. tabNum(newVal, oldVal) {
  349. if (newVal === 0 || newVal === 1) {
  350. this.needTrack = false;
  351. this.orderDetailStutus = 0;
  352. } else {
  353. this.needTrack = true;
  354. this.orderDetailStutus = 0;
  355. }
  356. this.curIdx = 0;
  357. },
  358. list(newVal, oldVal) {
  359. this.getDetailOrder();
  360. this.getTrackOrder();
  361. },
  362. addTipStatus(val) {
  363. if (!val) {
  364. clearTimeout(this.addTipTimer);
  365. this.addTipTimer = null;
  366. }
  367. },
  368. },
  369. destroyed() {
  370. clearTimeout(this.addTipTimer);
  371. this.addTipTimer = null;
  372. },
  373. computed: {
  374. ...mapState(["userInfo"]),
  375. },
  376. methods: {
  377. paySuccess() {
  378. this.showCode = false;
  379. this.addTipStatus = false;
  380. bus.$emit("refreshData");
  381. },
  382. richMoney() {
  383. let reg = /(^[1-9]\d*$)/g;
  384. if (this.tipActive == -1) {
  385. if (!reg.test(this.tipAmount * 1)) {
  386. return this.$message({
  387. message: "请选择或输入正确的整数金额",
  388. type: "error",
  389. });
  390. }
  391. }
  392. let params = {
  393. orderId: this.orderId,
  394. tipAmount:
  395. this.tipActive == -1 ? this.tipAmount : this.tipList[this.tipActive],
  396. paymentType: this.paymentType,
  397. createType: 1,
  398. };
  399. tips(params).then((res) => {
  400. if (res.code == 200) {
  401. if (this.paymentType == 4) {
  402. // 余额支付
  403. this.$message({
  404. message: "小费添加成功",
  405. type: "success",
  406. });
  407. bus.$emit("refreshData");
  408. this.addTipStatus = false;
  409. this.tipAmount = "";
  410. clearTimeout(this.addTipTimer);
  411. this.addTipTimer = null;
  412. } else if (this.paymentType == 1 || this.paymentType == 2) {
  413. // 支付宝、微信支付
  414. this.payAmount = res.data.amount || 0;
  415. this.orderSn = res.data.orderSn;
  416. this.link = res.data.data;
  417. this.showCode = true;
  418. }
  419. } else {
  420. this.$message({
  421. message: res.msg,
  422. type: "error",
  423. });
  424. }
  425. });
  426. },
  427. addTip(orderId) {
  428. this.orderId = orderId;
  429. this.addTipStatus = true;
  430. },
  431. changeReason(item) {
  432. this.reasonIndex = item.id;
  433. this.chooseReason = item.name;
  434. },
  435. // 取消订单
  436. commitCancelReason() {
  437. if (!this.reasonIndex) {
  438. return this.$message({
  439. message: "请选择取消原因",
  440. type: "error",
  441. });
  442. }
  443. if (this.reasonIndex == 8 && !this.cancelReason.trim()) {
  444. return this.$message({
  445. message: "请填写其他取消原因",
  446. type: "error",
  447. });
  448. }
  449. cancelOrder({
  450. orderId: this.orderId,
  451. cancelReason:
  452. this.reasonIndex != 8 ? this.chooseReason : this.cancelReason,
  453. }).then((res) => {
  454. this.cancelStatus = false;
  455. if (res.code == 200) {
  456. this.$message({
  457. message: "取消订单成功",
  458. type: "success",
  459. });
  460. this.orderId = "";
  461. this.cancelReason = "";
  462. this.chooseReason = "";
  463. this.reasonIndex = null;
  464. bus.$emit("refreshData");
  465. } else {
  466. this.$message({
  467. message: res.msg,
  468. type: "error",
  469. });
  470. }
  471. });
  472. },
  473. cancalSettingTime() {
  474. cancelTimingPublish({ orderId: this.item.orderId }).then((res) => {
  475. this.settingTimeStatus = false;
  476. if (res.code == 200) {
  477. this.$message({
  478. message: "取消定时发单成功",
  479. type: "success",
  480. });
  481. this.item = {};
  482. bus.$emit("refreshData");
  483. } else {
  484. this.$message({
  485. message: res.msg,
  486. type: "error",
  487. });
  488. }
  489. });
  490. },
  491. commitTimeValue() {
  492. let timestamp = new Date().valueOf();
  493. let exT = moment(this.item.exceptTime).valueOf();
  494. let nowTime = moment(exT)
  495. .subtract(this.timeValue, "hours")
  496. .format("YYYY-MM-DD HH:mm:ss"); //当前时间的前1小时时间
  497. let t1 = moment(nowTime).valueOf(); // 时间戳
  498. console.log(nowTime, this.item, "-------------");
  499. if (t1 - timestamp < 0) {
  500. return this.$message({
  501. message: `设置发单时间超出当前时间`,
  502. type: "error",
  503. });
  504. }
  505. setDeliveryTime({
  506. orderId: this.item.id,
  507. delayTime: this.timeValue,
  508. }).then((res) => {
  509. this.settingTimeStatus = false;
  510. if (res.code == 200) {
  511. this.$message({
  512. message: "设置定时发单成功",
  513. type: "success",
  514. });
  515. this.item = {};
  516. bus.$emit("refreshData");
  517. } else {
  518. this.$message({
  519. message: res.msg,
  520. type: "error",
  521. });
  522. }
  523. });
  524. },
  525. // 定时发单
  526. settingTime(item) {
  527. this.item = item;
  528. this.settingTimeStatus = true;
  529. this.timeValue = item.delayTime ? item.delayTime : 1;
  530. },
  531. // 取消订单
  532. cancelOrder(orderId) {
  533. this.orderId = orderId;
  534. this.cancelStatus = true;
  535. },
  536. chooseOrder(v, index) {
  537. this.curIdx = index;
  538. this.getDetailOrder();
  539. this.getTrackOrder();
  540. },
  541. changeRadio(i) {
  542. this.radio = i;
  543. },
  544. // 忽略订单
  545. iGnoreOrder(orderId) {
  546. this.orderId = orderId;
  547. this.ignoreStatus = true;
  548. },
  549. commitIGnore(orderId) {
  550. if (!this.radio) {
  551. return this.$message({
  552. message: "请选择忽略原因",
  553. type: "error",
  554. });
  555. }
  556. let params = {
  557. orderId,
  558. ignoreReason: this.radio == 1 ? 0 : 1,
  559. };
  560. ignoreOrder(params).then((res) => {
  561. this.ignoreStatus = false;
  562. if (res.code == 200) {
  563. this.$message({
  564. message: "操作成功",
  565. type: "success",
  566. });
  567. bus.$emit("refreshData");
  568. } else {
  569. this.$message({
  570. message: res.msg,
  571. type: "error",
  572. });
  573. }
  574. });
  575. },
  576. itemAddRemark(orderId, item) {
  577. this.dialogTableVisible = true;
  578. this.orderId = orderId;
  579. this.item = item;
  580. this.remark = item.takeRemark || "";
  581. },
  582. // 一键发单备注
  583. commitRemark(orderId, item) {
  584. let params = {
  585. orderId,
  586. remark: this.remark.trim(),
  587. };
  588. addRemark(params).then((res) => {
  589. this.dialogTableVisible = false;
  590. if (res.code == 200) {
  591. this.$message({
  592. message: "添加备注成功",
  593. type: "success",
  594. });
  595. this.$set(
  596. this.list.find((v) => {
  597. return item.id == v.id;
  598. }),
  599. "takeRemark",
  600. this.remark
  601. );
  602. this.$forceUpdate();
  603. } else {
  604. this.$message({
  605. message: res.msg,
  606. type: "error",
  607. });
  608. }
  609. });
  610. },
  611. // 查看地图
  612. checkMap(item) {
  613. getMapData({ orderId: item.id }).then((res) => {
  614. if (res.code === 200) {
  615. console.log(res.data);
  616. this.$refs.orderMap.setDialogStatus(item, res.data);
  617. } else {
  618. this.$message({
  619. type: "error",
  620. message: res.msg,
  621. });
  622. }
  623. });
  624. },
  625. deleteItem(item) {
  626. this.getValuation(item);
  627. },
  628. // 撤回订单
  629. orderBack(orderId) {
  630. rollOrder({ orderId }).then((res) => {
  631. if (res.code == 200) {
  632. this.$message({
  633. message: "操作成功",
  634. type: "success",
  635. });
  636. bus.$emit("refreshData");
  637. } else {
  638. this.$message({
  639. message: res.msg,
  640. type: "error",
  641. });
  642. }
  643. });
  644. },
  645. // 补打发票
  646. orderPrinter(waimaiId) {
  647. if (!waimaiId) return;
  648. waimaiprinter({ waimaiId }).then((res) => {
  649. if (res.code == 200) {
  650. this.$message({
  651. message: "操作成功",
  652. type: "success",
  653. });
  654. } else {
  655. this.$message({
  656. message: res.msg,
  657. type: "error",
  658. });
  659. }
  660. });
  661. },
  662. // 计价
  663. getValuation(order) {
  664. let requestData = {
  665. productId: order.productId,
  666. transport: 0,
  667. productAmount: 50,
  668. sendAddress: {
  669. id: order.sendAddressId,
  670. provinceName: order.sendProvinceName,
  671. cityName: order.sendCityName,
  672. districtName: order.sendDistrictName,
  673. street: order.sendStreet,
  674. lat: order.sendLat,
  675. lng: order.sendLng,
  676. phone: order.sendPhone,
  677. extension: order.sendExtension,
  678. contact: order.sendContactName,
  679. address: order.sendAddress,
  680. cityCode: order.sendCityCode,
  681. },
  682. receiptAddress: {
  683. id: order.receiptAddressId,
  684. provinceName: order.receiptProvince,
  685. cityName: order.receiptCityName,
  686. districtName: order.receiptDistrictName,
  687. lat: order.receiptLat,
  688. lng: order.receiptLng,
  689. phone: order.receiptPhone,
  690. extension: order.receiptExtension,
  691. contact: order.receiptContactName,
  692. street: order.receiptStreet || "",
  693. address: order.receiptAddress,
  694. cityCode: order.receiptCityCode,
  695. },
  696. takeTime: order.takeTime,
  697. weight: order.weight,
  698. takeType: order.takeType,
  699. type: this.userInfo.memberType == 1 ? 1 : 2,
  700. isWaimai: order.waimaiId ? true : false,
  701. waimaiOrderId: order.waimaiOrderId,
  702. takeRemark: order.takeRemark || "",
  703. orderId: order.id,
  704. };
  705. this.isLoading = true;
  706. sendValuation(requestData).then((res) => {
  707. console.log(res, "发起配送计算");
  708. this.isLoading = false;
  709. if (res.code == 200) {
  710. res.data.optionals.forEach((item) => {
  711. item.optionals = item.optionals ? item.optionals : [];
  712. item.lowOptionals = item.lowOptionals ? item.lowOptionals : [];
  713. item.supports = item.supports ? item.supports : [];
  714. });
  715. this.$refs.sendOrderPopup.init(res.data, {
  716. ...requestData,
  717. orderId: order.id,
  718. orderSn: order.orderSn,
  719. });
  720. }
  721. });
  722. },
  723. // 订单详情
  724. getDetailOrder() {
  725. this.showDetail = false;
  726. if (this.list.length) {
  727. this.orderId = this.list[this.curIdx].id;
  728. } else {
  729. return;
  730. }
  731. detailOrder({ orderId: this.orderId }).then((res) => {
  732. if (res.code === 200) {
  733. this.orderDetail = res.data;
  734. this.showDetail = true;
  735. } else {
  736. this.$message({
  737. message: res.msg,
  738. type: "error",
  739. });
  740. }
  741. });
  742. },
  743. // 订单跟踪
  744. getTrackOrder() {
  745. this.showTrack = false;
  746. if (this.list.length) {
  747. this.orderId = this.list[this.curIdx].id;
  748. } else {
  749. return;
  750. }
  751. if (this.tabNum < 2) return;
  752. trackOrder({ orderId: this.orderId }).then((res) => {
  753. if (res.code === 200) {
  754. this.trackOrder = res.data;
  755. this.showTrack = true;
  756. } else {
  757. this.$message({
  758. message: res.msg,
  759. type: "error",
  760. });
  761. }
  762. });
  763. },
  764. showCancelType(type) {
  765. let name = "";
  766. switch (type) {
  767. case 1:
  768. name = "商家取消";
  769. break;
  770. case 2:
  771. name = "骑手取消";
  772. break;
  773. case 3:
  774. name = "系统取消";
  775. break;
  776. case 4:
  777. name = "用户取消";
  778. break;
  779. case 5:
  780. name = "平台取消";
  781. break;
  782. default:
  783. break;
  784. }
  785. return name;
  786. },
  787. showDeliveryStatus(item) {
  788. let name = "";
  789. if (item.wmstatus === 4) {
  790. name = "其他平台完成";
  791. }
  792. if (item.deliveryStatus === 4) {
  793. name = "已完成";
  794. }
  795. if (item.deliveryStatus === -1) {
  796. name = "已取消";
  797. }
  798. return name;
  799. },
  800. },
  801. };
  802. </script>
  803. <!-- Add "scoped" attribute to limit CSS to this component only -->
  804. <style lang="scss" scoped="scoped">
  805. .choose-self {
  806. padding-top: 25px;
  807. border-bottom: 1px solid #eee;
  808. .self-top {
  809. display: flex;
  810. align-items: center;
  811. margin-bottom: 11px;
  812. .choose-self-icon {
  813. width: 4px;
  814. height: 15px;
  815. margin-right: 10px;
  816. }
  817. span {
  818. font-size: 14px;
  819. font-family: PingFang SC;
  820. font-weight: 400;
  821. color: #92959b;
  822. }
  823. }
  824. .pay-list {
  825. display: flex;
  826. align-items: center;
  827. padding-top: 10px;
  828. .pay-item {
  829. flex: 1;
  830. display: flex;
  831. justify-content: center;
  832. text-align: center;
  833. align-items: center;
  834. height: 51px;
  835. border: 1px solid #eee;
  836. border-radius: 8px;
  837. cursor: pointer;
  838. &.pay-active {
  839. border-color: #fc7200;
  840. }
  841. &:nth-child(2) {
  842. margin: 0 13px;
  843. }
  844. span {
  845. font-size: 14px;
  846. font-family: PingFang SC;
  847. font-weight: bold;
  848. color: #222222;
  849. }
  850. .pay-icon {
  851. margin-right: 6px;
  852. }
  853. .pay-icon:nth-child(1) {
  854. width: 25px;
  855. height: 24px;
  856. }
  857. }
  858. }
  859. }
  860. .tip-title {
  861. font-size: 14px;
  862. font-family: PingFang SC;
  863. font-weight: 400;
  864. color: #92959b;
  865. padding-bottom: 13px;
  866. }
  867. .tip-list {
  868. display: flex;
  869. flex-wrap: wrap;
  870. .tip-item {
  871. margin-right: 10px;
  872. margin-bottom: 10px;
  873. width: 93px;
  874. height: 38px;
  875. line-height: 38px;
  876. text-align: center;
  877. font-size: 13px;
  878. font-family: PingFang SC;
  879. font-weight: 400;
  880. color: #222222;
  881. box-sizing: border-box;
  882. background: #f4f4f4;
  883. cursor: pointer;
  884. border-radius: 2px;
  885. border: 1px solid transparent;
  886. /deep/ .el-input__inner {
  887. border: none;
  888. height: 32px !important;
  889. background-color: #f4f4f4;
  890. font-size: 13px;
  891. padding: 0 15px !important;
  892. }
  893. }
  894. .tip-active {
  895. border-color: #fc7200;
  896. color: #fc7200;
  897. }
  898. }
  899. .text-area {
  900. /deep/ .el-textarea__inner {
  901. background-color: #f2f2f2;
  902. border: none;
  903. }
  904. }
  905. .cancel-list {
  906. display: flex;
  907. flex-wrap: wrap;
  908. .item {
  909. color: #222;
  910. width: 193px;
  911. height: 50px;
  912. line-height: 50px;
  913. box-sizing: border-box;
  914. text-align: center;
  915. font-size: 16px;
  916. border: 2px solid #d7d7d7;
  917. border-radius: 6px;
  918. margin-right: 20px;
  919. margin-bottom: 20px;
  920. cursor: pointer;
  921. &:last-child {
  922. color: #d7d7d7;
  923. }
  924. &.active {
  925. color: #fc7101;
  926. border-color: #fc7101;
  927. }
  928. }
  929. .no-margin {
  930. margin-right: 0 !important;
  931. }
  932. }
  933. .ignore-modal {
  934. .title {
  935. font-size: 14px;
  936. font-family: PingFang SC;
  937. font-weight: 400;
  938. color: #92959b;
  939. }
  940. .check-item {
  941. display: flex;
  942. align-items: center;
  943. margin-top: 20px;
  944. .radio {
  945. width: 14px;
  946. height: 14px;
  947. margin-right: 6px;
  948. }
  949. span {
  950. font-size: 14px;
  951. font-family: PingFang SC;
  952. font-weight: 400;
  953. color: #222222;
  954. }
  955. }
  956. }
  957. .submit-btn {
  958. border: none !important;
  959. background-color: #fc7200;
  960. }
  961. .empty-data {
  962. font-size: 0;
  963. text-align: center;
  964. background-color: #fff;
  965. padding: 100px 0;
  966. img {
  967. width: 349px;
  968. height: 222px;
  969. }
  970. }
  971. .active-order-item {
  972. border: 2px solid #fc7200;
  973. height: 136px !important;
  974. width: calc(100% - 4px) !important;
  975. }
  976. .order_item {
  977. width: 100%;
  978. height: 140px;
  979. background: #fff;
  980. margin-bottom: 10px;
  981. border-radius: 5px;
  982. .order_item_header {
  983. width: 100%;
  984. height: 49px;
  985. display: flex;
  986. align-items: center;
  987. border-bottom: 1px solid #f0f0f0;
  988. position: relative;
  989. display: flex;
  990. align-items: center;
  991. justify-content: space-between;
  992. padding-right: 10px;
  993. box-sizing: border-box;
  994. .order_item_header_l,
  995. .order_item_header_r {
  996. display: flex;
  997. align-items: center;
  998. }
  999. .Serial_number {
  1000. width: 60px;
  1001. height: 26px;
  1002. background: #fc7200;
  1003. border-radius: 0 30px 30px 0;
  1004. font-size: 10px;
  1005. font-weight: 500;
  1006. color: #ffffff;
  1007. text-align: center;
  1008. line-height: 26px;
  1009. }
  1010. .logo {
  1011. width: 21px;
  1012. height: 21px;
  1013. border-radius: 50%;
  1014. margin-left: 23px;
  1015. }
  1016. .name {
  1017. font-size: 14px;
  1018. font-weight: 500;
  1019. color: #333333;
  1020. margin-left: 5px;
  1021. }
  1022. .sign_time {
  1023. padding: 0 8px;
  1024. height: 20px;
  1025. border: 1px solid #009cff;
  1026. background: #f2faff;
  1027. border-radius: 2px;
  1028. text-align: center;
  1029. line-height: 20px;
  1030. font-size: 12px;
  1031. font-weight: 600;
  1032. color: #009cff;
  1033. margin-left: 15px;
  1034. }
  1035. .sign_txt {
  1036. width: 64px;
  1037. height: 20px;
  1038. border: 1px solid #009cff;
  1039. background: #f2faff;
  1040. border-radius: 2px;
  1041. text-align: center;
  1042. line-height: 20px;
  1043. font-size: 12px;
  1044. font-weight: 600;
  1045. color: #009cff;
  1046. margin-left: 10px;
  1047. }
  1048. .sign_d {
  1049. height: 20px;
  1050. border: 1px solid #f74141;
  1051. background: #fff5f5;
  1052. border-radius: 2px;
  1053. text-align: center;
  1054. line-height: 20px;
  1055. font-size: 12px;
  1056. font-weight: 600;
  1057. color: #f74141;
  1058. margin-left: 10px;
  1059. padding: 0 7px;
  1060. }
  1061. .header_r {
  1062. font-size: 14px;
  1063. font-weight: 400;
  1064. color: #333333;
  1065. margin-right: 22px;
  1066. }
  1067. .btn {
  1068. background: #fc7200;
  1069. border-color: #fc7200;
  1070. color: #fff;
  1071. // position: absolute;
  1072. // right: 10px;
  1073. }
  1074. }
  1075. .order_item_cont {
  1076. display: flex;
  1077. flex-direction: column;
  1078. justify-content: space-evenly;
  1079. padding: 5px 20px;
  1080. height: 80px;
  1081. }
  1082. .address span {
  1083. cursor: pointer;
  1084. font-size: 12px;
  1085. color: #b1b1b1;
  1086. }
  1087. }
  1088. .itme_r {
  1089. font-size: 14px;
  1090. font-weight: 400;
  1091. color: #b1b1b1;
  1092. }
  1093. .order_detail {
  1094. width: 100%;
  1095. border-left: 10px solid #f1f2f5;
  1096. background: #fff;
  1097. box-sizing: border-box;
  1098. border-left: 10px solid #f1f2f5;
  1099. .detail_title {
  1100. width: 100%;
  1101. height: 44px;
  1102. background: #fafafa;
  1103. padding-left: 16px;
  1104. box-sizing: border-box;
  1105. display: flex;
  1106. align-items: center;
  1107. font-size: 12px;
  1108. font-weight: 600;
  1109. display: flex;
  1110. align-items: flex-end;
  1111. .detail_txt {
  1112. color: #b1b1b1;
  1113. padding-bottom: 13px;
  1114. border-bottom: 2px solid #fafafa;
  1115. margin-right: 28px;
  1116. cursor: pointer;
  1117. }
  1118. .detail_txt_ac {
  1119. color: #00152a;
  1120. border-color: #00152a;
  1121. }
  1122. }
  1123. .btns {
  1124. margin: 10px 15px;
  1125. display: flex;
  1126. flex-wrap: wrap;
  1127. justify-content: space-between;
  1128. .btn {
  1129. background: #fc7200;
  1130. border-color: #fc7200;
  1131. color: #fff !important;
  1132. }
  1133. .btn_bots {
  1134. margin: 0 !important;
  1135. margin-bottom: 10px !important;
  1136. }
  1137. .btn_bot {
  1138. width: 74px;
  1139. display: flex;
  1140. align-items: center;
  1141. justify-content: center;
  1142. color: #888888;
  1143. margin-bottom: 10px !important;
  1144. .el-dropdown-link {
  1145. cursor: pointer;
  1146. }
  1147. }
  1148. }
  1149. .detail_cont {
  1150. width: 100%;
  1151. padding: 16px;
  1152. box-sizing: border-box;
  1153. .detail_title2 {
  1154. width: 100%;
  1155. font-size: 12px;
  1156. font-weight: 600;
  1157. color: #777777;
  1158. margin-bottom: 15px;
  1159. }
  1160. .shop_detail {
  1161. width: 100%;
  1162. display: flex;
  1163. margin-bottom: 10px;
  1164. img {
  1165. width: 47px;
  1166. height: 47px;
  1167. border-radius: 4px 4px 4px 4px;
  1168. margin-right: 12px;
  1169. }
  1170. .info {
  1171. flex-grow: 1;
  1172. display: flex;
  1173. justify-content: space-between;
  1174. .shop_title {
  1175. width: 70%;
  1176. font-size: 14px;
  1177. font-weight: 500;
  1178. color: #333333;
  1179. line-height: 18px;
  1180. }
  1181. .shop_num {
  1182. color: #b1b1b1;
  1183. }
  1184. }
  1185. }
  1186. .detail_ine {
  1187. width: 100%;
  1188. height: 1px;
  1189. border-top: 2px dotted #f0f0f0;
  1190. margin: 16px 0;
  1191. }
  1192. .info2 {
  1193. width: 100%;
  1194. display: flex;
  1195. .title {
  1196. font-size: 14px;
  1197. font-weight: 400;
  1198. width: 80px;
  1199. color: #b1b1b1;
  1200. }
  1201. .cont {
  1202. font-size: 14px;
  1203. font-weight: 400;
  1204. color: #333333;
  1205. line-height: 20px;
  1206. }
  1207. .cont2 {
  1208. color: #fc7200;
  1209. }
  1210. }
  1211. .info3 {
  1212. margin-top: 10px;
  1213. }
  1214. .info4 {
  1215. display: flex;
  1216. justify-content: space-between;
  1217. }
  1218. .btns {
  1219. margin-top: 30px;
  1220. .btn {
  1221. background: #fc7200;
  1222. border-color: #fc7200;
  1223. color: #fff;
  1224. }
  1225. }
  1226. }
  1227. }
  1228. </style>