serve.vue 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042
  1. <template>
  2. <view :style="colorStyle">
  3. <view class="my-order">
  4. <view class="nav acea-row row-around" style="position: fixed;top: 0;">
  5. <view class="item" :class="orderStatus === 0 ? 'on' : ''" @click="statusClick(0)">
  6. <view>待服务</view>
  7. <!-- <view class="num">{{ orderData.order_count || 0 }}</view> -->
  8. </view>
  9. <!-- <view class="item" :class="orderStatus === 1 ? 'on' : ''" @click="statusClick(1)">
  10. <view>进行中</view>
  11. <view class="num">{{ orderData.unpaid_count || 0 }}</view>
  12. </view> -->
  13. <view class="item" :class="orderStatus == 2 ? 'on' : ''" @click="statusClick(2)">
  14. <view>已完成</view>
  15. <!-- <view class="num">{{ orderData.unshipped_count || 0 }}</view> -->
  16. </view>
  17. <view class="item" :class="orderStatus == -1 ? 'on' : ''" @click="statusClick(-1)">
  18. <view>退款</view>
  19. <!-- <view class="num ">{{ orderData.received_count || 0 }}</view> -->
  20. </view>
  21. </view>
  22. <view class="nav">
  23. </view>
  24. <Loading :loaded="loaded" :loading="loading"></Loading>
  25. <view class="list">
  26. <view class="item" v-for="(item, index) in orderList" :key="index" v-if="showOrder(item)">
  27. <view >
  28. <!-- <view @click="goOrderDetails(item.order_id)"> -->
  29. <view class="title acea-row row-between-wrapper">
  30. <view class="acea-row row-middle">
  31. 订单ID:{{item.order_id}}
  32. </view>
  33. <!-- <view v-if="item._status._type == 9" class="font-color">线下付款,未支付</view>
  34. <view v-else-if="item._status._type == 0" class="font-color">待付款</view>
  35. <view v-else-if="item._status._type == 1 && (item.shipping_type == 1 || item.shipping_type == 3)" class="font-color">待发货
  36. <text v-if="item.refund.length">{{item.is_all_refund?',退款中':',部分退款中'}}</text>
  37. </view>
  38. <view v-else-if="item._status._type == 1 && (item.shipping_type == 2 || item.shipping_type == 4)" class="font-color">
  39. {{item.shipping_type == 2?'待核销':'待收货'}}
  40. <text v-if="item.refund.length">{{item.is_all_refund?',退款中':',部分退款中'}}</text>
  41. </view>
  42. <view v-else-if="item._status._type == 2" class="font-color">待收货
  43. <text v-if="item.refund.length">{{item.is_all_refund?',退款中':',部分退款中'}}</text>
  44. </view>
  45. <view v-else-if="item._status._type == 3" class="font-color">待评价
  46. <text v-if="item.refund.length">{{item.is_all_refund?',退款中':',部分退款中'}}</text>
  47. </view>
  48. <view v-else-if="item._status._type == 4" class="font-color">已完成
  49. <text v-if="item.refund.length">{{item.is_all_refund?',退款中':',部分退款中'}}</text>
  50. </view>
  51. <view v-else-if="item._status._type == -2" class="font-color">已退款
  52. </view>
  53. <view v-else-if="item._status._type == 5 && item.status == 0" class="font-color">待核销
  54. <text v-if="item.refund.length">{{item.is_all_refund?',退款中':',部分退款中'}}</text>
  55. </view>
  56. <view v-else-if="item._status._type == 5 && item.status == 5" class="font-color">部分核销
  57. <text v-if="item.refund.length">{{item.is_all_refund?',退款中':',部分退款中'}}</text>
  58. </view>
  59. <view v-else-if="item._status._type == -1" class="font-color">申请退款
  60. </view> -->
  61. </view>
  62. <view class="item-info acea-row row-between row-top" v-for="(items, index) in item.info"
  63. :key="index">
  64. <view class="pictrue">
  65. <image :src="items.slider_image"></image>
  66. </view>
  67. <view class="text acea-row row-between">
  68. <view class="name line2">{{ items.store_name }}</view>
  69. <view class="money">
  70. <view>¥{{ items.pay_price }}</view>
  71. <view>x1</view>
  72. <!-- <view v-if="items.refund_num && item._status._type != -2" class="return">{{ items.refund_num }}件退款中</view> -->
  73. </view>
  74. </view>
  75. </view>
  76. <view class="totalPrice showstore">
  77. <view class="">
  78. 下单时间: {{ showTime(item.add_time) }}
  79. </view>
  80. <view class="">
  81. 预约时间: {{ showTime(item.reservation_time) }}
  82. </view>
  83. </view>
  84. <view class="address acea-row row-between-wrapper" style="padding: 10rpx 30rpx; flex-wrap: nowrap;">
  85. <view class="addressCon">
  86. <view class='name acea-row row-middle'>
  87. <view class="nameCon line1 on">{{item.store.name || ''}}</view>
  88. </view>
  89. <view>
  90. {{item.store.detailed_address || ''}}
  91. </view>
  92. </view>
  93. <view style="flex-shrink: 0;" class="icon acea-row row-middle">
  94. <view class="iconfont icon-dianhua" @click.stop="call(item.store.phone)"></view>
  95. <view class="iconfont icon-dingwei2" @click.stop="showMaoLocation(item.store)"></view>
  96. </view>
  97. </view>
  98. <view class="totalPrice">
  99. 共{{ item.info.length || 0 }}件商品,总金额
  100. <text class="money">¥{{ showTolPrice(item.info) }}</text>
  101. </view>
  102. </view>
  103. <view class="bottom acea-row row-right row-middle" v-if="item.status != 2">
  104. <view class="bnt cancelBnt" v-if="item.status == 0 || item.status==1"
  105. @click="cancelOrder(index, item.id)">取消订单</view>
  106. <view class="bnt cancelBnt" v-if="item.status == -1 && (item.refund_status == 1 || item.refund_status == 2 || item.refund_status == 3)">退款审核中</view>
  107. <view class="bnt cancelBnt" v-if="item.status == -1 && (item.refund_status == 4 || item.refund_status == 5)">退款完成</view>
  108. <view class="bnt cancelBnt" v-if="item.status == -1 && item.refund_status == -1 ">退款已拒绝</view>
  109. </view>
  110. <view class="bottom acea-row row-right row-middle" v-if="item.status == 2">
  111. <view class="bnt cancelBnt" v-if="item.reward && item.reward.id">已表扬</view>
  112. <view class="bnt cancelBnt showbtn" v-else @click="das(item)">表扬</view>
  113. <view class="bnt cancelBnt " v-if="item.complaint && item.complaint.id" >已投诉</view>
  114. <view class="bnt cancelBnt " v-else @click="ts(item)">投诉</view>
  115. </view>
  116. </view>
  117. </view>
  118. <view class="loadingicon acea-row row-center-wrapper" v-if="orderList.length > 0">
  119. <text class="loading iconfont icon-jiazai" :hidden="loading == false"></text>
  120. {{ loadTitle }}
  121. </view>
  122. <view v-if="orderList.length == 0 && !loading">
  123. <emptyPage title="暂无订单信息~"></emptyPage>
  124. </view>
  125. </view>
  126. <home v-if="navigation"></home>
  127. <payment :payMode="payMode" :pay_close="pay_close" @onChangeFun="onChangeFun" :order_id="pay_order_id"
  128. :totalPrice="totalPrice" :payTT="true" @onChooseType="onChooseType"></payment>
  129. <!-- #ifdef MP -->
  130. <!-- <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize> -->
  131. <!-- #endif -->
  132. <uni-popup type="center" ref="dspop">
  133. <view class="ds-wrap">
  134. <view class="tit">
  135. 多少都是您的心意
  136. </view>
  137. <input type="number" v-model="dsPrice" placeholder="请输入任意表扬金额(1~5)"/>
  138. <input type="text" v-model="dsMark" placeholder="请输入表扬内容"/>
  139. <view class="btn-wrap">
  140. <view class="btn" @click="closeDs">
  141. 取消
  142. </view>
  143. <view class="btn s-btn" @click="confirmDs">
  144. 确定
  145. </view>
  146. </view>
  147. </view>
  148. </uni-popup>
  149. <uni-popup type="center" ref="tspop">
  150. <view class="ds-wrap">
  151. <view class="tit">
  152. 投诉
  153. </view>
  154. <input type="text" v-model="tsyy" placeholder="请输入投诉原因"/>
  155. <view class="btn-wrap">
  156. <view class="btn" @click="closeTs">
  157. 取消
  158. </view>
  159. <view class="btn s-btn" @click="confirmTs">
  160. 确定
  161. </view>
  162. </view>
  163. </view>
  164. </uni-popup>
  165. </view>
  166. </template>
  167. <script>
  168. import {
  169. getOrderList,
  170. orderData,
  171. orderCancel,
  172. orderDel,
  173. orderPay,
  174. SqRefund,
  175. ds,
  176. ts
  177. } from '@/api/order.js';
  178. import {
  179. getUserInfo,
  180. getServeOrder
  181. } from '@/api/user.js';
  182. import {
  183. openOrderSubscribe
  184. } from '@/utils/SubscribeMessage.js';
  185. import home from '@/components/home';
  186. import payment from '@/components/payment';
  187. import {
  188. toLogin
  189. } from '@/libs/login.js';
  190. import {
  191. mapGetters
  192. } from 'vuex';
  193. import emptyPage from '@/components/emptyPage.vue';
  194. import colors from '@/mixins/color.js';
  195. import Loading from '@/components/Loading/index.vue'
  196. export default {
  197. components: {
  198. Loading,
  199. payment,
  200. home,
  201. emptyPage
  202. },
  203. mixins: [colors],
  204. data() {
  205. return {
  206. userInfo: {},
  207. itemList: ['不想买了', '信息填错了', '买错商品了', '卖家缺货'],
  208. loaded: false,
  209. loading: false, //是否加载中
  210. loadend: false, //是否加载完毕
  211. loadTitle: '加载更多', //提示语
  212. orderList: [], //订单数组
  213. orderData: {}, //订单详细统计
  214. orderStatus: 0, //订单状态
  215. page: 1,
  216. limit: 20,
  217. payMode: [{
  218. name: '微信支付',
  219. icon: 'icon-weixinzhifu',
  220. value: 'weixin',
  221. title: '使用微信快捷支付',
  222. payStatus: true
  223. },
  224. {
  225. name: '支付宝支付',
  226. icon: 'icon-zhifubao',
  227. value: 'alipay',
  228. title: '使用线上支付宝支付',
  229. payStatus: false
  230. },
  231. {
  232. name: '余额支付',
  233. icon: 'icon-yuezhifu',
  234. value: 'yue',
  235. title: '当前可用余额:',
  236. number: 0,
  237. payStatus: true
  238. }
  239. ],
  240. pay_close: false,
  241. pay_order_id: '',
  242. totalPrice: '0',
  243. isAuto: false, //没有授权的不会自动授权
  244. isShowAuth: false ,//是否隐藏授权
  245. dsItem: {},
  246. dsPrice: '',
  247. dsMark: '',
  248. tsItem: {},
  249. tsyy: ''
  250. };
  251. },
  252. computed: mapGetters(['isLogin']),
  253. onShow() {
  254. uni.removeStorageSync('form_type_cart');
  255. this.page = 1;
  256. this.loadend = false;
  257. this.orderList = [];
  258. if (this.isLogin) {
  259. this.getFun();
  260. } else {
  261. toLogin()
  262. }
  263. },
  264. /**
  265. * 生命周期函数--监听页面加载
  266. */
  267. onLoad(options) {
  268. if (options.status) this.orderStatus = (options.status == undefined && options.status != 0) ? '' : parseInt(
  269. options.status);
  270. },
  271. methods: {
  272. ts(item) {
  273. },
  274. onChooseType(payType) {
  275. console.log(payType,'payType')
  276. let that = this;
  277. let dsData = {
  278. mark: that.dsMark,
  279. member_id: that.dsItem.work_member_id,
  280. pay_type: payType,
  281. pay_price: that.dsPrice,
  282. // #ifdef MP
  283. 'from': 'routine',
  284. // #endif
  285. // #ifdef H5
  286. 'from': this.$wechat.isWeixin() ? 'weixin' : 'weixinh5',
  287. // #endif
  288. subscribe_id: that.dsItem.order_id
  289. }
  290. uni.showLoading({
  291. title: '支付中'
  292. });
  293. try{
  294. ds(dsData).then(res => {
  295. let jsConfig = res.data.result.jsConfig;
  296. switch (payType) {
  297. case 'weixin':
  298. if (res.data.result === undefined) return that.$util.Tips({
  299. title: '缺少支付参数'
  300. });
  301. let mp_pay_name=''
  302. if(uni.requestOrderPayment){
  303. mp_pay_name='requestOrderPayment'
  304. }else{
  305. mp_pay_name='requestPayment'
  306. }
  307. uni[mp_pay_name]({
  308. timeStamp: jsConfig.timestamp,
  309. nonceStr: jsConfig.nonceStr,
  310. package: jsConfig.package,
  311. signType: jsConfig.signType,
  312. paySign: jsConfig.paySign,
  313. success: function(res) {
  314. uni.hideLoading();
  315. return that.$util.Tips({
  316. title: res.msg,
  317. icon: 'success'
  318. }, () => {
  319. that.onChangeFun({
  320. action: 'pay_complete'
  321. })
  322. });
  323. },
  324. fail: function(e) {
  325. uni.hideLoading();
  326. return that.$util.Tips({
  327. title: '取消支付'
  328. }, () => {
  329. that.onChangeFun({
  330. action: 'pay_fail'
  331. })
  332. });
  333. },
  334. complete: function(e) {
  335. uni.hideLoading();
  336. if (e.errMsg == 'requestPayment:cancel') return that.$util
  337. .Tips({
  338. title: '取消支付'
  339. }, () => {
  340. that.onChangeFun({
  341. action: 'pay_fail'
  342. })
  343. });
  344. },
  345. });
  346. break;
  347. case 'yue':
  348. uni.hideLoading();
  349. return that.$util.Tips({
  350. title: res.msg,
  351. icon: 'success'
  352. }, () => {
  353. that.onChangeFun({
  354. action: 'pay_complete'
  355. })
  356. });
  357. break;
  358. }
  359. })
  360. }catch(e){
  361. console.log('eer',e)
  362. //TODO handle the exception
  363. }
  364. // console.log(that.dsItem,dsData,'dsData')
  365. },
  366. confirmDs() {
  367. let that = this;
  368. if(!that.dsPrice) {
  369. return that.$util.Tips({
  370. title: '请输入表扬金额'
  371. });
  372. }
  373. if(that.dsPrice > 5) {
  374. return that.$util.Tips({
  375. title: '输入金额过大,请慎重考虑'
  376. });
  377. }
  378. that.totalPrice = that.dsPrice + ''
  379. console.log(that.totalPrice ,'that.totalPrice ')
  380. that.$refs.dspop.close();
  381. that.goPay()
  382. },
  383. confirmTs() {
  384. let that = this;
  385. if(!that.tsyy) {
  386. return that.$util.Tips({
  387. title: '请输入投诉原因'
  388. });
  389. }
  390. ts({
  391. reason:that.tsyy,
  392. order_id: that.tsItem.order_id,
  393. member_id: that.tsItem.work_member_id,
  394. }).then(res => {
  395. that.$refs.tspop.close();
  396. that.$util.Tips({
  397. title: '投诉已提交'
  398. })
  399. that.getOrderList('re')
  400. }).catch(err=> {
  401. that.$util.Tips({
  402. title: err.msg
  403. })
  404. })
  405. // that.goTs()
  406. },
  407. closeDs() {
  408. this.$refs.dspop.close();
  409. this.dsItem = {};
  410. this.dsPrice = '';
  411. this.dsMark = ''
  412. },
  413. closeTs() {
  414. this.$refs.tspop.close();
  415. this.tsItem = {};
  416. this.tsyy = '';
  417. },
  418. das(row) {
  419. this.dsItem = row;
  420. this.$refs.dspop.open();
  421. },
  422. ts(row) {
  423. this.tsItem = row;
  424. this.$refs.tspop.open();
  425. },
  426. showOrder(item) {
  427. return item.info[0].paid != 0
  428. },
  429. showTime(time) {
  430. var date = new Date(time * 1000);
  431. var year = date.getFullYear(); // 获取年份
  432. var month = ("0" + (date.getMonth() + 1)).slice(-2); // 获取月份(注意月份从 0 开始,需要加 1)
  433. var day = ("0" + date.getDate()).slice(-2); // 获取日期
  434. var hours = ("0" + date.getHours()).slice(-2); // 获取小时
  435. var minutes = ("0" + date.getMinutes()).slice(-2); // 获取分钟
  436. var seconds = ("0" + date.getSeconds()).slice(-2); // 获取秒钟
  437. var dateString = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds; // 自定义时间格式
  438. return dateString
  439. },
  440. call(phone) {
  441. uni.makePhoneCall({
  442. phoneNumber: phone,
  443. });
  444. },
  445. showMaoLocation(e) {
  446. let self = this;
  447. // #ifdef H5
  448. if (self.$wechat.isWeixin()) {
  449. self.$wechat.seeLocation({
  450. latitude: Number(e.latitude),
  451. longitude: Number(e.longitude),
  452. name: e.name,
  453. scale: 13,
  454. address: `${e.address}-${e.detailed_address}`,
  455. }).then(res => {})
  456. } else {
  457. // #endif
  458. uni.openLocation({
  459. latitude: Number(e.latitude),
  460. longitude: Number(e.longitude),
  461. name: e.name,
  462. address: `${e.address}-${e.detailed_address}`,
  463. success: function() {
  464. Number
  465. }
  466. });
  467. // #ifdef H5
  468. }
  469. // #endif
  470. },
  471. showTolPrice(list) {
  472. let price = 0;
  473. list.forEach(item => {
  474. price += item.pay_price * 1
  475. })
  476. return price.toFixed(2)
  477. },
  478. getFun() {
  479. // this.getOrderData();
  480. this.getUserInfo();
  481. },
  482. onLoadFun() {
  483. this.getFun();
  484. this.isShowAuth = false;
  485. },
  486. // 授权关闭
  487. authColse: function(e) {
  488. this.isShowAuth = e;
  489. },
  490. /**
  491. * 事件回调
  492. *
  493. */
  494. onChangeFun: function(e) {
  495. let opt = e;
  496. let action = opt.action || null;
  497. let value = opt.value != undefined ? opt.value : null;
  498. action && this[action] && this[action](value);
  499. },
  500. /**
  501. * 获取用户信息
  502. *
  503. */
  504. getUserInfo: function() {
  505. let that = this;
  506. getUserInfo().then(res => {
  507. that.userInfo = res.data
  508. that.getOrderList();
  509. that.payMode[2].number = res.data.now_money;
  510. that.$set(that, 'payMode', that.payMode);
  511. });
  512. },
  513. /**
  514. * 关闭支付组件
  515. *
  516. */
  517. payClose: function() {
  518. this.pay_close = false;
  519. },
  520. /**
  521. * 获取订单统计数据
  522. *
  523. */
  524. getOrderData: function() {
  525. let that = this;
  526. orderData().then(res => {
  527. that.$set(that, 'orderData', res.data);
  528. that.payMode.map(item => {
  529. if (item.value == 'weixin') {
  530. item.payStatus = res.data.pay_weixin_open ? true : false;
  531. }
  532. if (item.value == 'alipay') {
  533. item.payStatus = res.data.ali_pay_status ? true : false;
  534. }
  535. if (item.value == 'yue') {
  536. item.payStatus = res.data.yue_pay_status == 1 ? true : false;
  537. }
  538. });
  539. //#ifdef MP
  540. this.payMode[1].payStatus = false;
  541. //#endif
  542. });
  543. },
  544. /**
  545. * 取消订单
  546. *
  547. */
  548. cancelOrder: function(index, order_id) {
  549. let that = this;
  550. if (!order_id)
  551. return that.$util.Tips({
  552. title: '缺少订单号无法取消订单'
  553. });
  554. // uni.showModal({
  555. // title: '取消订单',
  556. // content: '您是否确认取消此订单',
  557. // confirmText: '确认',
  558. // cancelText: '再想想',
  559. // success: (res) => {
  560. // if (res.confirm) {
  561. // orderCancel(order_id)
  562. // .then(res => {
  563. // return that.$util.Tips({
  564. // title: res.msg,
  565. // icon: 'success'
  566. // },
  567. // function() {
  568. // that.orderList.splice(index, 1);
  569. // that.$set(that, 'orderList', that.orderList);
  570. // that.$set(that.orderData, 'unpaid_count', that.orderData.unpaid_count - 1);
  571. // that.getOrderData();
  572. // }
  573. // );
  574. // })
  575. // .catch(err => {
  576. // return that.$util.Tips({
  577. // title: err
  578. // });
  579. // });
  580. // }
  581. // }
  582. // })
  583. uni.showActionSheet({
  584. itemList: that.itemList,
  585. success(e) {
  586. console.log(e)
  587. console.log(that.itemList[e.tapIndex])
  588. SqRefund({
  589. id: order_id,
  590. refund_reason: that.itemList[e.tapIndex]
  591. }).then(res => {
  592. return that.$util.Tips({
  593. title: res.msg,
  594. icon: 'success'
  595. },
  596. function() {
  597. that.orderList.splice(index, 1);
  598. that.$set(that, 'orderList', that.orderList);
  599. that.$set(that.orderData, 'unpaid_count', that.orderData
  600. .unpaid_count - 1);
  601. that.getOrderData();
  602. }
  603. );
  604. }).catch(err => {
  605. return that.$util.Tips({
  606. title: err
  607. });
  608. });
  609. }
  610. })
  611. },
  612. /**
  613. * 打开支付组件
  614. *
  615. */
  616. goPay: function(pay_price, order_id) {
  617. this.$set(this, 'pay_close', true);
  618. // this.$set(this, 'pay_order_id', order_id);
  619. // this.$set(this, 'totalPrice', pay_price);
  620. },
  621. /**
  622. * 支付成功回调
  623. *
  624. */
  625. pay_complete: function() {
  626. this.$set(this, 'pay_close', false);
  627. // this.page = 1;
  628. that.getOrderList('re')
  629. // this.loadend = false;
  630. // // this.page = 1;
  631. // this.$set(this, 'orderList', []);
  632. // this.pay_close = false;
  633. // uni.navigateTo({
  634. // url: '/pages/goods/order_pay_status/index?order_id=' + this.pay_order_id +
  635. // '&msg=支付成功&type=3&totalPrice=' + this.totalPrice
  636. // })
  637. // this.pay_order_id = '';
  638. // this.getOrderData();
  639. // this.getOrderList();
  640. },
  641. /**
  642. * 支付失败回调
  643. *
  644. */
  645. pay_fail: function() {
  646. this.pay_close = false;
  647. this.pay_order_id = '';
  648. },
  649. /**
  650. * 去订单详情
  651. */
  652. goOrderDetails: function(order_id) {
  653. if (!order_id)
  654. return that.$util.Tips({
  655. title: '缺少订单号无法查看订单详情'
  656. });
  657. // #ifdef MP
  658. uni.showLoading({
  659. title: '正在加载'
  660. });
  661. openOrderSubscribe()
  662. .then(() => {
  663. uni.hideLoading();
  664. uni.navigateTo({
  665. url: '/pages/goods/order_details/index?order_id=' + order_id
  666. })
  667. })
  668. .catch(err => {
  669. uni.hideLoading();
  670. });
  671. // #endif
  672. // #ifndef MP
  673. uni.navigateTo({
  674. url: '/pages/goods/order_details/index?order_id=' + order_id
  675. });
  676. // #endif
  677. },
  678. /**
  679. * 切换类型
  680. */
  681. statusClick: function(status) {
  682. if (this.loading) return
  683. if (status === this.orderStatus) return;
  684. this.orderStatus = status;
  685. this.loadend = false;
  686. this.page = 1;
  687. this.$set(this, 'orderList', []);
  688. this.getOrderList();
  689. },
  690. /**
  691. * 获取订单列表
  692. */
  693. getOrderList: function(ttype) {
  694. let that = this;
  695. if(ttype == 're') {
  696. that.loadend = false;
  697. that.loading = false;
  698. that.orderList = [];
  699. that.page = 1
  700. }
  701. if (that.loadend) return;
  702. if (that.loading) return;
  703. that.loading = true;
  704. that.loadTitle = '加载更多';
  705. getServeOrder({
  706. uid: that.userInfo.uid,
  707. status: that.orderStatus,
  708. page: that.page,
  709. limit: that.limit
  710. })
  711. .then(res => {
  712. let list = res.data.list || [];
  713. console.log(list, 'list')
  714. if (that.orderStatus == 0) {
  715. that.orderData.order_count = res.data.count;
  716. } else if (that.orderStatus == 1) {
  717. that.orderData.unpaid_count = res.data.count;
  718. } else if (that.orderStatus == 2) {
  719. that.orderData.unshipped_count = res.data.count;
  720. } else if (that.orderStatus == 3) {
  721. that.orderData.received_count = res.data.count;
  722. }
  723. let loadend = list.length < that.limit;
  724. that.orderList = that.$util.SplitArray(list, that.orderList);
  725. that.$set(that, 'orderList', that.orderList);
  726. that.loadend = loadend;
  727. that.loading = false;
  728. that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  729. that.page = that.page + 1;
  730. })
  731. .catch(err => {
  732. that.loading = false;
  733. that.loadTitle = '加载更多';
  734. });
  735. },
  736. /**
  737. * 删除订单
  738. */
  739. delOrder: function(order_id, index) {
  740. let that = this;
  741. uni.showModal({
  742. title: '删除订单',
  743. content: '确定删除该订单',
  744. success: function(res) {
  745. if (res.confirm) {
  746. orderDel(order_id)
  747. .then(res => {
  748. that.orderList.splice(index, 1);
  749. that.$set(that, 'orderList', that.orderList);
  750. that.$set(that.orderData, 'unpaid_count', that
  751. .orderData.unpaid_count - 1);
  752. that.getOrderData();
  753. return that.$util.Tips({
  754. title: '删除成功',
  755. icon: 'success'
  756. });
  757. })
  758. .catch(err => {
  759. return that.$util.Tips({
  760. title: err
  761. });
  762. });
  763. } else if (res.cancel) {
  764. return that.$util.Tips({
  765. title: '已取消'
  766. });
  767. }
  768. }
  769. });
  770. }
  771. },
  772. onReachBottom: function() {
  773. this.getOrderList();
  774. }
  775. };
  776. </script>
  777. <style scoped lang="scss">
  778. .my-order .header {
  779. height: 260rpx;
  780. padding: 0 30rpx;
  781. }
  782. .my-order .header .picTxt {
  783. height: 190rpx;
  784. }
  785. .my-order .header .picTxt .text {
  786. color: rgba(255, 255, 255, 0.8);
  787. font-size: 26rpx;
  788. font-family: 'Guildford Pro';
  789. }
  790. .my-order .header .picTxt .text .name {
  791. font-size: 34rpx;
  792. font-weight: bold;
  793. color: #fff;
  794. margin-bottom: 20rpx;
  795. }
  796. .my-order .header .picTxt .pictrue {
  797. width: 122rpx;
  798. height: 109rpx;
  799. }
  800. .my-order .header .picTxt .pictrue image {
  801. width: 100%;
  802. height: 100%;
  803. }
  804. .my-order .nav {
  805. background-color: #fff;
  806. width: 750rpx;
  807. height: 90rpx;
  808. border-radius: 6rpx;
  809. margin: 0 auto;
  810. }
  811. .my-order .nav .item {
  812. text-align: center;
  813. font-size: 26rpx;
  814. color: #282828;
  815. padding: 27rpx 0;
  816. border-bottom: 5rpx solid transparent;
  817. }
  818. .my-order .nav .item.on {
  819. /* #ifdef H5 || MP */
  820. font-weight: bold;
  821. /* #endif */
  822. /* #ifdef APP-PLUS */
  823. color: #000;
  824. /* #endif */
  825. border-color: var(--view-theme);
  826. }
  827. .my-order .nav .item .num {
  828. margin-top: 18rpx;
  829. }
  830. .my-order .list {
  831. width: 690rpx;
  832. margin: 14rpx auto 0 auto;
  833. }
  834. .my-order .list .item {
  835. background-color: #fff;
  836. border-radius: 6rpx;
  837. margin-bottom: 14rpx;
  838. }
  839. .my-order .list .item .title {
  840. height: 84rpx;
  841. padding: 0 30rpx;
  842. border-bottom: 1rpx solid #eee;
  843. font-size: 28rpx;
  844. color: #282828;
  845. }
  846. .my-order .list .item .title .sign {
  847. font-size: 24rpx;
  848. padding: 0 7rpx;
  849. height: 36rpx;
  850. margin-right: 15rpx;
  851. }
  852. .my-order .list .item .item-info {
  853. padding: 0 30rpx;
  854. margin-top: 22rpx;
  855. }
  856. .my-order .list .item .item-info .pictrue {
  857. width: 120rpx;
  858. height: 120rpx;
  859. }
  860. .my-order .list .item .item-info .pictrue image {
  861. width: 100%;
  862. height: 100%;
  863. border-radius: 6rpx;
  864. }
  865. .my-order .list .item .item-info .text {
  866. width: 486rpx;
  867. font-size: 28rpx;
  868. color: #999;
  869. }
  870. .my-order .list .item .item-info .text .name {
  871. width: 306rpx;
  872. color: #282828;
  873. height: 74rpx;
  874. }
  875. .my-order .list .item .item-info .text .money {
  876. text-align: right;
  877. }
  878. .my-order .list .item .item-info .text .money .return {
  879. // color: var(--view-priceColor);
  880. margin-top: 10rpx;
  881. font-size: 24rpx;
  882. }
  883. .my-order .list .item .totalPrice {
  884. font-size: 26rpx;
  885. color: #282828;
  886. text-align: right;
  887. margin: 27rpx 0 0 30rpx;
  888. padding: 0 30rpx 30rpx 0;
  889. border-bottom: 1rpx solid #eee;
  890. }
  891. .my-order .list .item .totalPrice .money {
  892. font-size: 28rpx;
  893. font-weight: bold;
  894. color: var(--view-priceColor);
  895. }
  896. .my-order .list .item .bottom {
  897. height: 107rpx;
  898. padding: 0 30rpx;
  899. }
  900. .my-order .list .item .bottom .bnt {
  901. width: 176rpx;
  902. height: 60rpx;
  903. text-align: center;
  904. line-height: 60rpx;
  905. color: #fff;
  906. border-radius: 50rpx;
  907. font-size: 27rpx;
  908. }
  909. .my-order .list .item .bottom .bnt.cancelBnt {
  910. border: 1rpx solid #ddd;
  911. color: #aaa;
  912. }
  913. .my-order .list .item .bottom .bnt~.bnt {
  914. margin-left: 17rpx;
  915. }
  916. .noCart {
  917. margin-top: 171rpx;
  918. padding-top: 0.1rpx;
  919. }
  920. .noCart .pictrue {
  921. width: 414rpx;
  922. height: 336rpx;
  923. margin: 78rpx auto 56rpx auto;
  924. }
  925. .noCart .pictrue image {
  926. width: 100%;
  927. height: 100%;
  928. }
  929. .line2 {
  930. word-break: break-all;
  931. }
  932. .showstore {
  933. border-bottom: none !important;
  934. text-align: left !important;
  935. padding-bottom: 10rpx !important;
  936. }
  937. .icon {
  938. .iconfont {
  939. width: 44rpx;
  940. height: 44rpx;
  941. background: var(--view-minorColorT);
  942. font-size: 20rpx;
  943. border-radius: 50%;
  944. text-align: center;
  945. line-height: 44rpx;
  946. color: var(--view-theme);
  947. margin-left: 26rpx;
  948. }
  949. }
  950. .showbtn {
  951. color: #e93323 !important;
  952. border-color: #e93323 !important;
  953. }
  954. .ds-wrap {
  955. width: 623rpx;
  956. // height: 360rpx;
  957. border-radius: 20rpx;
  958. background-color: #fff;
  959. display: flex;
  960. justify-content: space-around;
  961. align-items: center;
  962. flex-direction: column;
  963. padding: 20rpx 0;
  964. input {
  965. width: 575rpx;
  966. height: 73rpx;
  967. background-color: #f5f5f5;
  968. color: #000;
  969. padding-left: 20rpx;
  970. margin: 20rpx auto;
  971. }
  972. .btn-wrap {
  973. width: 575rpx;
  974. display: flex;
  975. justify-content: space-between;
  976. align-items: center;
  977. margin: 20rpx auto;
  978. .btn {
  979. width: 277rpx;
  980. height: 82rpx;
  981. // background-color: ;
  982. color: #000;
  983. display: flex;
  984. justify-content: center;
  985. align-items: center;
  986. background-color: #f5f5f5;
  987. border-radius: 15rpx;
  988. }
  989. .s-btn {
  990. color: #fff;
  991. background-color:#e93323;
  992. }
  993. }
  994. }
  995. </style>