index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. <template>
  2. <view class="container">
  3. <view style="padding-bottom:68upx;">
  4. <view>
  5. <u-tabs :list="tabList" :is-scroll="false" bg-color="#F7F7F7" active-color="#FF7800" :current="type" @change="orderStateChange"></u-tabs>
  6. </view>
  7. <view class="order-list-box">
  8. <view v-if="list.length > 0">
  9. <view class="item" v-for="(item, index) in list" :key="item.id" @click="itemTap(item)">
  10. <view class="order-list-top">
  11. <view class="top-l" @click.stop="goShop(item.storeId)" v-if="isShowShop">
  12. <image src="/images/orderList-shop-img.png" class="shop-img"></image>
  13. <text class="shop-name">{{item.storeName}}</text>
  14. <image src="/images/arrow-right.png" class="arrow-img"></image>
  15. </view>
  16. <view class="top-l" v-else>
  17. </view>
  18. <!--订单状态: 退款中 交易关闭 待付款 待发货 待收货 已完成-->
  19. <view class="order-status" v-if='item.orderStatus==1'>待付款</view>
  20. <view class="order-status" v-else-if='item.orderStatus==2'>待发货</view>
  21. <view class="order-status" v-else-if='item.orderStatus==3'>待收货</view>
  22. <view class="order-status" v-else-if='item.orderStatus==4'>已完成</view>
  23. <view class="order-status" v-else-if='item.orderStatus==5'>交易关闭</view>
  24. <view class="order-status" v-else-if='item.returnType==1'>退款中</view>
  25. </view>
  26. <view class="order-info-box">
  27. <view class="order-info">
  28. <view class="order-info-item" v-for="(proItem, pIndex) in item.orderProductVOList" :key="proItem.id">
  29. <image :src="proItem.skuImg" class="product-img"></image>
  30. <view class="info-box">
  31. <text class="product-name">{{proItem.productName}}</text>
  32. <view class="product-sku">{{proItem.skuNameStr}}</view>
  33. <view class="price-sku-box">
  34. <view class="box-h">
  35. <text class="product-price"><text class="fuhao">¥</text>{{fenToYuan(proItem.sellPrice)}}</text>
  36. <text class="product-num">x {{proItem.buyNum}}</text>
  37. </view>
  38. <view v-if="proItem.commentStatus == 0" class="evaluate" @click.stop="evaluateTap(proItem,pIndex)">立即评价</view>
  39. <view v-if="proItem.commentStatus == 1 && proItem.additionalComment != null" class="evaluate2" @click.stop="evaluateTowTap(index)">追加评价</view>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="total-price-box">总价¥{{fenToYuan(item.orderSum)}}
  44. <block v-if="item.paySum > 0">
  45. ,实付¥{{fenToYuan(item.paySum)}}
  46. </block>
  47. </view>
  48. </view>
  49. <view class="order-btn-box">
  50. <text class="btn l" v-if='item.orderStatus==1' @click.stop="cancelOrder(item,index)">取消订单</text>
  51. <text class="btn r" v-if='item.orderStatus==1' @click.stop="payOrder(item,index)">立即付款</text>
  52. <text class="btn l" v-if='(item.orderStatus==2 || item.orderStatus==3 || item.orderStatus==4) && item.returnType == -1' @click.stop="applyTap(item,index)" >申请售后</text>
  53. <text class="btn l" v-if='item.logisticsNum && item.shipperCode' @click.stop="goLogisticsTap(item.shipperCode,item.logisticsNum)">查看物流</text>
  54. <text class="btn r" v-if='item.orderStatus==3' @click.stop="confirmReceiptTap(item,index)">确认收货</text>
  55. <text class="btn l" v-if='item.orderStatus==5' @click.stop="delOrder(item,index)">删除订单</text>
  56. <text class="btn l" v-if='item.returnType==1' @click.stop="refundDetail(item)">退款详情</text>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <view v-else class="emptyOrder-box flex-items-plus flex-column">
  62. <image class="emptyOrder-img" src=""></image>
  63. <label class="font-color-999 fs26 mar-top-30">你还没有订单哦~</label>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </template>
  69. <script>
  70. // const NET = require('../../utils/request')
  71. // const API = require('../../config/api')
  72. // var jweixin = require('jweixin-module');
  73. export default {
  74. data() {
  75. return {
  76. type: 0,
  77. pageIndex: 1,
  78. pageSize: 50,
  79. list: [],
  80. scrollLeft: 0,
  81. isShowShop: false,
  82. tabList: [
  83. {
  84. name: '全部'
  85. },{
  86. name: '待付款'
  87. },{
  88. name: '待发货'
  89. },{
  90. name: '待收货'
  91. },{
  92. name: '待评价'
  93. },
  94. ],
  95. }
  96. },
  97. onLoad(options) {
  98. this.type = options.type
  99. // this.getListData(options.type)
  100. // this.getGetStoreSwitch()
  101. },
  102. methods: {
  103. //退款详情
  104. refundDetail(item){
  105. uni.navigateTo({
  106. url:'refundDetails?item='+JSON.stringify(item)
  107. })
  108. },
  109. orderStateChange(index) {
  110. this.type = index;
  111. this.getListData(index)
  112. },
  113. getGetStoreSwitch() {
  114. NET.request(API.GetStoreSwitch).then(res => {
  115. this.isShowShop = res.data
  116. })
  117. },
  118. // 订单列表数据
  119. getListData(type) {
  120. uni.showLoading({
  121. title: '加载中...',
  122. })
  123. NET.request(API.FindOrderList, {
  124. orderStatus: type,
  125. pageIndex: this.pageIndex,
  126. pageSize: this.pageSize
  127. }, 'POST').then(res => {
  128. uni.hideLoading()
  129. if (this.pageIndex == 1) {
  130. uni.stopPullDownRefresh()
  131. this.list = [];
  132. }
  133. let list = res.data.orderVOList
  134. this.list = this.list.concat(list)
  135. console.log(res.data,8889999999999)
  136. }).catch(res => {
  137. uni.hideLoading()
  138. })
  139. },
  140. cancelOrder(item,index) {
  141. uni.showModal({
  142. title: '温馨提示',
  143. content: '您确定要取消该订单吗?',
  144. confirmText: '确定取消',
  145. cancelText: '点错了',
  146. success: res => {
  147. if (res.confirm) {
  148. this.doCancel(item, index)
  149. } else if (res.cancel) {
  150. console.log('用户点击取消')
  151. }
  152. }
  153. })
  154. },
  155. doCancel(item, index) {
  156. uni.showLoading({
  157. title: '提交中...',
  158. })
  159. NET.request(API.CancelOrder, {
  160. id: item.id
  161. }, 'POST').then(res => {
  162. uni.hideLoading()
  163. uni.showToast({
  164. title: '取消成功',
  165. })
  166. setTimeout(() => {
  167. this.list[index].orderStatus = 5
  168. this.list = this.list
  169. }, 1500);
  170. }).catch(res => {
  171. uni.hideLoading()
  172. })
  173. },
  174. goLogisticsTap(shipperCode,logisticsNum){
  175. uni.navigateTo({
  176. url:'logisticsInfo?shipperCode='+shipperCode+'&logisticsNum='+logisticsNum
  177. })
  178. },
  179. confirmReceiptTap(item, index) {
  180. uni.showModal({
  181. title: '温馨提示',
  182. content: '确定您已经收到货物,否则会造成财产损失',
  183. confirmText: '确定收到',
  184. cancelText: '点错了',
  185. success: res => {
  186. if (res.confirm) {
  187. this.doConfirm(item, index)
  188. } else if (res.cancel) {
  189. console.log('用户点击取消')
  190. }
  191. }
  192. })
  193. },
  194. doConfirm(item, index) {
  195. NET.request(API.ConfirmReceive, {
  196. id: item.id
  197. }, 'POST').then(res => {
  198. uni.hideLoading()
  199. uni.showToast({
  200. title: '确认成功',
  201. })
  202. this.list[index].orderStatus = 4
  203. this.list = this.data.list
  204. }).catch(res => {
  205. uni.hideLoading()
  206. })
  207. },
  208. delOrder(item, index) {
  209. uni.showModal({
  210. title: '温馨提示',
  211. content: '您确定要删除该订单吗?',
  212. confirmText: '确定删除',
  213. cancelText: '点错了',
  214. success: res => {
  215. if (res.confirm) {
  216. this.doDel(item, index)
  217. } else if (res.cancel) {
  218. console.log('用户点击取消')
  219. }
  220. }
  221. })
  222. },
  223. doDel(item, index) {
  224. uni.showLoading({
  225. title: '提交中...',
  226. })
  227. NET.request(API.DelOrder, {
  228. id: item.id
  229. }, 'POST').then(res => {
  230. uni.hideLoading()
  231. uni.showToast({
  232. title: '删除成功',
  233. })
  234. setTimeout(() => {
  235. this.list.splice(index, 1)
  236. this.list = this.list
  237. }, 1500);
  238. }).catch(res => {
  239. uni.hideLoading()
  240. })
  241. },
  242. // 跳转订单详情
  243. itemTap(item) {
  244. uni.navigateTo({
  245. url:'orderDetails?orderId='+item.id
  246. })
  247. },
  248. goShop(id) {
  249. if (!this.isShowShop) {
  250. return
  251. }
  252. uni.navigateTo({
  253. url:'orderDetails?id='+id
  254. })
  255. },
  256. fenToYuan(value) {
  257. if(!value){
  258. return '0.00'
  259. }
  260. value = value/100.0;
  261. return value.toFixed(2) // 此处2为保留两位小数,保留几位小数,这里写几
  262. },
  263. applyTap(item, index) {
  264. // 申请售后
  265. uni.navigateTo({
  266. url: 'afterSaleApply?item=' + JSON.stringify(item)
  267. })
  268. },
  269. payOrder(item, index) {
  270. uni.showLoading({
  271. title: '加载中...',
  272. })
  273. NET.request(API.ContinuePay, {
  274. orderCode: item.orderCode
  275. }, 'POST').then(res => {
  276. uni.hideLoading()
  277. this.payRequest(res.data)
  278. }).catch(res => {
  279. uni.hideLoading()
  280. })
  281. },
  282. //H5支付
  283. // payRequest(payInfo){
  284. // jweixin.config({
  285. // debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  286. // appId:'unif0713a10bbae8732', // 必填,公众号的唯一标识
  287. // timestamp:payInfo.timeStamp, // 必填,生成签名的时间戳
  288. // nonceStr:payInfo.nonceStr, // 必填,生成签名的随机串
  289. // signature:payInfo.paySign, // 必填,签名,见附录1
  290. // jsApiList: ['chooseuniPay'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
  291. // });
  292. // jweixin.ready(function() {
  293. // jweixin.checkJsApi({
  294. // jsApiList: ['chooseuniPay'], // 需要检测的JS接口列表,所有JS接口列表见附录2,
  295. // success: function(res) {
  296. // console.log('checkjsapi Success')
  297. // console.log(res);
  298. // },
  299. // fail:function(res) {
  300. // console.log('res')
  301. // console.log(res);
  302. // }
  303. // });
  304. // jweixin.chooseuniPay({
  305. // timestamp: payInfo.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
  306. // nonceStr: payInfo.nonceStr, // 支付签名随机串,不长于 32 位
  307. // package: payInfo.packageValue, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=***)
  308. // signType: payInfo.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
  309. // paySign:payInfo.paySign, // 支付签名
  310. // success:function(res) {
  311. // // 支付成功后的回调函数
  312. // console.log('paysuccess')
  313. // console.log(res)
  314. // // uni.redirectTo({
  315. // // url: 'index'
  316. // // });
  317. // setTimeout(() => {
  318. // uni.navigateBack({
  319. // delta: 2
  320. // })
  321. // }, 1500)
  322. // },
  323. // cancel: function(r) {
  324. // },
  325. // fail:function(res) {
  326. // console.log(res)
  327. // }
  328. // });
  329. // });
  330. // jweixin.error(function(res) {
  331. // console.log('error')
  332. // console.log(res)
  333. // uni.showToast({
  334. // icon: 'none',
  335. // title: '支付失败了',
  336. // duration: 4000
  337. // });
  338. // });
  339. // },
  340. //立即评论
  341. evaluateTap(item, index){
  342. uni.setStorageSync('evaluateItem', item)
  343. uni.setStorageSync('pIndex', index)
  344. uni.navigateTo({
  345. url: '/pagesGoods/goodsModule/evaluate',
  346. })
  347. },
  348. evaluateTowTap(index){
  349. console.log(this.list[index].orderProductVOList[0],454545)
  350. uni.setStorageSync('addCommentVOList', this.list[index].orderProductVOList[0]);
  351. uni.navigateTo({
  352. url:'/pagesGoods/goodsModule/addEvaluate?type=1'
  353. })
  354. },
  355. }
  356. }
  357. </script>
  358. <style lang="scss">
  359. page {
  360. width: 100%;
  361. height: 100%;
  362. background: #f6f6f6;
  363. }
  364. .nav-box-box {
  365. height: 88upx;
  366. background: #f6f6f6;
  367. white-space: nowrap;
  368. position: fixed;
  369. top: 0;
  370. left: 0;
  371. width: 100%;
  372. z-index: 10;
  373. }
  374. .nav-box-box .item {
  375. display: inline-view;
  376. padding: 0 30upx;
  377. box-sizing: border-box;
  378. height: 88upx;
  379. text-align: center;
  380. line-height: 88upx;
  381. font-size: 30upx;
  382. color: #666;
  383. font-weight: 500;
  384. }
  385. .nav-box-box .item.active text {
  386. display: inline-view;
  387. color: #ff7911;
  388. box-sizing: border-box;
  389. height: 88upx;
  390. border-bottom: 2px solid #ff7911;
  391. }
  392. .order-list-box {
  393. padding: 20upx 30upx 0;
  394. box-sizing: border-box;
  395. }
  396. .order-list-box .item {
  397. margin-bottom: 20upx;
  398. background: #fff;
  399. border-radius: 10upx;
  400. }
  401. .order-list-top {
  402. height: 96upx;
  403. padding: 0 30upx;
  404. box-sizing: border-box;
  405. display: flex;
  406. flex-direction: row;
  407. align-items: center;
  408. justify-content: space-between;
  409. border-bottom: 1px solid #eee;
  410. }
  411. .top-l {
  412. display: flex;
  413. flex-direction: row;
  414. align-items: center;
  415. }
  416. .shop-img {
  417. width: 36upx;
  418. height: 36upx;
  419. margin-right: 10upx;
  420. }
  421. .shop-name {
  422. font-size: 30upx;
  423. color: #333;
  424. font-weight: bold;
  425. }
  426. .arrow-img {
  427. margin-left: 15upx;
  428. width: 24upx;
  429. height: 24upx;
  430. }
  431. .order-status {
  432. font-size: 28upx;
  433. color: #ff7911;
  434. font-weight: 500;
  435. }
  436. .order-info-box {
  437. padding: 0 30upx;
  438. box-sizing: border-box;
  439. }
  440. .order-info {
  441. border-bottom: 1px solid #eee;
  442. }
  443. .order-info-item {
  444. display: flex;
  445. flex-direction: row;
  446. padding: 20upx 0;
  447. }
  448. .product-img {
  449. width: 180upx;
  450. height: 180upx;
  451. border-radius: 10upx;
  452. margin-right: 30upx;
  453. }
  454. .info-box {
  455. flex: 1;
  456. display: flex;
  457. flex-direction: column;
  458. justify-content: space-between;
  459. }
  460. .product-name {
  461. font-size: 26upx;
  462. color: #333;
  463. height: 68upx;
  464. line-height: 34upx;
  465. display: -webkit-box;
  466. overflow: hidden;
  467. text-overflow: ellipsis;
  468. word-break: break-all;
  469. -webkit-box-orient: vertical;
  470. -webkit-line-clamp: 2;
  471. }
  472. .price-sku-box {
  473. display: flex;
  474. flex-direction: row;
  475. justify-content: space-between;
  476. }
  477. .product-sku {
  478. font-size: 24upx;
  479. color: #999;
  480. }
  481. .product-price {
  482. font-size: 28upx;
  483. color: #333;
  484. font-weight: 400;
  485. }
  486. .product-price .fuhao {
  487. font-size: 28upx;
  488. }
  489. .product-num {
  490. display: inline-view;
  491. font-size: 28upx;
  492. margin-left: 20upx;
  493. color: #999;
  494. }
  495. .total-price-box{
  496. font-size: 26upx;
  497. color:#333;
  498. text-align: right;
  499. padding: 30upx 0;
  500. }
  501. .order-btn-box {
  502. padding: 20upx 0;
  503. display: flex;
  504. flex-direction: row;
  505. justify-content: flex-end;
  506. }
  507. .order-btn-box .btn {
  508. display: inline-view;
  509. width: 150upx;
  510. height: 56upx;
  511. border-radius: 28upx;
  512. text-align: center;
  513. line-height: 56upx;
  514. font-size: 26upx;
  515. color:#333;
  516. margin-left: 20upx;
  517. }
  518. .evaluate{
  519. height: 56upx;
  520. border-radius: 28upx;
  521. text-align: center;
  522. line-height: 56upx;
  523. font-size: 26upx;
  524. padding: 0 30upx;
  525. border: 1px solid #FF7911;
  526. color: #FF7911;
  527. }
  528. .evaluate2{
  529. height: 56upx;
  530. border-radius: 28upx;
  531. text-align: center;
  532. line-height: 56upx;
  533. font-size: 26upx;
  534. padding: 0 30upx;
  535. border: 1px solid #BBBBBB;
  536. color: #333;
  537. }
  538. .order-btn-box .btn.l {
  539. border: 1px solid #BBBBBB;
  540. color: #333;
  541. }
  542. .order-btn-box .btn.r {
  543. border: 1px solid #FF7911;
  544. color: #FF7911;
  545. }
  546. .emptyOrder-box{
  547. margin-top: 70upx;
  548. .emptyOrder-img{
  549. width: 270upx;
  550. height: 270upx;
  551. }
  552. }
  553. </style>