index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980
  1. <template>
  2. <view>
  3. <view class='my-order'>
  4. <view class='header bg-color'>
  5. <view class='picTxt acea-row row-between-wrapper'>
  6. <view class='text'>
  7. <view class='name'>订单信息</view>
  8. <view>消费订单:{{orderData.orderCount || 0}} 总消费:¥{{orderData.orderPrice || 0}}</view>
  9. </view>
  10. <view class='pictrue'>
  11. <image src='/static/images/orderTime.png'></image>
  12. </view>
  13. </view>
  14. </view>
  15. <view class='nav acea-row row-around'>
  16. <view class='item' :class='orderStatus==-1 ? "on": ""' @click="statusClick(-1)">
  17. <view>全部</view>
  18. <view class='num'>{{orderData.all || 0}}</view>
  19. </view>
  20. <view class='item' :class='orderStatus==0 ? "on": ""' @click="statusClick(0)">
  21. <view>待付款</view>
  22. <view class='num'>{{orderData.noPay || 0}}</view>
  23. </view>
  24. <view class='item' :class='orderStatus==1 ? "on": ""' @click="statusClick(1)">
  25. <view>待发货</view>
  26. <view class='num'>{{orderData.noPostage || 0}}</view>
  27. </view>
  28. <view class='item' :class='orderStatus==2 ? "on": ""' @click="statusClick(2)">
  29. <view>待收货</view>
  30. <view class='num '>{{orderData.noDeliver || 0}}</view>
  31. </view>
  32. <view class='item' :class='orderStatus==3 ? "on": ""' @click="statusClick(3)">
  33. <view>待评价</view>
  34. <view class='num'>{{orderData.noComment || 0}}</view>
  35. </view>
  36. </view>
  37. <!--定金预售订单-->
  38. <view v-if="presellProList.length > 0" class="event_container">
  39. <navigator class="acea-row row-between" url="/pages/users/presell_order_list/index" hover-class='none' >
  40. <view class="info">
  41. <view class="title">预售尾款订单转到这里了!</view>
  42. <view class="desc">有 <text class="font-color">{{ presellOrderCount }}</text> 笔预售尾款订单待付款,请点击查看</view>
  43. </view>
  44. <view class="photo acea-row row-between">
  45. <view class='picture'>
  46. <image :src='(presellProList[0].orderProduct[0].cart_info.productAttr && presellProList[0].orderProduct[0].cart_info.productAttr.image) || presellProList[0].orderProduct[0].cart_info.product.image'></image>
  47. </view>
  48. <view class="more_btn"><text class="iconfont icon-gengduo3"></text></view>
  49. </view>
  50. </navigator>
  51. </view>
  52. <view class='list'>
  53. <!-- 代付款 -->
  54. <view v-if="orderList.length > 0">
  55. <block v-if="orderStatus == 0">
  56. <view class='item' v-for="(item,index) in orderList" :key="index">
  57. <view @click='goOrderDetails(item.group_order_id)'>
  58. <view class='title acea-row row-between-wrapper'>
  59. <view class="acea-row row-middle left-wrapper">
  60. {{item.group_order_sn}}
  61. </view>
  62. <view class='font-color'>{{ item.orderList[0].activity_type === 2 && item.orderList[0].orderProduct[0].cart_info.productPresell.presell_type ==2 ? "待付定金" : "待付款" }}</view>
  63. </view>
  64. <view v-for="(order,j) in item.orderList" :key="order.order_id+j">
  65. <block v-for="(goods,g) in order.orderProduct">
  66. <!--预售-->
  67. <view v-if="order.activity_type === 2">
  68. <view class='item-info acea-row row-between row-top'>
  69. <view class='pictrue'>
  70. <image :src='(goods.cart_info.productAttr && goods.cart_info.productAttr.image) || goods.cart_info.product.image'></image>
  71. </view>
  72. <view class='text acea-row row-between'>
  73. <view class='name line1'>
  74. <text class="event_name event_bg">预售</text><text>{{goods.cart_info.product.store_name}}</text>
  75. <view class="event_ship event_color">发货时间:
  76. <!--全款预售-->
  77. <text v-if="goods.cart_info.productPresell.presell_type === 1">
  78. {{ goods.cart_info.productPresell.delivery_type === 1 ? '支付成功后' : '预售结束后' }}{{ goods.cart_info.productPresell.delivery_day }}天内
  79. </text>
  80. <!--定金预售-->
  81. <text v-if="goods.cart_info.productPresell.presell_type === 2">{{ goods.cart_info.productPresell.delivery_type === 1 ? '支付尾款后' : '预售结束后' }}{{ goods.cart_info.productPresell.delivery_day }}天内</text>
  82. </view>
  83. </view>
  84. <view class='money'>
  85. <view>¥{{goods.cart_info.productPresellAttr.presell_price}}</view>
  86. <view>x{{goods.product_num}}</view>
  87. </view>
  88. </view>
  89. <view v-if="goods.cart_info.productPresell.presell_type === 2" class="event_price">
  90. 定金待支付 <text class="font-color">¥{{ order.pay_price }}</text>
  91. 尾款待支付 <text class="font-color">¥{{ order.presellOrder.pay_price }}</text>
  92. </view>
  93. </view>
  94. </view>
  95. <view v-else>
  96. <view class='item-info acea-row row-between row-top'>
  97. <view class='pictrue'>
  98. <image :src='(goods.cart_info.productAttr && goods.cart_info.productAttr.image) || goods.cart_info.product.image'></image>
  99. </view>
  100. <view class='text acea-row row-between'>
  101. <view class='name line2'>{{goods.cart_info.product.store_name}}</view>
  102. <view class='money' v-if="item.orderList[0].activity_type == 4">
  103. <view v-if="goods.cart_info.activeSku">¥{{goods.cart_info.activeSku.active_price}}</view>
  104. <view>x{{goods.product_num}}</view>
  105. </view>
  106. <view v-else class='money'>
  107. <view>¥{{goods.cart_info.productAttr.price}}</view>
  108. <view>x{{goods.product_num}}</view>
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. </block>
  114. </view>
  115. <view class='bottom acea-row row-right row-middle'>
  116. <!-- <view class='bnt cancelBnt' @click.stop='cancelOrder(index,item.group_order_id)'>取消订单</view> -->
  117. <view class='bnt bg-color' @click.stop='goPay(item.pay_price,item.group_order_id)'>立即付款</view>
  118. </view>
  119. </view>
  120. </view>
  121. </block>
  122. <!-- 待发货 待收货 待评价 已完成 -->
  123. <block v-else>
  124. <view class='item' v-for="(item,index) in orderList" :key="index">
  125. <view @click='goOrderDetails(item.order_id)'>
  126. <view class='title acea-row row-between-wrapper'>
  127. <view class="acea-row row-middle left-wrapper" @click.stop="goMall(item)">
  128. <text class="iconfont icon-shangjiadingdan"></text>
  129. <view class="store-name">{{item.merchant.mer_name}}</view>
  130. <text class="iconfont icon-xiangyou"></text>
  131. </view>
  132. <view v-if="item.status == 0" class='font-color'>待发货</view>
  133. <view v-if="item.status == 1" class='font-color'>待收货</view>
  134. <view v-if="item.status == 2" class='font-color'>待评价</view>
  135. <view v-if="item.status == 3" class='font-color'>已完成</view>
  136. <view v-if="item.status == -1" class='font-color'>已退款</view>
  137. </view>
  138. <view v-if="item.activity_type === 2">
  139. <view class='item-info acea-row row-between row-top' v-for="(goods,index) in item.orderProduct" :key="index">
  140. <view class='pictrue'>
  141. <image :src='(goods.cart_info.productAttr && goods.cart_info.productAttr.image) || goods.cart_info.product.image'></image>
  142. </view>
  143. <view class='text acea-row row-between'>
  144. <view class='name '>
  145. <view class='name' :class="item.status === 0 ? 'line1' : 'line2'">
  146. <text class="event_name event_bg">预售</text><text>{{goods.cart_info.product.store_name}}</text>
  147. <view v-if="item.status == 0" class="event_ship event_color">发货时间:
  148. <!--全款预售-->
  149. <text v-if="goods.cart_info.productPresell.presell_type === 1">{{ goods.cart_info.productPresell.delivery_type === 1 ? '支付成功后' : '预售结束后' }}{{ goods.cart_info.productPresell.delivery_day }}天内</text>
  150. <!--定金预售-->
  151. <text v-if="goods.cart_info.productPresell.presell_type === 2">{{ goods.cart_info.productPresell.delivery_type === 1 ? '支付尾款后' : '预售结束后' }}{{ goods.cart_info.productPresell.delivery_day }}天内</text>
  152. </view>
  153. </view>
  154. <view style="margin-top: 10rpx; color: red;">{{goods.is_refund==1?'退款中':goods.is_refund==2?'部分退款':goods.is_refund==3?'全部退款':''}}</view>
  155. </view>
  156. <view class='money'>
  157. <view>¥{{goods.cart_info.productPresellAttr.presell_price}}</view>
  158. <view>x{{goods.product_num}}</view>
  159. </view>
  160. </view>
  161. </view>
  162. </view>
  163. <view v-else>
  164. <view class='item-info acea-row row-between row-top' v-for="(goods,index) in item.orderProduct" :key="index">
  165. <view class='pictrue'>
  166. <image :src='(goods.cart_info.productAttr && goods.cart_info.productAttr.image) || goods.cart_info.product.image'></image>
  167. </view>
  168. <view class='text acea-row row-between'>
  169. <view class='name '>
  170. <view class='name line2'>
  171. <text>{{goods.cart_info.product.store_name}}</text>
  172. </view>
  173. <view style="margin-top: 10rpx; color: red;">{{goods.is_refund==1?'退款中':goods.is_refund==2?'部分退款':goods.is_refund==3?'全部退款':''}}</view>
  174. </view>
  175. <view class='money' v-if="item.activity_type == 3">
  176. <view v-if="goods.cart_info.productAssistAttr">¥{{goods.cart_info.productAssistAttr.assist_price}}</view>
  177. <view>x{{goods.product_num}}</view>
  178. </view>
  179. <view class='money' v-else-if="item.activity_type == 4">
  180. <view v-if="goods.cart_info.activeSku">¥{{goods.cart_info.activeSku.active_price}}</view>
  181. <view>x{{goods.product_num}}</view>
  182. </view>
  183. <view class='money' v-else>
  184. <view>¥{{goods.cart_info.productAttr.price}}</view>
  185. <view>x{{goods.product_num}}</view>
  186. </view>
  187. </view>
  188. </view>
  189. </view>
  190. <view class='totalPrice' v-if="item.activity_type == 2">共{{item.orderNum || 0}}件商品,总金额
  191. <text class='money font-color'>¥{{item.presell_price}}</text>
  192. </view>
  193. <view class='totalPrice' v-else>共{{item.orderNum || 0}}件商品,总金额
  194. <text class='money font-color'>¥{{item.pay_price}}</text>
  195. </view>
  196. </view>
  197. <view class='bottom acea-row row-right row-middle'>
  198. <block v-if="item.status == 0 || item.status == 9">
  199. <!-- <view class='bnt cancelBnt' @click='goOrderDetails(item.order_id)'>申请退款</view> -->
  200. <view class='bnt bg-color' @click='goOrderDetails(item.order_id)'>查看详情</view>
  201. </block>
  202. <block v-if="item.status == 1">
  203. <view class='bnt cancelBnt' v-if="item.delivery_type == 1 || item.delivery_type == 2" @click='goOrderDetails(item.order_id)'>查看物流</view>
  204. <view class='bnt bg-color' @tap='confirmOrder(item,index)'>确认收货</view>
  205. </block>
  206. <block v-if="item.status == 2">
  207. <!-- <view class='bnt cancelBnt' @click='goOrderDetails(item.order_id)'>再次购买</view> -->
  208. <view class='bnt bg-color' @click='goOrderDetails_Evaluation(item.order_id)'>去评价</view>
  209. </block>
  210. <block v-if="item.status == 3">
  211. <!-- <view class="bnt cancelBnt" @click="delOrder(item.order_id,index)">删除记录</view> -->
  212. <view class='bnt bg-color' @click='goOrderDetails(item.order_id)' v-if="item.activity_type == 2 || item.activity_type == 3">查看详情</view>
  213. <view class='bnt bg-color' @click='goOrderDetails(item.order_id)' v-else>再次购买</view>
  214. </block>
  215. <!-- <view class='bnt cancelBnt' v-if="item._status._type==0 || item._status._type == 9" @click='cancelOrder(index,item.order_id)'>取消订单</view>
  216. <view class='bnt bg-color' v-if="item._status._type == 0" @click='goPay(item.pay_price,item.order_id)'>立即付款</view>
  217. <view class='bnt cancelBnt' v-if="item._status._type == 1" @click='cancelOrder(index,item.order_id)'>申请退款</view>
  218. <view class='bnt bg-color' v-if="item._status._type == 1 || item._status._type == 9" @click='goOrderDetails(item.order_id)'>查看详情</view>
  219. <view class='bnt cancelBnt' v-if="item._status._type == 2" @click='goOrderDetails(item.order_id)'>查看物流</view>
  220. <view class='bnt bg-color' v-if="item._status._type == 2" @click='goOrderDetails(item.order_id)'>确认收货</view>
  221. <view class='bnt cancelBnt' v-if="item._status._type == 3" @click='goOrderDetails(item.order_id)'>再次购买</view>
  222. <view class='bnt bg-color' v-if="item._status._type == 3" @click='goOrderDetails(item.order_id)'>去评价</view>
  223. <view class='bnt cancelBnt' v-if="item._status._type == 4" @click='delOrder(item.order_id,index)'>删除订单</view>
  224. <view class='bnt bg-color' v-if="item._status._type == 4" @click='goOrderDetails(item.order_id)'>再次购买</view> -->
  225. </view>
  226. </view>
  227. </block>
  228. </view>
  229. </view>
  230. <view class='loadingicon acea-row row-center-wrapper' v-if="orderList.length>5">
  231. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
  232. </view>
  233. <view v-if="orderList.length == 0">
  234. <emptyPage title="暂无订单~"></emptyPage>
  235. </view>
  236. </view>
  237. <view class='noCart' v-if="orderList.length == 0 && page > 1">
  238. <view class='pictrue'>
  239. <image src='/images/noOrder.png'></image>
  240. </view>
  241. </view>
  242. <!-- #ifdef MP -->
  243. <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
  244. <!-- #endif -->
  245. <payment :payMode='payMode' :pay_close="pay_close" @onChangeFun='onChangeFun' :order_id="pay_order_id" :totalPrice='totalPrice'></payment>
  246. </view>
  247. </template>
  248. <script>
  249. let app = getApp();
  250. import {
  251. getOrderList,
  252. orderData,
  253. unOrderCancel,
  254. orderDel,
  255. orderPay,
  256. groupOrderList,
  257. orderTake
  258. } from '@/api/order.js';
  259. import {
  260. getUserInfo
  261. } from '@/api/user.js';
  262. import {
  263. openOrderSubscribe
  264. } from '@/utils/SubscribeMessage.js';
  265. import payment from '@/components/payment';
  266. import {
  267. toLogin
  268. } from '@/libs/login.js';
  269. import {
  270. getconfig,
  271. } from '@/api/public.js'
  272. import {
  273. mapGetters
  274. } from "vuex";
  275. // #ifdef MP
  276. import authorize from '@/components/Authorize';
  277. // #endif
  278. import emptyPage from '@/components/emptyPage.vue'
  279. export default {
  280. components: {
  281. payment,
  282. emptyPage,
  283. // #ifdef MP
  284. authorize
  285. // #endif
  286. },
  287. data() {
  288. return {
  289. loading: false, //是否加载中
  290. loadend: false, //是否加载完毕
  291. loadTitle: '加载更多', //提示语
  292. orderList: [], //订单数组
  293. presellProList: [], //定金预售订单
  294. presellOrderCount: 0,
  295. orderData: {}, //订单详细统计
  296. orderStatus: 0, //订单状态
  297. page: 1,
  298. limit: 20,
  299. payMode: [{
  300. name: "微信支付",
  301. icon: "icon-weixinzhifu",
  302. value: 'wechat',
  303. title: '微信快捷支付',
  304. payStatus: 1
  305. },
  306. {
  307. name: "支付宝支付",
  308. icon: "icon-zhifubao",
  309. value: 'alipay',
  310. title: '支付宝支付',
  311. payStatus: app.globalData.alipay_open
  312. },
  313. {
  314. name: "余额支付",
  315. icon: "icon-yuezhifu",
  316. value: 'balance',
  317. title: '可用余额:',
  318. number: 0,
  319. payStatus: app.globalData.yue_pay_status
  320. }
  321. ],
  322. pay_close: false,
  323. pay_order_id: '',
  324. totalPrice: '0',
  325. isAuto: false, //没有授权的不会自动授权
  326. isShowAuth: false, //是否隐藏授权
  327. hide_mer_status: 1,
  328. isReady: true,
  329. };
  330. },
  331. computed: mapGetters(['isLogin']),
  332. onShow() {
  333. if (this.isLogin) {
  334. this.$set(this, 'orderList', []);
  335. this.page = 1;
  336. this.loadend = false;
  337. this.loading = false;
  338. this.getOrderData();
  339. this.getOrderList();
  340. this.getUserInfo();
  341. this.getpreSellOrderList();
  342. } else {
  343. // #ifdef H5 || APP-PLUS
  344. toLogin();
  345. // #endif
  346. // #ifdef MP
  347. this.isAuto = true;
  348. this.$set(this, 'isShowAuth', true);
  349. // #endif
  350. }
  351. },
  352. onReady(){
  353. uni.$on('update',(data)=>{
  354. this.hide_mer_status = data.hide_mer_status
  355. })
  356. },
  357. mounted: function() {
  358. const app = getApp();
  359. this.$nextTick(() => {
  360. this.hide_mer_status = app.globalData.hide_mer_status
  361. });
  362. },
  363. methods: {
  364. // 去商铺
  365. goMall(item){
  366. if(this.hide_mer_status == 0){
  367. uni.navigateTo({
  368. url:'/pages/store/home/index?id='+item.mer_id
  369. })
  370. }
  371. },
  372. onLoadFun() {
  373. this.isShowAuth = false;
  374. this.getOrderData();
  375. this.getOrderList();
  376. this.getUserInfo();
  377. },
  378. // 授权关闭
  379. authColse: function(e) {
  380. this.isShowAuth = e
  381. },
  382. /**
  383. * 事件回调
  384. *
  385. */
  386. onChangeFun: function(e) {
  387. let opt = e;
  388. let action = opt.action || null;
  389. let value = opt.value != undefined ? opt.value : null;
  390. (action && this[action]) && this[action](value);
  391. },
  392. /**
  393. * 获取用户信息
  394. *
  395. */
  396. getUserInfo: function() {
  397. let that = this;
  398. getUserInfo().then(res => {
  399. that.payMode[2].number = res.data.now_money;
  400. // that.$set(that, 'payMode', that.payMode);
  401. });
  402. },
  403. /**
  404. * 关闭支付组件
  405. *
  406. */
  407. payClose: function() {
  408. this.pay_close = false;
  409. },
  410. /**
  411. * 生命周期函数--监听页面加载
  412. */
  413. onLoad: function(options) {
  414. if (options.status) this.orderStatus = options.status;
  415. // // 获取配置
  416. // getconfig().then(res => {
  417. // this.payMode[1].yue_pay_status = res.data.yue_pay_status
  418. // this.payMode[2].alipay_open = res.data.alipay_open
  419. // try {
  420. // } catch (e) {
  421. // // error
  422. // }
  423. // // #ifdef H5
  424. // this.setOpenShare(res.data);
  425. // // #endif
  426. // }).catch(err => {})
  427. },
  428. /**
  429. * 获取订单统计数据
  430. *
  431. */
  432. getOrderData: function() {
  433. let that = this;
  434. orderData().then(res => {
  435. that.$set(that, 'orderData', res.data);
  436. })
  437. },
  438. /**
  439. * 取消订单
  440. *
  441. */
  442. cancelOrder: function(index, order_id) {
  443. let that = this;
  444. if (!order_id) return that.$util.Tips({
  445. title: '缺少订单号无法取消订单'
  446. });
  447. unOrderCancel(order_id).then(res => {
  448. return that.$util.Tips({
  449. title: res.message,
  450. icon: 'success'
  451. }, function() {
  452. that.orderList.splice(index, 1);
  453. that.$set(that, 'orderList', that.orderList);
  454. that.$set(that.orderData, 'unpaid_count', that.orderData.unpaid_count - 1);
  455. that.getOrderData();
  456. });
  457. }).catch(err => {
  458. return that.$util.Tips({
  459. title: err
  460. });
  461. });
  462. },
  463. /**
  464. * 打开支付组件
  465. *
  466. */
  467. goPay: function(pay_price, order_id) {
  468. console.log(order_id)
  469. console.log(pay_price,"pay_price")
  470. this.$set(this, 'pay_close', true);
  471. this.order_id = order_id;
  472. this.pay_order_id = order_id.toString()
  473. // this.$set(this, 'pay_order_id', );
  474. this.$set(this, 'totalPrice', pay_price);
  475. },
  476. /**
  477. * 支付成功回调
  478. *
  479. */
  480. pay_complete: function() {
  481. this.loadend = false;
  482. this.page = 1;
  483. this.$set(this, 'orderList', []);
  484. this.pay_close = false;
  485. this.pay_order_id = '';
  486. this.getOrderData();
  487. this.getOrderList();
  488. },
  489. /**
  490. * 支付失败回调
  491. *
  492. */
  493. pay_fail: function() {
  494. this.pay_close = false;
  495. this.pay_order_id = '';
  496. },
  497. /**
  498. * 去订单详情
  499. */
  500. goOrderDetails: function(order_id) {
  501. let self = this
  502. if (!order_id) return that.$util.Tips({
  503. title: '缺少订单号无法查看订单详情'
  504. });
  505. // #ifdef MP
  506. uni.showLoading({
  507. title: '正在加载',
  508. })
  509. openOrderSubscribe().then(() => {
  510. uni.hideLoading();
  511. if (self.orderStatus == 0) {
  512. uni.navigateTo({
  513. url: '/pages/order_details/stay?order_id=' + order_id
  514. })
  515. } else {
  516. uni.navigateTo({
  517. url: '/pages/order_details/index?order_id=' + order_id
  518. })
  519. }
  520. }).catch(() => {
  521. uni.hideLoading();
  522. })
  523. // #endif
  524. // #ifndef MP
  525. if (self.orderStatus == 0) {
  526. uni.navigateTo({
  527. url: '/pages/order_details/stay?order_id=' + order_id
  528. })
  529. } else {
  530. uni.navigateTo({
  531. url: '/pages/order_details/index?order_id=' + order_id
  532. })
  533. }
  534. // #endif
  535. },
  536. /**
  537. * 点击去评价
  538. */
  539. goOrderDetails_Evaluation: function(order_id) {
  540. let self = this
  541. if (!order_id) return that.$util.Tips({
  542. title: '缺少订单号无法查看订单详情和评价'
  543. });
  544. // #ifdef MP
  545. if (self.orderStatus == 0) {
  546. uni.navigateTo({
  547. url: '/pages/order_details/stay?order_id=' + order_id
  548. })
  549. } else {
  550. uni.navigateTo({
  551. url: '/pages/order_details/index?order_id=' + order_id
  552. })
  553. }
  554. // #endif
  555. // #ifndef MP
  556. if (self.orderStatus == 0) {
  557. uni.navigateTo({
  558. url: '/pages/order_details/stay?order_id=' + order_id
  559. })
  560. } else {
  561. uni.navigateTo({
  562. url: '/pages/order_details/index?order_id=' + order_id
  563. })
  564. }
  565. // #endif
  566. },
  567. /**
  568. * 切换类型
  569. */
  570. statusClick: function(status) {
  571. if (status == this.orderStatus) return;
  572. this.orderStatus = status;
  573. this.loadend = false;
  574. this.loading = false;
  575. this.page = 1;
  576. this.$set(this, 'orderList', []);
  577. this.getOrderList();
  578. },
  579. /**
  580. * 获取订单列表
  581. */
  582. getOrderList: function() {
  583. let that = this;
  584. if (that.loadend) return;
  585. if (that.loading) return;
  586. that.loading = true;
  587. that.loadTitle = "加载更多";
  588. if(that.isReady){
  589. that.isReady = false
  590. if (that.orderStatus == 0) {
  591. groupOrderList({
  592. page: that.page,
  593. limit: that.limit,
  594. }).then(res => {
  595. that.isReady = true;
  596. let list = res.data.list || [];
  597. let loadend = list.length < that.limit;
  598. console.log(that.orderList)
  599. that.orderList = that.$util.SplitArray(list, that.orderList);
  600. that.$set(that, 'orderList', that.orderList);
  601. console.log(that.orderList)
  602. that.getProductCount();
  603. that.loadend = loadend;
  604. that.loading = false;
  605. that.loadTitle = loadend ? "我也是有底线的" : '加载更多';
  606. that.page = that.page + 1
  607. })
  608. } else {
  609. getOrderList({
  610. status: that.orderStatus - 1,
  611. page: that.page,
  612. limit: that.limit,
  613. }).then(res => {
  614. let list = res.data.list || [];
  615. let loadend = list.length < that.limit;
  616. that.orderList = that.$util.SplitArray(list, that.orderList);
  617. that.$set(that, 'orderList', that.orderList);
  618. that.getProductCount();
  619. that.loadend = loadend;
  620. that.loading = false;
  621. that.loadTitle = loadend ? "我也是有底线的" : '加载更多';
  622. that.page = that.page + 1;
  623. that.isReady = true;
  624. }).catch(err => {
  625. that.loading = false;
  626. that.loadTitle = "加载更多";
  627. })
  628. }
  629. }
  630. },
  631. /**
  632. * 获取定金预售订单列表
  633. */
  634. getpreSellOrderList: function() {
  635. let that = this;
  636. getOrderList({
  637. status: 10,
  638. page: 1,
  639. limit: 1,
  640. }).then(res => {
  641. let list = res.data.list || [];
  642. that.presellOrderCount = res.data.count;
  643. that.$set(that, 'presellProList', list);
  644. })
  645. },
  646. /**
  647. * 获取单个订单商品数量
  648. */
  649. getProductCount: function(){
  650. if(this.orderStatus !== 0){
  651. this.orderList.forEach((item,i) => {
  652. let orderNum = 0
  653. item.orderProduct.forEach((val) => {
  654. orderNum += val.product_num
  655. })
  656. this.orderList[i]['orderNum']=orderNum;
  657. })
  658. }
  659. },
  660. /**
  661. * 删除订单
  662. */
  663. delOrder: function(order_id, index) {
  664. let that = this;
  665. orderDel(order_id).then(res => {
  666. that.orderList.splice(index, 1);
  667. that.$set(that, 'orderList', that.orderList);
  668. that.$set(that.orderData, 'unpaid_count', that.orderData.unpaid_count - 1);
  669. that.getOrderData();
  670. return that.$util.Tips({
  671. title: '删除成功',
  672. icon: 'success'
  673. });
  674. }).catch(err => {
  675. return that.$util.Tips({
  676. title: err
  677. });
  678. })
  679. },
  680. // 确认收货
  681. confirmOrder: function(item, index) {
  682. let that = this;
  683. uni.showModal({
  684. title: '确认收货',
  685. content: '为保障权益,请收到货确认无误后,再确认收货',
  686. success: function(res) {
  687. if (res.confirm) {
  688. orderTake(item.order_id).then(res => {
  689. return that.$util.Tips({
  690. title: '操作成功',
  691. icon: 'success'
  692. }, function() {
  693. that.orderList.splice(index, 1);
  694. that.getOrderData();
  695. });
  696. }).catch(err => {
  697. return that.$util.Tips({
  698. title: err
  699. });
  700. })
  701. }
  702. }
  703. })
  704. },
  705. },
  706. onReachBottom: function() {
  707. this.getOrderList();
  708. }
  709. }
  710. </script>
  711. <style scoped lang="scss">
  712. .my-order .header {
  713. height: 260rpx;
  714. padding: 0 30rpx;
  715. }
  716. .my-order .header .picTxt {
  717. height: 190rpx;
  718. }
  719. .my-order .header .picTxt .text {
  720. color: rgba(255, 255, 255, 0.8);
  721. font-size: 26rpx;
  722. font-family: 'Guildford Pro';
  723. }
  724. .my-order .header .picTxt .text .name {
  725. font-size: 34rpx;
  726. font-weight: bold;
  727. color: #fff;
  728. margin-bottom: 20rpx;
  729. }
  730. .my-order .header .picTxt .pictrue {
  731. width: 122rpx;
  732. height: 109rpx;
  733. }
  734. .my-order .header .picTxt .pictrue image {
  735. width: 100%;
  736. height: 100%;
  737. }
  738. .my-order .nav {
  739. background-color: #fff;
  740. width: 690rpx;
  741. height: 140rpx;
  742. border-radius: 6rpx;
  743. margin: -73rpx auto 0 auto;
  744. }
  745. .my-order .nav .item {
  746. text-align: center;
  747. font-size: 26rpx;
  748. color: #282828;
  749. padding: 29rpx 0;
  750. }
  751. .my-order .nav .item.on {
  752. font-weight: bold;
  753. border-bottom: 5rpx solid #e93323;
  754. }
  755. .my-order .nav .item .num {
  756. margin-top: 18rpx;
  757. }
  758. .my-order .list {
  759. width: 690rpx;
  760. margin: 14rpx auto 0 auto;
  761. }
  762. .my-order .list .item {
  763. background-color: #fff;
  764. border-radius: 6rpx;
  765. margin-bottom: 14rpx;
  766. }
  767. .my-order .list .item .title {
  768. height: 84rpx;
  769. padding: 0 30rpx;
  770. border-bottom: 1rpx solid #eee;
  771. font-size: 28rpx;
  772. color: #282828;
  773. .left-wrapper {
  774. .iconfont {
  775. margin-top: 5rpx;
  776. }
  777. .store-name {
  778. margin: 0 10rpx;
  779. }
  780. .icon-xiangyou {
  781. font-size: 20rpx;
  782. }
  783. }
  784. }
  785. .my-order .list .item .title .sign {
  786. font-size: 24rpx;
  787. padding: 0 7rpx;
  788. height: 36rpx;
  789. margin-right: 15rpx;
  790. }
  791. .my-order .list .item .item-info {
  792. padding: 0 30rpx;
  793. margin-top: 22rpx;
  794. }
  795. .my-order .list .item .item-info .pictrue {
  796. width: 120rpx;
  797. height: 120rpx;
  798. }
  799. .my-order .list .item .item-info .pictrue image {
  800. width: 100%;
  801. height: 100%;
  802. border-radius: 6rpx;
  803. }
  804. .my-order .list .item .item-info .text {
  805. width: 486rpx;
  806. font-size: 28rpx;
  807. color: #999;
  808. margin-top: 6rpx;
  809. }
  810. .my-order .list .item .item-info .text .name {
  811. width: 320rpx;
  812. color: #282828;
  813. }
  814. .event_bg{
  815. background: #FF7F00;
  816. }
  817. .event_color{
  818. color: #FF7F00;
  819. }
  820. .my-order .list .item .event_name{
  821. display: inline-block;
  822. margin-right: 9rpx;
  823. color: #fff;
  824. font-size: 20rpx;
  825. padding: 0 8rpx;
  826. line-height: 30rpx;
  827. text-align: center;
  828. border-radius: 6rpx;
  829. }
  830. .my-order .list .item .event_ship{
  831. font-size: 20rpx;
  832. margin-top: 10rpx;
  833. }
  834. .my-order .list .event_price{
  835. margin: 0 0 50rpx 120rpx;
  836. }
  837. .my-order .list .item .item-info .text .money {
  838. text-align: right;
  839. }
  840. .my-order .list .item .totalPrice {
  841. font-size: 26rpx;
  842. color: #282828;
  843. text-align: right;
  844. margin: 27rpx 0 0 30rpx;
  845. padding: 0 30rpx 30rpx 0;
  846. }
  847. .my-order .list .item .totalPrice .money {
  848. font-size: 28rpx;
  849. font-weight: bold;
  850. }
  851. .my-order .list .item .bottom {
  852. height: 107rpx;
  853. padding: 0 30rpx;
  854. border-top: 1px solid #f0f0f0;
  855. }
  856. .my-order .list .item .bottom .bnt {
  857. width: 176rpx;
  858. height: 60rpx;
  859. text-align: center;
  860. line-height: 60rpx;
  861. color: #fff;
  862. border-radius: 50rpx;
  863. font-size: 27rpx;
  864. }
  865. .my-order .list .item .bottom .bnt.cancelBnt {
  866. border: 1rpx solid #ddd;
  867. color: #aaa;
  868. }
  869. .my-order .list .item .bottom .bnt~.bnt {
  870. margin-left: 17rpx;
  871. }
  872. .noCart {
  873. margin-top: 171rpx;
  874. padding-top: 0.1rpx;
  875. }
  876. .noCart .pictrue {
  877. width: 414rpx;
  878. height: 336rpx;
  879. margin: 78rpx auto 56rpx auto;
  880. }
  881. .noCart .pictrue image {
  882. width: 100%;
  883. height: 100%;
  884. }
  885. .event_container{
  886. width: 690rpx;
  887. background-image: url(~static/images/presell_orderBg.png);
  888. background-size: cover;
  889. background-repeat: no-repeat;
  890. margin: 20rpx auto;
  891. padding: 26rpx 30rpx;
  892. border-radius: 16rpx;
  893. .info{
  894. width: 420rpx;
  895. .title{
  896. color: #282828;
  897. font-size: 26rpx;
  898. }
  899. .desc{
  900. color: #999;
  901. font-size: 24rpx;
  902. margin-top: 30rpx;
  903. }
  904. }
  905. .photo{
  906. width: 180rpx;
  907. .picture{
  908. width: 120rpx;
  909. height: 120rpx;
  910. image{
  911. width: 100%;
  912. height: 100%;
  913. border-radius: 8rpx;
  914. }
  915. }
  916. .more_btn{
  917. color: #fff;
  918. background: #F97E3B;
  919. width: 40rpx;
  920. height: 40rpx;
  921. border-radius: 40rpx;
  922. text-align: center;
  923. line-height: 40rpx;
  924. position: relative;
  925. top: 40rpx;
  926. text{
  927. font-size: 10rpx;
  928. }
  929. }
  930. }
  931. }
  932. </style>