index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. <template>
  2. <view class="container">
  3. <view class="status-box">
  4. <view class='status_tap_box' style="position: relative;">
  5. <view @tap="statusTap" class="status-label" v-for="(item,index) in statusType" :key="index" :class="item[0] == currentType ? 'active' : ''" :data-index="item[0]">
  6. {{item[1]}} <!-- {{index && (index+1) != statusType.length ? item[2] ? '(' + item[2] + ')' : '(0)' : ''}} -->
  7. </view>
  8. </view>
  9. </view>
  10. <not-goods v-if="haveGoods" textStr="抱歉!暂无相关订单" />
  11. <view class="order-list" v-if="orderList && orderList.length > 0">
  12. <view v-for="(li,index) in orderList" :key="index">
  13. <!-- 未付款 -->
  14. <view class="a-order">
  15. <view class='overflow' :data-id="li.id">
  16. <view class="list-title flex_r flex_ac flex_jb ellipsis">
  17. <view class="flex_r flex_ac">
  18. <view class="imgs_bar avaImgs">
  19. <image class="image" :src="pt.platFormLogo" mode="widthFix" />
  20. </view>{{pt.platFormName}}
  21. </view>
  22. <view class="fz_text r_color" v-if="li.data.assembleType != 1 && li.data.assembleStatus == 1">正在拼团中</view>
  23. <view class="fz_text" v-else>{{li.data.statusMsg}}</view>
  24. </view>
  25. <view class="goods-info flex_r flex_ac flex_jb" :data-type="li.type" :data-id="li.data.orderDetailId" @tap="toDetails(li)">
  26. <view class="goods-info-bar overflow flex_r flex_ac">
  27. <block v-if="li.type == 1 || li.data.orderTypes == 4">
  28. <view class="imgs_bar img-box">
  29. <image :src="li.data.image" mode='' class="goods-img"></image>
  30. </view>
  31. <view class='goods_name ellipsis2'>{{li.data.goodsName || ''}}</view>
  32. </block>
  33. <block v-else>
  34. <scroll-view class="goods-img-container" scroll-x="true">
  35. <view class="imgs_bar img-box" v-for="(item,ind) in li.data.imgs" :key="ind">
  36. <image :src="item" mode='' class="goods-img"></image>
  37. </view>
  38. </scroll-view>
  39. </block>
  40. </view>
  41. <view class='goodsDetail_info'>
  42. <view class='goods_price r_color' v-if="li.data.orderTypes!=5">¥<text class="r_color">{{li.data.totalPrice}}</text></view>
  43. <view class='goods_price r_color' v-if="li.data.orderTypes==5"><text class="r_color">{{li.data.integral}}</text>积分</view>
  44. <view class='unimport'>共{{li.data.buyCount}}件</view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="price-box flex_r flex_ac">
  49. <view class="ptz" v-if="li.data.orderTypes == 7">
  50. 拼团金:{{li.data.totalAccountSpell}}
  51. </view>
  52. <view class="btn cancel-btn" :data-type="li.type" :data-types="li.data.orderTypes" :data-id="li.data.orderDetailId" @tap="toCancel" v-if="li.data.status == 2">取消订单</view>
  53. <view class="btn topay-btn" :data-id="li.data.orderDetailId" :data-index="index" :data-ojsType="li.data.ojsType" @tap="toPay" v-if="li.data.status == 2">立即支付</view>
  54. <block v-else>
  55. <block v-if="(li.data.status == 4 || li.data.status == 5) && li.returnType == 1 && li.data.orderTypes!=2">
  56. <view class="btn" :data-orderno="li.data.orderNo" v-if="li.data.assembleStatus==2">拼团成功</view>
  57. <view
  58. v-if="li.refundId"
  59. class="btn"
  60. :class="li&&li.refundId ? 'topay-btn':'cancel-btn'"
  61. :data-type="li.type"
  62. :data-id="li.data.orderDetailId"
  63. :data-reid="li.refundId"
  64. @tap="toRefundDetails(li)"
  65. >
  66. 退款中
  67. </view>
  68. <view
  69. v-else
  70. class="btn"
  71. :class="li&&li.refundId ? 'topay-btn':'cancel-btn'"
  72. :data-type="li.type"
  73. :data-id="li.data.orderDetailId"
  74. :data-reid="li.refundId"
  75. @tap="toRefund(li)"
  76. >
  77. 退货/退款
  78. </view>
  79. </block>
  80. <view class="btn cancel-btn" v-if="li.data.status != 2" :data-type="li.type" :ata-id="li.data.orderDetailId" @tap="toDetail(li)">查看订单</view>
  81. <view class="btn topay-btn" :data-id="li.data.orderDetailId" :data-status="li.data.status" :data-type="li.type" @tap="toTake" v-if="li.data.status == 4 || li.data.status == 3">确认收货</view>
  82. <view class="btn topay-btn" :data-type="li.type" :data-id="li.data.orderDetailId" :data-no="li.data.orderNo" @tap="toCommen" v-if="li.comType && li.comType == 1">去评价</view>
  83. </block>
  84. </view>
  85. </view>
  86. <!-- 未付款 end -->
  87. </view>
  88. </view>
  89. <view class="loading-indicator" :class="loadingMoreHidden ? 'opacity' : ''">{{loadingTip}}</view>
  90. </view>
  91. </template>
  92. <script>
  93. var reqApi = new ReqApi();
  94. var toPayOpre = new ToPayOpre();
  95. var app = getApp();
  96. var appEv = app.$vm.$options;
  97. var page = 1;
  98. import notGoods from '@/components/not-goods/index'
  99. // import terraceTagbar from '@/components/terrace-tagbar/index'
  100. // import { ReqApi, ToPayOpre } from "../../utils/reqTools.js";
  101. export default {
  102. components:{
  103. notGoods,
  104. // terraceTagbar
  105. },
  106. data() {
  107. return {
  108. statusType: [
  109. ["1", "全部"],
  110. ["2", "待付款"],
  111. ["3", "待发货"],
  112. ["4", "待收货"],
  113. ["5", "已收货"]
  114. ],
  115. orderList: [],
  116. currentType: "1",
  117. haveGoods: false,
  118. loadingMoreHidden: true,
  119. loadingTip: '没有更多了',
  120. userId:"",
  121. isweixin:'',
  122. pt:{}
  123. };
  124. },
  125. onLoad: function (options) {
  126. var that = this;
  127. this.currentType=options.status ? options.status : 1
  128. },
  129. onShow:function(){
  130. let that=this
  131. const userId = app.globalData.systemUserInfo && app.globalData.systemUserInfo.userId ? app.globalData.systemUserInfo.userId : '';
  132. if (!userId || userId == '' || userId==undefined) {
  133. // that.showAuth=true
  134. appEv.authorizeUserInfo(res=>{
  135. if(res){
  136. that.clearData()
  137. that.loadData()
  138. }
  139. },true)
  140. }else{
  141. that.clearData()
  142. that.loadData()
  143. }
  144. },
  145. methods:{
  146. returnBtn:function(){
  147. uni.navigateBack({})
  148. },
  149. clearData(isclearCat = true, callBack){
  150. page = 1;
  151. this.orderList=[]
  152. this.haveGoods=false
  153. if (callBack){
  154. callBack();
  155. }
  156. },
  157. loadData: function() {
  158. if (page == -1){
  159. return;
  160. }
  161. uni.showLoading({
  162. title: '加载中…',
  163. mask: true
  164. });
  165. var data = {
  166. page,
  167. status: this.currentType == 1 ? '' : this.currentType
  168. };
  169. var orderList = reqApi.pendingPayment(data);
  170. var that = this;
  171. if (orderList) {
  172. orderList.then(res => {
  173. setTimeout(() => {
  174. uni.hideLoading();
  175. }, 100)
  176. uni.stopPullDownRefresh();
  177. var resData = res.data.mallGoods;
  178. if (resData && resData.length <= 0) {
  179. if (page <= 1) {
  180. that.haveGoods=true
  181. that.loadingMoreHidden=true
  182. } else {
  183. that.loadingMoreHidden=false
  184. }
  185. }
  186. if (res.data.status == 200) {
  187. var obj = res.data.data;
  188. // that.arrangeData(obj);
  189. if (resData && resData.length > 0) {
  190. var orderList = that.orderList;
  191. var list = orderList.concat(resData);
  192. that.pt=res.data.platform
  193. that.orderList=list
  194. that.haveGoods=false
  195. that.loadingMoreHidden=true
  196. }
  197. } else {
  198. appEv.errTips(res.data.msg || '');
  199. if (res.data.status == 999) {
  200. // that.arrangeData(res.data.data);
  201. page = -1;
  202. that.loadingMoreHidden=false
  203. }
  204. }
  205. })
  206. }
  207. },
  208. toDetails(data){
  209. if(data.data.orderTypes == 4){
  210. uni.navigateTo({
  211. url: '/pages/szw-order-details/index?id=' + data.data.orderDetailId + '&type=1',
  212. })
  213. }else{
  214. uni.navigateTo({
  215. url: '/pages/szw-order-details/index?id=' + data.data.orderDetailId + '&type=' + data.type,
  216. })
  217. }
  218. },
  219. toDetail:function(data){
  220. if(data.data.orderTypes == 4){
  221. uni.navigateTo({
  222. url: '/pages/szw-order-details/index?id=' + data.data.orderDetailId + '&type=1',
  223. })
  224. }else{
  225. uni.navigateTo({
  226. url: '/pages/szw-order-details/index?id=' + data.data.orderDetailId + '&type=' + data.type,
  227. })
  228. }
  229. },
  230. toRefund(data){
  231. uni.navigateTo({
  232. url: '/pages/order-refund/index?id=' + data.data.orderDetailId + '&type=' + data.type,
  233. })
  234. },
  235. toRefundDetails(data){
  236. uni.navigateTo({
  237. url: '/pages/order-refund-details/index?id=' + data.refundId,
  238. })
  239. },
  240. // 立即支付
  241. toPay(e){
  242. var orderDetailIds = e.currentTarget.dataset.id;
  243. var index = e.currentTarget.dataset.index;
  244. var price = this.orderList[index].data.totalPrice;
  245. var type = this.orderList[index].data.patType;
  246. var teaIntegral = this.orderList[index].data.totalTeaInt;
  247. var pfIntegral = this.orderList[index].data.totalPfInt;
  248. var xfIntegral = this.orderList[index].data.totalXfInt;
  249. var totalAccount = this.orderList[index].data.totalAccount;
  250. var orderNo = this.orderList[index].data.orderNo;
  251. let data = {
  252. orderDetailIds:orderDetailIds,
  253. types:1,
  254. price:price,
  255. account:totalAccount,
  256. teaIntegral:teaIntegral,
  257. pfIntegral:pfIntegral,
  258. xfIntegral:xfIntegral,
  259. zfType:type,
  260. ojsType:e.currentTarget.dataset.ojstype
  261. }
  262. var info
  263. info = reqApi.payOrder(data);
  264. var that = this;
  265. if (info) {
  266. info.then(res => {
  267. if (res.data.status == 200) {
  268. toPayOpre.toPay(res.data.payParam);
  269. } else {
  270. appEv.errTips(res.data.msg || '支付失败');
  271. }
  272. });
  273. }
  274. },
  275. // 取消订单
  276. toCancel(e){
  277. var isTuan = e.currentTarget.dataset.tuan;
  278. if (isTuan){
  279. uni.showModal({
  280. title: '温馨提示',
  281. content: '发起拼单24小时后,若未拼单成功将自动取消订单并退款哦~',
  282. showCancel: false,
  283. confirmText: "知道了",
  284. confirmColor: "#f02f2f"
  285. })
  286. }else{
  287. var orderDetailId = e.currentTarget.dataset.id, type = e.currentTarget.dataset.type;
  288. let types =e.currentTarget.dataset.types;
  289. console.log(types)
  290. if(types == 4){
  291. type = 1;
  292. }
  293. const info = reqApi.cancelOrder({ orderDetailId, type });
  294. var that = this;
  295. if (info) {
  296. info.then(res => {
  297. if (res.data.status == 200) {
  298. uni.showToast({
  299. title: res.data.msg || '订单已取消',
  300. duration: 1200,
  301. mask: true
  302. })
  303. setTimeout(function () {
  304. that.clearData(false, () => {
  305. that.loadData();
  306. });
  307. }, 1200);
  308. } else {
  309. appEv.errTips(res.data.msg || '取消失败');
  310. }
  311. });
  312. }
  313. }
  314. },
  315. // 确认收货
  316. toTake(e){
  317. let type = e.currentTarget.dataset.type;
  318. var that = this;
  319. uni.showModal({
  320. content: '亲,“确定收货”代表着本订单的交付流程已经完成,不再支持任何形式的退换货。',
  321. confirmText: "确认收货",
  322. confirmColor: "#fa2f2e",
  323. cancelText: "取消",
  324. cancelColor: "#bbb",
  325. success(res) {
  326. if (res.confirm) {
  327. var orderDetailId = e.currentTarget.dataset.id
  328. const info = reqApi.takeOrder({ orderDetailId:orderDetailId, type:type });
  329. if (info) {
  330. info.then(res => {
  331. if (res.data.status == 200) {
  332. appEv.errTips(res.data.msg);
  333. setTimeout(function () {
  334. that.clearData(false, () => {
  335. that.loadData();
  336. });
  337. }, 1200);
  338. } else {
  339. appEv.errTips(res.data.msg || '收货失败');
  340. }
  341. });
  342. }
  343. } else if (res.cancel) {
  344. // console.log('用户点击取消');
  345. }
  346. }
  347. })
  348. },
  349. // 整理数据
  350. arrangeData(data = appEv.parameter("data")){
  351. var statusType = this.data.statusType;
  352. statusType[0][2] = data.wholeCount;
  353. statusType[1][2] = data.AlreadyPaymentCount;
  354. statusType[2][2] = data.AlreadyCompleteCount;
  355. statusType[3][2] = data.AlreadySettlementCount;
  356. this.statusType=statusType
  357. },
  358. //菜单切换
  359. statusTap: function(e) {
  360. //重置数据
  361. var curType = e.currentTarget.dataset.index;
  362. this.currentType=curType
  363. this.clearData(false, this.loadData);
  364. },
  365. // 跳转拼团分享页面
  366. toTuanShare(e){
  367. uni.navigateTo({
  368. url: '/pages/tuan-share-info/index?orderNo=' + e.currentTarget.dataset.orderno
  369. })
  370. },
  371. // 加评价
  372. toCommen(e) {
  373. let id = e.currentTarget.dataset.id
  374. let no = e.currentTarget.dataset.no
  375. let orderType = e.currentTarget.dataset.type
  376. uni.navigateTo({
  377. url: '/pages/add-goods-commen/index?orderId=' + id + '&orderNo=' + no + '&orderType=' + orderType
  378. })
  379. },
  380. pageBack:function(){
  381. uni.reLaunch({
  382. url: '/pages/my/index'
  383. });
  384. }
  385. },
  386. //上拉加载事件
  387. onReachBottom: function () {
  388. if (page != -1) {
  389. var that = this;
  390. setTimeout(function () {
  391. // 为页数迭加1
  392. ++page;
  393. that.loadData();
  394. }, 800);
  395. }
  396. },
  397. // 下拉刷新
  398. onPullDownRefresh: function () {
  399. var that = this;
  400. that.clearData(false, () => {
  401. that.loadData();
  402. });
  403. }
  404. }
  405. </script>
  406. <style lang="scss">
  407. page{
  408. background-color: #f3f5f7;
  409. }
  410. .container {
  411. width: 100%;
  412. }
  413. .fl{
  414. float: left;
  415. }
  416. .fr{
  417. float: right;
  418. }
  419. .overflow{
  420. overflow: hidden;
  421. }
  422. .r_color{
  423. color: #fa2f2e;
  424. }
  425. .loading-indicator{
  426. width: 100%;
  427. text-align: center;
  428. font-size: 24rpx;
  429. color: #666;
  430. margin: 20rpx 0;
  431. line-height: 1.5;
  432. }
  433. .opacity{
  434. opacity: 0;
  435. display: none;
  436. }
  437. .terraceComp{
  438. height: 84rpx;
  439. }
  440. .terraceComp_fix{
  441. position: fixed;
  442. top: -12rpx;
  443. left: 0;
  444. right: 0;
  445. z-index: 15;
  446. }
  447. .status-box {
  448. width: 100%;
  449. height: 94rpx;
  450. }
  451. .status_tap_box{
  452. position: fixed;
  453. left: 0;
  454. top: 0;
  455. width: 100%;
  456. overflow: hidden;
  457. line-height: 88rpx;
  458. display: flex;
  459. justify-content: space-between;
  460. align-items: center;
  461. background-color: #fff;
  462. z-index: 300;
  463. box-shadow: 0rpx 8rpx 8rpx rgba(0,0,0,0.025);
  464. }
  465. .status-box .status-label {
  466. flex-grow: 1;
  467. height: 100%;
  468. text-align: center;
  469. font-size: 28rpx;
  470. color: #353535;
  471. box-sizing: border-box;
  472. position: relative;
  473. border-bottom: 6rpx solid transparent;
  474. }
  475. .status-box .status-label.active {
  476. color: #E05F0B;
  477. border-bottom-color: #E05F0B;
  478. }
  479. .order-list {
  480. width: 100%;
  481. overflow: hidden;
  482. }
  483. .order-list .a-order {
  484. width: 100%;
  485. background-color: #fff;
  486. margin-top: 24rpx;
  487. }
  488. .order-list .a-order .order-date {
  489. padding: 16rpx 30rpx 20rpx;
  490. line-height: 40rpx;
  491. font-size: 26rpx;
  492. color: #000;
  493. overflow: hidden;
  494. }
  495. .order-list .a-order .order-date .red {
  496. font-size: 26rpx;
  497. color: #fa2f2e;
  498. }
  499. .order-list .a-order .order-date text.r_color{
  500. font-weight: 600;
  501. }
  502. .a-order .goods-info{
  503. width: 100%;
  504. overflow: hidden;
  505. }
  506. .a-order .list-title {
  507. font-size: 28rpx;
  508. font-weight: 600;
  509. color: #000;
  510. padding: 16rpx 24rpx;
  511. }
  512. .avaImgs{
  513. width: 54rpx;
  514. height: 54rpx;
  515. overflow: hidden;
  516. border-radius: 50%;
  517. background-color: #f3f5f7;
  518. margin-right: 20rpx;
  519. }
  520. .goods-info{
  521. width: 100%;
  522. line-height: 39rpx;
  523. font-size: 26rpx;
  524. color: #000;
  525. overflow: hidden;
  526. padding: 30rpx;
  527. background-color: #f3f5f7;
  528. box-sizing: border-box;
  529. }
  530. .goods-info-bar{
  531. width: calc(100% - 190rpx);
  532. }
  533. .goods-info .img-box {
  534. width: 172rpx;
  535. height: 120rpx;
  536. overflow: hidden;
  537. background-color: #fff;
  538. border-radius: 12rpx;
  539. margin-right: 20rpx;
  540. }
  541. .goods-info .img-box .goods-img {
  542. width: 100%;
  543. display: block;
  544. height: 100%;
  545. }
  546. .goods-img-container {
  547. overflow: hidden;
  548. box-sizing: border-box;
  549. width: 100%;
  550. height: 172rpx;
  551. white-space: nowrap;
  552. }
  553. .goods-img-container .img-box{
  554. display: inline-block;
  555. }
  556. .goods-img-container .img-box:last-of-type{
  557. margin-right: 0;
  558. }
  559. .goods-info .goods_name{
  560. width: calc(100% - 192rpx);
  561. font-size: 28rpx;
  562. font-weight: 500;
  563. color: #121212;
  564. }
  565. .goodsDetail_info{
  566. overflow: hidden;
  567. width: 180rpx;
  568. line-height: 1.5;
  569. text-align: right;
  570. }
  571. .goodsDetail_info .unimport{
  572. font-size: 24rpx;
  573. color: #999;
  574. }
  575. .goodsDetail_info .goods_price{
  576. font-size: 26rpx;
  577. line-height: 1.2;
  578. font-weight:600;
  579. margin-bottom: 10rpx;
  580. }
  581. .goodsDetail_info .goods_price text{
  582. font-size: 36rpx;
  583. }
  584. .order-list .a-order .price-box {
  585. position: relative;
  586. width: 100%;
  587. box-sizing: border-box;
  588. padding: 16rpx 30rpx;
  589. display: flex;
  590. justify-content: flex-end;
  591. font-size: 26rpx;
  592. }
  593. .a-order .price-box .btn {
  594. box-sizing: border-box;
  595. text-align: center;
  596. border-radius: 40rpx;
  597. margin-left: 20rpx;
  598. border: 1rpx solid #ccc;
  599. padding: 12rpx 24rpx;
  600. }
  601. .order-list .a-order .price-box .total-price {
  602. color: #E05F0B;
  603. }
  604. .a-order .price-box .topay-btn {
  605. border-color: #E05F0B;
  606. color: #E05F0B;
  607. }
  608. .a-order .price-box .r_topay-btn {
  609. border-color: #E05F0B;
  610. background-color: #E05F0B;
  611. color: #fff;
  612. }
  613. //拼团金
  614. .flot_left{
  615. // float: left;
  616. margin-left:auto;
  617. }
  618. .ptz{
  619. color: #18BB88;font-size: 30rpx;
  620. position: absolute;
  621. left: 30rpx;
  622. }
  623. </style>