index.vue 29 KB

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