index.vue 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157
  1. <template>
  2. <view class="flex-common-css box-border-box">
  3. <Nav class="nav-b" :leftShow='false' :customNav='true' bgckgroundBox='#fff'>
  4. <template>
  5. <view slot="custom" class="text-align-center fw-600 fs-36">
  6. 我的订单
  7. </view>
  8. </template>
  9. </Nav>
  10. <view class="nav-box box-border-box bgc-f display-flex">
  11. <view class="nav-item flex-1 text-align-center" :class="type == item.id?'fs-36 fw-600':'fs-34 fw-400'"
  12. v-for="(item,i) in navList" :key="i" @click="selectType(item.id)">
  13. {{item.name}}
  14. <view v-if="type == item.id" class="nav-item-x"></view>
  15. </view>
  16. </view>
  17. <scroll-view class="nav-type-box bgc-f p-12-24 box-border-box" :scroll-x="true">
  18. <view class="nav-type-item text-align-center fs-28" v-for="(item,index) in navTypeData"
  19. @click="navTypeClick(item.key)"
  20. :class="navTypeKey== item.key?'bgc-E4F3FD fw-600 fc-41ABF5':'bgc-F4F5F7 fw-400 fc-3'">
  21. {{item.name}}
  22. </view>
  23. </scroll-view>
  24. <view v-if="list.length == 0" class="scroll-view-css">
  25. <EnBlank :customSrc='true'>
  26. <template v-slot:blankImg>
  27. <image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
  28. </template>
  29. </EnBlank>
  30. </view>
  31. <scroll-view v-else :scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
  32. <view class="list-box">
  33. <view class="list-item bgc-f b-rad-20 mb-32 p-24 box-border-box" v-for="(item,index) in list"
  34. @click="goToInfo(item)">
  35. <view class="align-items-center flex-justify-space mb-24">
  36. <view class="align-items-center">
  37. <image v-if="item.site_logo" class="shops-img" :src="item.site_logo" mode="aspectFit">
  38. </image>
  39. <image v-else-if="item.shop_logo" class="shops-img" :src="item.shop_logo" mode="aspectFit">
  40. </image>
  41. <image v-else-if="item.errands.img" class="shops-img" :src="item.errands.img"
  42. mode="aspectFit">
  43. </image>
  44. <image v-else class="shops-img" src="@/static/img/logo/logo.png" mode=""></image>
  45. <view v-if="item.site_name" class="fs-32 fc-3 fw-600 shops-name text-overflow-ellipsis-one">
  46. {{item.site_name}}
  47. </view>
  48. <view @click="goToShop(item)" v-else-if="item.shop_name"
  49. class="fs-32 fc-3 fw-600 shops-name text-overflow-ellipsis-one">
  50. {{item.shop_name}}
  51. </view>
  52. <view v-else-if="item.errands.name"
  53. class="fs-32 fc-3 fw-600 shops-name text-overflow-ellipsis-one">
  54. {{item.errands.name}}
  55. </view>
  56. <view v-else class="fs-32 fc-3 fw-600 shops-name text-overflow-ellipsis-one">
  57. 君子校园
  58. </view>
  59. <!-- <image class="icons" src="@/static/img/toRight.png" mode=""></image> -->
  60. </view>
  61. <view class="fc-41ABF5 fs-28">
  62. {{item.order_status_str}}
  63. </view>
  64. </view>
  65. <view class="align-items-center flex-justify-space mb-24">
  66. <view class="goods-box" v-if="type == 1 || type == 2 || type == 5">
  67. <view class="" v-if="item.item.length == 1">
  68. <view class="align-items-center" v-for="(itemGoods,indexGoods) in item.item">
  69. <image class="goods-img flex-shrink0" :src="itemGoods.goods_img" mode="aspectFit">
  70. </image>
  71. <view class="fs-28 fc-6 text-overflow-ellipsis">
  72. {{itemGoods.goods_name}}
  73. </view>
  74. </view>
  75. </view>
  76. <view class="align-items-center goods-two" v-else>
  77. <view class="flex-direction" v-for="(itemGoods,indexGoods) in item.item">
  78. <image class="goods-img flex-shrink0" :src="itemGoods.goods_img" mode="aspectFit">
  79. </image>
  80. <view
  81. class="fs-28 fc-6 text-overflow-ellipsis-one goods-two-name text-align-center">
  82. {{itemGoods.goods_name}}
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. <view class="" v-else-if='type == 3'>
  88. <view class="align-items-center">
  89. <image class="goods-img flex-shrink0" :src="item.goods_img" mode="aspectFit">
  90. </image>
  91. <view class="fs-28 fc-6 text-overflow-ellipsis">
  92. {{item.goods_name}}
  93. </view>
  94. </view>
  95. </view>
  96. <view class="" v-else='type === 4'>
  97. {{item.serve_desc}}
  98. </view>
  99. <view class="goods-box" v-else>
  100. <view class="align-items-center">
  101. <image class="goods-img flex-shrink0" :src="item.goods_img" mode="aspectFit">
  102. </image>
  103. <view class="fs-28 fc-6 text-overflow-ellipsis">
  104. {{item.goods_name}}
  105. </view>
  106. </view>
  107. </view>
  108. <view class="goods-num text-align-center" v-if="type != 4">
  109. 共 {{item.goods_number}} 件
  110. </view>
  111. </view>
  112. <view class="align-items-center flex-justify-space mb-24">
  113. <view class="fs-24 fc-9">
  114. 下单时间:{{item.created_at}}
  115. </view>
  116. <view class="fs-28 fc-9">
  117. {{item.order_status == 1?'需付':'实付'}} <text
  118. class="fs-32 fc-3 fw-600">¥{{item.pay_money}}</text>
  119. </view>
  120. </view>
  121. <view class="align-items-center flex-justify-end">
  122. <view class="item-but but-class-two fs-28 mr-18" @click="assess(item)"
  123. v-if="type == 1 && item.order_status == 7 && item.is_comment == 0">
  124. 评价
  125. </view>
  126. <view class="item-but but-class-two fs-28 mr-18" @click.stop="tackOut(item)"
  127. v-if="type == 1 && item.order_status == 2 || type == 1 && item.order_status == 4">
  128. <!-- 外卖 -->
  129. 取消订单
  130. </view>
  131. <view class="item-but but-class-two fs-28 mr-18" @click.stop="cancel(item)"
  132. v-if="type == 4 && item.order_status == 2">
  133. <!-- 跑腿 -->
  134. 取消订单
  135. </view>
  136. <view class="item-but but-class-two fs-28 mr-18" @click.stop="expressCancel(item)"
  137. v-if="type == 2 && item.order_status == 2">
  138. <!-- 代取 -->
  139. 取消订单
  140. </view>
  141. <view class="item-but but-class-one fs-28 mr-18" @click.stop="orderPay(item)"
  142. v-if="item.order_status == 1">
  143. 立即支付
  144. </view>
  145. <view class="item-but but-class-one fs-28" @click.stop="openCode(item)"
  146. v-if="type == 5 && item.order_status == 2 || type == 5 && item.order_status == 4">
  147. 二维码
  148. </view>
  149. <view class="item-but but-class-two fs-28 mr-18" @click.stop="goCode(item)"
  150. v-if="type == 3 && item.order_status == 2">
  151. <!-- 代取 -->
  152. 查看券码
  153. </view>
  154. <view @click.stop="goToUrl('takeOut', item)" class="item-but but-class-one fs-28 mr-18"
  155. v-if="type == 1 && item.order_status == 3 || type == 1 && item.order_status == 7 || type == 1 && item.order_status == 8 || type == 1 && item.order_status == 9 || type == 1 && item.order_status == 10">
  156. <!-- 外卖 -->
  157. 再来一单
  158. </view>
  159. <view @click.stop="goToUrl('express', item)" class="item-but but-class-one fs-28 mr-18"
  160. v-if="type == 2 && item.order_status == 4 || type == 2 && item.order_status == 5 || type == 2 && item.order_status == 6">
  161. <!-- 代取 -->
  162. 再来一单
  163. </view>
  164. <view @click.stop="goToUrl('group', item)" class="item-but but-class-one fs-28 mr-18"
  165. v-if="type == 3 && item.order_status == 2 || type == 3 && item.order_status == 4">
  166. <!-- 团购 -->
  167. 再来一单
  168. </view>
  169. <view @click.stop="goToUrl('errands', item)" class="item-but but-class-one fs-28 mr-18"
  170. v-if="type == 4 && item.order_status == 2 || type == 4 && item.order_status == 4">
  171. <!-- 跑腿 -->
  172. 再来一单
  173. </view>
  174. <view @click.stop="goToUrl('laundry', item)" class="item-but but-class-one fs-28 mr-18"
  175. v-if="type == 5 && item.order_status == 5 || type == 5 && item.order_status == 6 || type == 5 && item.order_status == 7">
  176. <!-- 干洗 -->
  177. 再来一单
  178. </view>
  179. </view>
  180. </view>
  181. </view>
  182. </scroll-view>
  183. <uni-popup ref="popup" border-radius="10px 10px 10px 10px" @maskClick='maskClick'>
  184. <view class="bgc-f p-16 box-border-box b-rad-20" v-if="qrcodeData">
  185. <!-- <UniQrcode :text="qrcodeData"></UniQrcode> -->
  186. <uv-qrcode class="b-rad-20" ref="qrcode" :value="qrcodeData" :options="options2"></uv-qrcode>
  187. <view class="text-align-center fs-38">
  188. {{onlyCode}}
  189. </view>
  190. </view>
  191. </uni-popup>
  192. <uni-popup ref="popupReason" type="bottom" :is-mask-click="false" background-color="#fff" border-radius="10px 10px 0 0">
  193. <view class="popup-reason-box flex-direction">
  194. <view class="text-align-center fs-38 fw-600 fc-3 mb-18">
  195. 选择取消原因
  196. </view>
  197. <picker-view @change="bindChange" class="picker-view flex-1" :immediate-change='true'>
  198. <picker-view-column>
  199. <view class="picker-view-item" v-for="(item,index) in refundReason" :key="index">
  200. {{item.refund_msg}}
  201. </view>
  202. </picker-view-column>
  203. </picker-view>
  204. <view class="align-items-center flex-justify-space">
  205. <view class="flex-1 mr-20 pop-b text-align-center fs-36 b-r-ccc" @click="popCancel">
  206. 取消
  207. </view>
  208. <view class="flex-1 pop-b text-align-center bgc-41ABF5 fc-f fs-36" @click="popSure">
  209. 确定
  210. </view>
  211. </view>
  212. </view>
  213. </uni-popup>
  214. </view>
  215. </template>
  216. <script>
  217. // import UniQrcode from 'uniapp-qrcode'
  218. import tools from '@/service/tools';
  219. import EnBlank from "@/components/en-utils/en-blank/en-blank";
  220. import {
  221. commonRefundReason
  222. } from "@/api/common.js"
  223. import {
  224. orderStatus,
  225. orderList,
  226. orderCancel,
  227. orderPay
  228. } from "@/api/order.js"
  229. import {
  230. getExpressPay
  231. } from "@/api/express.js"
  232. import {
  233. expressOrderStatus,
  234. expressOrderList,
  235. expressOrderCancel
  236. } from "@/api/expressOrder.js"
  237. import {
  238. groupPay
  239. } from '@/api/groupOrder.js';
  240. import {
  241. errandsOrderStatus,
  242. errandsOrderPay,
  243. errandsOrderList,
  244. errandsOrderCancel
  245. } from "@/api/errandsOrder.js"
  246. import {
  247. groupOrderStatus,
  248. groupOrderList
  249. } from "@/api/groupOrder.js"
  250. import {
  251. laundryOrderStatus,
  252. laundryOrderList,
  253. laundryOrderCancel,
  254. laundryPay
  255. } from "@/api/laundryOrder.js"
  256. export default {
  257. components: {
  258. EnBlank
  259. },
  260. data() {
  261. return {
  262. type: 1,
  263. navList: [{
  264. name: '外卖',
  265. id: 1
  266. },
  267. {
  268. name: '代取',
  269. id: 2
  270. },
  271. {
  272. name: '团购',
  273. id: 3
  274. },
  275. {
  276. name: '跑腿',
  277. id: 4
  278. }
  279. ],
  280. page: 1,
  281. list: [],
  282. total: 0,
  283. navTypeData: [],
  284. navTypeKey: 0,
  285. isAjax: false,
  286. qrcodeData: '',
  287. options2: {},
  288. onlyCode: '',
  289. refundReason: [],
  290. order_id: 0,
  291. refund_msg: '', // 退款理由
  292. sureType: 0
  293. };
  294. },
  295. onShow() {
  296. setTimeout(() => {
  297. uni.showTabBar()
  298. }, 400)
  299. let orderPayType = uni.getStorageSync('orderPayType')
  300. let orderInfoType = uni.getStorageSync('orderInfoType')
  301. console.log(orderPayType, 'orderPayType');
  302. console.log(orderInfoType, 'orderInfoType');
  303. if (orderPayType) {
  304. this.selectType(orderPayType)
  305. console.log('固定type');
  306. } else if (orderInfoType) {
  307. } else {
  308. this.resetList();
  309. }
  310. uni.$on('takeOutData', (data) => {
  311. console.log(data, '^^^^^^^^^^^^^^^^^^^^^^^^^');
  312. this.list.forEach((v, k) => {
  313. if (v.id == data.id) {
  314. v.order_status = data.order_status
  315. v.order_status_str = data.order_status_str
  316. }
  317. })
  318. this.$forceUpdate()
  319. uni.removeStorageSync('orderInfoType')
  320. console.log(this.list, 'this.list');
  321. })
  322. },
  323. onLoad() {},
  324. onHide() {
  325. console.log("onHide");
  326. uni.removeStorageSync('orderPayType')
  327. },
  328. onUnload() {
  329. console.log("onUnload");
  330. },
  331. mounted() {},
  332. methods: {
  333. goCode(item) {
  334. uni.navigateTo({
  335. url: '/pages-buy/group-code?order_id=' + item.id
  336. })
  337. },
  338. openCode(item) {
  339. this.onlyCode = item.only_code
  340. let m_id = uni.getStorageSync('m_id');
  341. this.qrcodeData = m_id + "_" + item.order_sn
  342. this.options2 = {
  343. size: 300,
  344. margin: 10
  345. }
  346. uni.hideTabBar()
  347. this.$refs.popup.open('center')
  348. },
  349. maskClick() {
  350. this.$refs.popup.close()
  351. this.qrcodeData = ''
  352. uni.showTabBar()
  353. },
  354. goToShop(item) {
  355. // 进入店铺
  356. uni.navigateTo({
  357. url: '/pages-takeout/shop?shop_id=' + item.shop_id
  358. })
  359. },
  360. goToUrl(type, item) {
  361. // 再来一单
  362. if (type == 'takeOut') {
  363. // uni.navigateTo({
  364. // url: '/pages-takeout/takeout'
  365. // })
  366. uni.navigateTo({
  367. url: '/pages-takeout/shop?shop_id=' + item.shop_id
  368. })
  369. } else if (type == 'express') {
  370. uni.navigateTo({
  371. url: '/pages-takeout/replace-take'
  372. })
  373. } else if (type == 'group') {
  374. uni.navigateTo({
  375. url: '/pages-buy/group-shop?shop_id=' + item.shop_id
  376. })
  377. } else if (type == 'errands') {
  378. uni.navigateTo({
  379. url: '/pages-takeout/run-errands'
  380. })
  381. } else if (type == 'laundry') {
  382. uni.navigateTo({
  383. url: '/pages-buy/dry-clean'
  384. })
  385. }
  386. },
  387. goToInfo(item) {
  388. if (this.type === 1) {
  389. uni.navigateTo({
  390. url: `/pages-order/takeout-info?orderId=` + item.id
  391. })
  392. } else if (this.type === 2) {
  393. uni.navigateTo({
  394. url: `/pages-order/express-info?orderId=` + item.id
  395. })
  396. } else if (this.type === 3) {
  397. uni.navigateTo({
  398. url: `/pages-order/group-info?orderId=` + item.id
  399. })
  400. } else if (this.type === 4) {
  401. uni.navigateTo({
  402. url: `/pages-order/run-errands-info?orderId=` + item.id
  403. })
  404. } else if (this.type === 5) {
  405. uni.navigateTo({
  406. url: `/pages-order/laundry-info?orderId=` + item.id
  407. })
  408. }
  409. uni.setStorageSync('orderInfoType', this.type)
  410. },
  411. orderPay(item) {
  412. // 立即支付
  413. if (this.type === 1) {
  414. this.takeawayPay(item.id)
  415. } else if (this.type === 2) {
  416. this.getExpressPay(item.id)
  417. } else if (this.type === 3) {
  418. this.groupPay(item.id)
  419. } else if (this.type === 4) {
  420. this.errandsOrderPay(item.id)
  421. } else if (this.type === 5) {
  422. this.laundryPay(item.id)
  423. }
  424. },
  425. navTypeClick(key) {
  426. if (this.navTypeKey != key) {
  427. this.navTypeKey = key
  428. this.page = 1
  429. this.list = []
  430. if (this.type === 1) {
  431. this.orderList()
  432. } else if (this.type === 2) {
  433. this.expressOrderList()
  434. } else if (this.type === 3) {
  435. this.groupOrderList()
  436. } else if (this.type === 4) {
  437. this.errandsOrderList()
  438. } else if (this.type === 5) {
  439. this.laundryOrderList()
  440. }
  441. }
  442. },
  443. resetList() {
  444. this.page = 1;
  445. this.list = [];
  446. this.getList();
  447. uni.removeStorageSync('orderPayType')
  448. },
  449. selectType(type) {
  450. let orderPayType = uni.getStorageSync('orderPayType')
  451. if (type != this.type || orderPayType) {
  452. this.type = type;
  453. this.navTypeKey = 0
  454. this.resetList();
  455. }
  456. },
  457. assess(item) {
  458. // 外卖评价
  459. uni.navigateTo({
  460. url: `/pages-my/appraise?orderId=` + item.id + '&shopName=' + item.shop_name + '&shopLogo=' +
  461. item.shop_logo
  462. })
  463. },
  464. popCancel() {
  465. // 退款取消
  466. this.$refs.popupReason.close()
  467. uni.showTabBar()
  468. },
  469. popSure() {
  470. // 退款确认
  471. if (this.sureType === 1) {
  472. // 外卖退款
  473. if (this.isAJAX) {
  474. return
  475. }
  476. this.isAJAX = true;
  477. orderCancel({
  478. order_id: this.order_id,
  479. refund_msg: this.refund_msg
  480. }).then((res) => {
  481. if (res.code == 1) {
  482. tools.success(res.msg)
  483. this.$refs.popupReason.close()
  484. uni.showTabBar()
  485. setTimeout(() => {
  486. this.page = 1;
  487. this.list = [];
  488. this.orderList()
  489. }, 1500)
  490. this.isAJAX = false;
  491. } else {
  492. tools.error(res.msg)
  493. this.isAJAX = false;
  494. }
  495. })
  496. } else if (this.sureType === 2) {
  497. // 代取退款
  498. if (this.isAJAX) {
  499. return
  500. }
  501. this.isAJAX = true;
  502. expressOrderCancel({
  503. order_id: this.order_id,
  504. refund_msg: this.refund_msg
  505. }).then((res) => {
  506. if (res.code == 1) {
  507. tools.success(res.msg)
  508. this.$refs.popupReason.close()
  509. uni.showTabBar()
  510. setTimeout(() => {
  511. this.page = 1;
  512. this.list = [];
  513. this.expressOrderList()
  514. }, 1500)
  515. this.isAJAX = false;
  516. } else {
  517. tools.error(res.msg)
  518. this.isAJAX = false;
  519. }
  520. })
  521. } else if (this.sureType === 3) {
  522. //跑腿退款
  523. if (this.isAJAX) {
  524. return
  525. }
  526. this.isAJAX = true;
  527. errandsOrderCancel({
  528. order_id: this.order_id,
  529. refund_msg: this.refund_msg
  530. }).then((res) => {
  531. if (res.code == 1) {
  532. tools.success(res.msg)
  533. this.$refs.popupReason.close()
  534. uni.showTabBar()
  535. setTimeout(() => {
  536. this.page = 1;
  537. this.list = [];
  538. this.errandsOrderList()
  539. }, 1500)
  540. this.isAJAX = false;
  541. } else {
  542. tools.error(res.msg)
  543. this.isAJAX = false;
  544. }
  545. })
  546. }
  547. },
  548. bindChange(e) {
  549. let num = e.detail.value[0]
  550. this.refund_msg = this.refundReason[num].refund_msg
  551. },
  552. tackOut(item) {
  553. // 外卖取消订单
  554. uni.hideTabBar()
  555. this.sureType = 1
  556. this.order_id = item.id
  557. commonRefundReason().then((res) => {
  558. if (res.code === 1) {
  559. this.refundReason = res.data
  560. this.refund_msg = this.refundReason[0].refund_msg
  561. }
  562. })
  563. this.$refs.popupReason.open()
  564. // uni.showModal({
  565. // title: '提示',
  566. // content: '是否取消订单?',
  567. // confirmText: '确定',
  568. // confirmColor: '#FB3D03',
  569. // success: (res) => {
  570. // if (res.confirm === true) {
  571. // if (this.isAJAX) {
  572. // return
  573. // }
  574. // this.isAJAX = true;
  575. // orderCancel({
  576. // order_id: item.id
  577. // }).then((res) => {
  578. // if (res.code == 1) {
  579. // tools.success(res.msg)
  580. // setTimeout(() => {
  581. // this.page = 1;
  582. // this.list = [];
  583. // this.orderList()
  584. // }, 1500)
  585. // this.isAJAX = false;
  586. // } else {
  587. // tools.error(res.msg)
  588. // this.isAJAX = false;
  589. // }
  590. // })
  591. // }
  592. // }
  593. // });
  594. },
  595. expressCancel(item) {
  596. // 代取取消订单
  597. uni.hideTabBar()
  598. this.sureType = 2
  599. this.order_id = item.id
  600. commonRefundReason().then((res) => {
  601. if (res.code === 1) {
  602. this.refundReason = res.data
  603. this.refund_msg = this.refundReason[0].refund_msg
  604. }
  605. })
  606. this.$refs.popupReason.open()
  607. // uni.showModal({
  608. // title: '提示',
  609. // content: '是否取消订单?',
  610. // confirmText: '确定',
  611. // confirmColor: '#FB3D03',
  612. // success: (res) => {
  613. // if (res.confirm === true) {
  614. // if (this.isAJAX) {
  615. // return
  616. // }
  617. // this.isAJAX = true;
  618. // expressOrderCancel({
  619. // order_id: item.id
  620. // }).then((res) => {
  621. // if (res.code == 1) {
  622. // tools.success(res.msg)
  623. // setTimeout(() => {
  624. // this.page = 1;
  625. // this.list = [];
  626. // this.expressOrderList()
  627. // }, 1500)
  628. // this.isAJAX = false;
  629. // } else {
  630. // tools.error(res.msg)
  631. // this.isAJAX = false;
  632. // }
  633. // })
  634. // }
  635. // }
  636. // });
  637. },
  638. cancel(item) {
  639. // 跑腿取消订单
  640. uni.hideTabBar()
  641. this.sureType = 3
  642. this.order_id = item.id
  643. commonRefundReason().then((res) => {
  644. if (res.code === 1) {
  645. this.refundReason = res.data
  646. this.refund_msg = this.refundReason[0].refund_msg
  647. }
  648. })
  649. this.$refs.popupReason.open()
  650. // uni.showModal({
  651. // title: '提示',
  652. // content: '是否取消订单?',
  653. // confirmText: '确定',
  654. // confirmColor: '#FB3D03',
  655. // success: (res) => {
  656. // if (res.confirm === true) {
  657. // if (this.isAJAX) {
  658. // return
  659. // }
  660. // this.isAJAX = true;
  661. // laundryOrderCancel({
  662. // order_id: item.id
  663. // }).then((res) => {
  664. // if (res.code == 1) {
  665. // tools.success(res.msg)
  666. // setTimeout(() => {
  667. // this.page = 1;
  668. // this.list = [];
  669. // this.laundryOrderList()
  670. // }, 1500)
  671. // this.isAJAX = false;
  672. // } else {
  673. // tools.error(res.msg)
  674. // this.isAJAX = false;
  675. // }
  676. // })
  677. // }
  678. // }
  679. // });
  680. },
  681. scrolltolower() {
  682. ++this.page
  683. if (this.type === 1) {
  684. this.orderList()
  685. } else if (this.type === 2) {
  686. this.expressOrderList()
  687. } else if (this.type === 3) {
  688. this.groupOrderList()
  689. } else if (this.type === 4) {
  690. this.errandsOrderList()
  691. } else if (this.type === 5) {
  692. this.laundryOrderList()
  693. }
  694. // console.log('触底');
  695. },
  696. getList() {
  697. if (this.type === 1) {
  698. this.orderStatus()
  699. this.orderList()
  700. } else if (this.type === 2) {
  701. this.expressOrderStatus()
  702. this.expressOrderList()
  703. } else if (this.type === 3) {
  704. this.groupOrderStatus()
  705. this.groupOrderList()
  706. } else if (this.type === 4) {
  707. this.errandsOrderStatus()
  708. this.errandsOrderList()
  709. } else if (this.type === 5) {
  710. this.laundryOrderStatus()
  711. this.laundryOrderList()
  712. }
  713. },
  714. expressOrderStatus() {
  715. // 代取订单状态
  716. expressOrderStatus().then((res) => {
  717. if (res.code == 1) {
  718. this.navTypeData = res.data
  719. }
  720. })
  721. },
  722. orderStatus() {
  723. // 外卖订单状态
  724. orderStatus().then((res) => {
  725. if (res.code == 1) {
  726. this.navTypeData = res.data
  727. }
  728. })
  729. },
  730. groupOrderStatus() {
  731. // 团购订单状态
  732. groupOrderStatus().then((res) => {
  733. if (res.code == 1) {
  734. this.navTypeData = res.data
  735. }
  736. })
  737. },
  738. errandsOrderStatus() {
  739. // 跑腿订单状态
  740. errandsOrderStatus().then((res) => {
  741. if (res.code == 1) {
  742. this.navTypeData = res.data
  743. }
  744. })
  745. },
  746. laundryOrderStatus() {
  747. // 干洗订单状态
  748. laundryOrderStatus().then((res) => {
  749. if (res.code == 1) {
  750. this.navTypeData = res.data
  751. }
  752. })
  753. },
  754. orderList() {
  755. // 外卖订单列表
  756. orderList({
  757. status: this.navTypeKey,
  758. page: this.page
  759. }).then((res) => {
  760. if (res.code == 1) {
  761. if (res.data.items.length > 0) {
  762. this.list.push(...res.data.items)
  763. }
  764. }
  765. })
  766. },
  767. expressOrderList() {
  768. // 代取订单列表
  769. expressOrderList({
  770. status: this.navTypeKey,
  771. page: this.page
  772. }).then((res) => {
  773. if (res.code == 1) {
  774. if (res.data.items.length > 0) {
  775. this.list.push(...res.data.items)
  776. }
  777. }
  778. })
  779. },
  780. groupOrderList() {
  781. // 团购订单列表
  782. groupOrderList({
  783. status: this.navTypeKey,
  784. page: this.page
  785. }).then((res) => {
  786. if (res.code == 1) {
  787. if (res.data.items.length > 0) {
  788. this.list.push(...res.data.items)
  789. }
  790. }
  791. })
  792. },
  793. errandsOrderList() {
  794. // 票务订单列表
  795. errandsOrderList({
  796. status: this.navTypeKey,
  797. page: this.page
  798. }).then((res) => {
  799. if (res.code == 1) {
  800. if (res.data.items.length > 0) {
  801. this.list.push(...res.data.items)
  802. }
  803. }
  804. })
  805. },
  806. laundryOrderList() {
  807. // 干洗订单列表
  808. laundryOrderList({
  809. status: this.navTypeKey,
  810. page: this.page
  811. }).then((res) => {
  812. if (res.code == 1) {
  813. if (res.data.items.length > 0) {
  814. this.list.push(...res.data.items)
  815. }
  816. }
  817. })
  818. },
  819. takeawayPay(id) {
  820. // 外卖支付
  821. uni.redirectTo({
  822. url: `/pages-takeout/pay-page?orderId=${id}`
  823. });
  824. return
  825. // if (this.isAJAX) {
  826. // return
  827. // }
  828. // this.isAJAX = true;
  829. // orderPay({
  830. // order_id: id
  831. // }).then((ret) => {
  832. // if (ret.code === 1) {
  833. // uni.requestPayment({
  834. // provider: "wxpay", //支付类型-固定值
  835. // timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  836. // nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  837. // package: ret.data.wx_pay.package, // 固定值
  838. // signType: ret.data.wx_pay.signType, //固定值
  839. // paySign: ret.data.wx_pay.paySign, //签名
  840. // success: (ren) => {
  841. // tools.success("支付成功");
  842. // this.isAJAX = false;
  843. // this.page = 1;
  844. // this.list = [];
  845. // this.orderList()
  846. // },
  847. // fail: (err) => {
  848. // this.isAJAX = false;
  849. // tools.error("支付失败");
  850. // },
  851. // });
  852. // } else {
  853. // this.isAJAX = false;
  854. // tools.error("支付失败");
  855. // }
  856. // })
  857. },
  858. getExpressPay(id) {
  859. // 代取支付
  860. uni.redirectTo({
  861. url: `/pages-takeout/pick-up-pay?orderId=${id}`
  862. });
  863. return
  864. // if (this.isAJAX) {
  865. // return
  866. // }
  867. // this.isAJAX = true;
  868. // getExpressPay({
  869. // order_id: id
  870. // }).then((ret) => {
  871. // if (ret.code === 1) {
  872. // uni.requestPayment({
  873. // provider: "wxpay", //支付类型-固定值
  874. // timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  875. // nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  876. // package: ret.data.wx_pay.package, // 固定值
  877. // signType: ret.data.wx_pay.signType, //固定值
  878. // paySign: ret.data.wx_pay.paySign, //签名
  879. // success: (ren) => {
  880. // tools.success("支付成功");
  881. // this.isAJAX = false;
  882. // this.page = 1;
  883. // this.list = [];
  884. // this.expressOrderList()
  885. // },
  886. // fail: (err) => {
  887. // this.isAJAX = false;
  888. // tools.error("支付失败");
  889. // },
  890. // });
  891. // } else {
  892. // this.isAJAX = false;
  893. // tools.error("支付失败");
  894. // }
  895. // })
  896. },
  897. groupPay(id) {
  898. // 团购支付
  899. uni.redirectTo({
  900. url: `/pages-buy/group-pay-page?orderId=${id}`
  901. });
  902. return
  903. // if (this.isAJAX) {
  904. // return
  905. // }
  906. // this.isAJAX = true;
  907. // groupPay({
  908. // order_id: id
  909. // }).then((ret) => {
  910. // if (ret.code === 1) {
  911. // uni.requestPayment({
  912. // provider: "wxpay", //支付类型-固定值
  913. // timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  914. // nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  915. // package: ret.data.wx_pay.package, // 固定值
  916. // signType: ret.data.wx_pay.signType, //固定值
  917. // paySign: ret.data.wx_pay.paySign, //签名
  918. // success: (ren) => {
  919. // tools.success("支付成功");
  920. // this.isAJAX = false;
  921. // this.page = 1;
  922. // this.list = [];
  923. // this.groupOrderList()
  924. // },
  925. // fail: (err) => {
  926. // this.isAJAX = false;
  927. // tools.error("支付失败");
  928. // },
  929. // });
  930. // } else {
  931. // this.isAJAX = false;
  932. // tools.error("支付失败");
  933. // }
  934. // })
  935. },
  936. errandsOrderPay(id) {
  937. // 跑腿支付
  938. uni.redirectTo({
  939. url: `/pages-takeout/run-errands-mod/pay-page?orderId=${id}`
  940. });
  941. return
  942. // if (this.isAJAX) {
  943. // return
  944. // }
  945. // this.isAJAX = true;
  946. // errandsOrderPay({
  947. // order_id: id
  948. // }).then((ret) => {
  949. // if (ret.code === 1) {
  950. // uni.requestPayment({
  951. // provider: "wxpay", //支付类型-固定值
  952. // timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  953. // nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  954. // package: ret.data.wx_pay.package, // 固定值
  955. // signType: ret.data.wx_pay.signType, //固定值
  956. // paySign: ret.data.wx_pay.paySign, //签名
  957. // success: (ren) => {
  958. // tools.success("支付成功");
  959. // this.isAJAX = false;
  960. // this.page = 1;
  961. // this.list = [];
  962. // this.errandsOrderList()
  963. // },
  964. // fail: (err) => {
  965. // this.isAJAX = false;
  966. // tools.error("支付失败");
  967. // },
  968. // });
  969. // } else {
  970. // this.isAJAX = false;
  971. // tools.error("支付失败");
  972. // }
  973. // })
  974. },
  975. laundryPay(id) {
  976. // 干洗支付
  977. if (this.isAJAX) {
  978. return
  979. }
  980. this.isAJAX = true;
  981. laundryPay({
  982. order_id: id
  983. }).then((ret) => {
  984. if (ret.code === 1) {
  985. uni.requestPayment({
  986. provider: "wxpay", //支付类型-固定值
  987. timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  988. nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  989. package: ret.data.wx_pay.package, // 固定值
  990. signType: ret.data.wx_pay.signType, //固定值
  991. paySign: ret.data.wx_pay.paySign, //签名
  992. success: (ren) => {
  993. tools.success("支付成功");
  994. this.isAJAX = false;
  995. this.page = 1;
  996. this.list = [];
  997. this.laundryOrderList()
  998. },
  999. fail: (err) => {
  1000. this.isAJAX = false;
  1001. tools.error("支付失败");
  1002. },
  1003. });
  1004. } else {
  1005. this.isAJAX = false;
  1006. tools.error("支付失败");
  1007. }
  1008. })
  1009. }
  1010. },
  1011. }
  1012. </script>
  1013. <style lang="scss" scoped>
  1014. .pop-b {
  1015. height: 80rpx;
  1016. line-height: 80rpx;
  1017. border-radius: 20rpx;
  1018. // border: 1rpx solid #F9F9F9;
  1019. }
  1020. .popup-reason-box {
  1021. width: 100%;
  1022. height: 45vh;
  1023. overflow: auto;
  1024. border-radius: 20rpx 20rpx 0 0;
  1025. background: #fff;
  1026. padding: 24rpx 0 0;
  1027. box-sizing: border-box;
  1028. }
  1029. .picker-view {
  1030. width: 100%;
  1031. // height: 70%;
  1032. }
  1033. .picker-view-item {
  1034. // height: 90rpx;
  1035. line-height: 68rpx;
  1036. text-align: center;
  1037. background: #F5F5F5;
  1038. }
  1039. .nav-b {
  1040. position: relative;
  1041. z-index: -1 !important;
  1042. }
  1043. .nav-box {
  1044. padding: 26rpx 44rpx;
  1045. overflow-x: scroll;
  1046. .nav-item {
  1047. white-space: nowrap;
  1048. position: relative;
  1049. .nav-item-x {
  1050. position: absolute;
  1051. width: 48rpx;
  1052. height: 6rpx;
  1053. border-radius: 20rpx;
  1054. background-color: #41ABF5;
  1055. left: calc(50% - 24rpx);
  1056. bottom: -10rpx;
  1057. }
  1058. }
  1059. }
  1060. .nav-type-box {
  1061. width: 100%;
  1062. white-space: nowrap;
  1063. }
  1064. .nav-type-item {
  1065. width: 144rpx;
  1066. height: 64rpx;
  1067. line-height: 64rpx;
  1068. margin: 0 24rpx 0 0;
  1069. border-radius: 200rpx;
  1070. display: inline-block;
  1071. }
  1072. .nav-type-item:last-child {
  1073. margin: 0;
  1074. }
  1075. .list-box {
  1076. padding: 20rpx;
  1077. box-sizing: border-box;
  1078. }
  1079. .shops-img {
  1080. width: 48rpx;
  1081. height: 48rpx;
  1082. margin: 0 8rpx 0 0;
  1083. border-radius: 50%;
  1084. }
  1085. .shops-name {
  1086. max-width: 452rpx;
  1087. margin: 0 8rpx 0 0;
  1088. }
  1089. .icons {
  1090. width: 32rpx;
  1091. height: 32rpx;
  1092. }
  1093. .goods-box {
  1094. max-width: 506rpx;
  1095. height: auto;
  1096. }
  1097. .goods-num {
  1098. width: 24rpx;
  1099. height: auto;
  1100. }
  1101. .goods-img {
  1102. width: 144rpx;
  1103. height: 144rpx;
  1104. border-radius: 12rpx;
  1105. margin: 0 16rpx 0 0;
  1106. }
  1107. .goods-two {
  1108. overflow-x: scroll;
  1109. overflow: auto;
  1110. }
  1111. .goods-two-name {
  1112. width: 144rpx;
  1113. }
  1114. .item-but {
  1115. width: 160rpx;
  1116. height: 64rpx;
  1117. line-height: 64rpx;
  1118. text-align: center;
  1119. border-radius: 200rpx;
  1120. }
  1121. .but-class-one {
  1122. background: linear-gradient(225deg, #41ABF5 0%, #5BD8FB 100%);
  1123. color: #fff;
  1124. }
  1125. .but-class-two {
  1126. background: #fff;
  1127. border: 2rpx solid #CCCCCC;
  1128. color: #333;
  1129. }
  1130. </style>