serve.vue 26 KB

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