myList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. <template>
  2. <view class="myTask">
  3. <view class="tui-tabs">
  4. <scroll-view id="tab-bar" scroll-with-animation class="tui-scroll-h" :scroll-x="true"
  5. :show-scrollbar="false" style="border-bottom: 2upx solid #F8F8F8;">
  6. <view style="display: flex;">
  7. <view v-for="(tab, index) in tabBars" :id="tab.id" :data-current="index" @tap='tabSlect(tab)'>
  8. <view class="tui-tab-item-title"
  9. style="margin-left: 50upx;margin-right: 15upx;background: #FFFFFF;"
  10. :class="{ 'tui-tab-item-title-active': tabIndex == tab.id }">
  11. {{ tab.name }}{{tab.count != 0 ? '('+tab.count+')' : ''}}</view>
  12. </view>
  13. </view>
  14. </scroll-view>
  15. </view>
  16. <!-- #ifdef H5 -->
  17. <view style="margin-top: 100upx;" v-if="newsList.length > 0">
  18. <!-- #endif -->
  19. <!-- #ifndef H5 -->
  20. <view style="margin-top: 20upx;padding-top: 60rpx;" v-if="newsList.length > 0">
  21. <!-- #endif -->
  22. <view
  23. style="border-radius: 20upx;background: #FFFFFF;width: 710upx;height: max-content;margin: 20upx 20upx 20upx 20upx;"
  24. v-for="(item,index) in newsList" :key='index'>
  25. <view style="display: flex;">
  26. <view
  27. style="padding: 20upx 0 0upx 30upx;width: 75%;text-align: left;color: #000;font-size: 28upx;">
  28. {{item.createAt}}</view>
  29. <view
  30. style="padding: 20upx 0 0upx 0upx;width: 20%;text-align: right;color: #05C25C;font-size: 28upx;">
  31. {{item.status}}</view>
  32. </view>
  33. <view style="display: flex;padding: 20upx 10upx;" @tap='goOrderDetail(item.id)'>
  34. <image :src="item.img" style="width: 30%;height: 190upx;margin-left: 20upx;"></image>
  35. <view style="margin-left: 20upx;width: 68%;">
  36. <view
  37. style="font-size: 30upx;color: #333333;width: 90%;height: 80upx;overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 2;">
  38. {{item.title}}</view>
  39. <view style="display: flex;height: 50upx;margin-top: 70upx;">
  40. <view style="display: flex;width: 45%;">
  41. <view
  42. style="font-size: 26upx;color: #333333;padding-bottom:10rpx;text-align: left;">
  43. 实付款: ¥{{item.payMoney}}</view>
  44. </view>
  45. <!-- <view v-if="item.relationList && item.relationList.length > 0"
  46. style="font-size: 26upx;color: #909399;padding-bottom:10rpx;width: 50%;text-align: right;">
  47. 佣金:
  48. ¥{{item.relationList[0].commissionPrice}}</view> -->
  49. </view>
  50. </view>
  51. </view>
  52. <!-- <view v-if="item.relationList && item.relationList.length > 1"
  53. style="margin-left: 35%;font-size: 26upx;color: #909399;">
  54. 直属【{{item.relationList[1].userName}}】佣金:
  55. ¥{{item.relationList[1].commissionPrice}}</view>
  56. <view v-if="item.relationList && item.relationList.length > 2"
  57. style="margin-left: 35%;font-size: 26upx;color: #909399;margin-top: 10rpx;margin-bottom: 20rpx;">
  58. 非直属【{{item.relationList[2].userName}}】佣金:
  59. ¥{{item.relationList[2].commissionPrice}}</view> -->
  60. <view style="height: 1upx;margin-left: 20upx;margin-right: 20upx;background: #E6E6E6;"></view>
  61. <view style="overflow: hidden;">
  62. <view style="display: flex;text-align: center;width: max-content;float: right;">
  63. <view v-if="item.status == '已发货'" class='view_button'
  64. style="color: #05C25C;border: 3upx solid #05C25C;" @tap='goconfirm(item)'>确认收货</view>
  65. <view v-if="item.status == '已退款' || item.status == '已收货' || item.status == '已取消'"
  66. class='view_button' @tap='deleteOder(item.id)'>删除订单</view>
  67. <view v-if="item.status == '待发货'" class='view_button' @tap='goRemind(item)'>提醒发货</view>
  68. <view v-if="item.status == '待付款'" class='view_button' @tap='gocancle(item)'>取消订单</view>
  69. <view v-if="item.status == '待付款'" class='view_button'
  70. style="color: #05C25C;border: 3upx solid #05C25C;" @tap='goPay(item)'>去支付</view>
  71. </view>
  72. </view>
  73. </view>
  74. <!-- 悬浮上拉 -->
  75. <view class="scroll_top" @tap="topScrollTap" v-bind:class="[scrollTop ? 'active' : '', '']"
  76. style="bottom: 56px;"><text class="iconfont icon-shangla"></text></view>
  77. <!-- 加载更多提示 -->
  78. <view class="s-col is-col-24" v-if="newsList.length > 0">
  79. <load-more :loadingType="loadingType" :contentText="contentText"></load-more>
  80. </view>
  81. </view>
  82. <!-- 加载更多提示 -->
  83. <!-- #ifdef H5 -->
  84. <empty v-if="newsList.length === 0" des="暂无数据" show="false"></empty>
  85. <!-- #endif -->
  86. <!-- #ifndef H5 -->
  87. <empty style="margin-top:78upx;" v-if="newsList.length === 0" des="暂无数据" show="false"></empty>
  88. <!-- #endif -->
  89. </view>
  90. </template>
  91. <script>
  92. export default {
  93. data() {
  94. return {
  95. //0全部 1待支付 2已支付 3已完成 4已取消
  96. tabIndex: '0',
  97. tabBars: [{
  98. name: '全部',
  99. count: 0,
  100. id: '0'
  101. },
  102. {
  103. name: '待付款',
  104. count: 0,
  105. id: '1'
  106. },
  107. {
  108. name: '待发货',
  109. count: 0,
  110. id: '2'
  111. },
  112. {
  113. name: '待收货',
  114. count: 0,
  115. id: '3'
  116. },
  117. {
  118. name: '已收货',
  119. count: 0,
  120. id: '4'
  121. },
  122. {
  123. name: '已取消',
  124. count: 0,
  125. id: '5'
  126. },
  127. {
  128. name: '退款中',
  129. count: 0,
  130. id: '6'
  131. },
  132. {
  133. name: '已退款',
  134. count: 0,
  135. id: '7'
  136. }
  137. ],
  138. page: 0,
  139. state: 0,
  140. isExpress: 0,
  141. size: 10,
  142. newsList: [],
  143. loadingType: 0,
  144. type: 1,
  145. scrollTop: false,
  146. contentText: {
  147. contentdown: '上拉显示更多',
  148. contentrefresh: '正在加载...',
  149. contentnomore: '没有更多数据了'
  150. }
  151. }
  152. },
  153. onShow() {
  154. let userId = this.$queue.getData('userId');
  155. if (userId) {
  156. this.getSelectOrderList('', this.tabIndex);
  157. }
  158. },
  159. methods: {
  160. getDingDanCount() {
  161. let userId = this.$queue.getData('userId');
  162. this.$Request.getT('/app/orders/count?userId=' + userId).then(res => {
  163. if (res.status === 0) {
  164. this.tabBars[1].count = res.data.count1;
  165. this.tabBars[2].count = res.data.count2;
  166. this.tabBars[3].count = res.data.count3;
  167. this.tabBars[4].count = res.data.count4;
  168. this.tabBars[5].count = res.data.count5;
  169. this.tabBars[6].count = res.data.count6;
  170. this.tabBars[7].count = res.data.count7;
  171. // this.tabBars[8].count = res.data.count8;
  172. }
  173. });
  174. },
  175. goRemind(item) {
  176. this.$Request.getT('/app/orders/remind?ordersId=' + item.id).then(res => {
  177. if (res.status === 0) {
  178. this.$queue.showToast('已提醒商家及时发货,请注意查收');
  179. } else {
  180. this.$queue.showToast(res.msg);
  181. }
  182. });
  183. },
  184. gocancle(list) {
  185. uni.showModal({
  186. title: '温馨提示',
  187. content: '确定要取消此订单吗?',
  188. showCancel: true,
  189. cancelText: '取消',
  190. confirmText: '确认',
  191. success: res => {
  192. if (res.confirm) {
  193. this.$Request.getT('/app/orders/cancel?id=' + list.id).then(res => {
  194. if (res.status === 0) {
  195. this.getSelectOrderList('', this.tabIndex);
  196. } else {
  197. this.$queue.showToast(res.msg);
  198. }
  199. });
  200. }
  201. }
  202. });
  203. },
  204. goconfirm(list) {
  205. uni.showModal({
  206. title: '温馨提示',
  207. content: '确定收到货物了吗?',
  208. showCancel: true,
  209. cancelText: '取消',
  210. confirmText: '确认',
  211. success: res => {
  212. if (res.confirm) {
  213. this.$Request.getT('/app/orders/confirm?id=' + list.id).then(res => {
  214. if (res.status === 0) {
  215. this.getSelectOrderList('', this.tabIndex);
  216. } else {
  217. this.$queue.showToast(res.msg);
  218. }
  219. });
  220. }
  221. }
  222. });
  223. },
  224. goPay(list) {
  225. this.$queue.setData('href', '/pages/my/myList')
  226. uni.redirectTo({
  227. url: '../my/payment?money=' + list.payMoney + '&title=' + list.title + '&img=' + list.img +
  228. '&id=' + list.id
  229. });
  230. },
  231. goOrderDetail(id) {
  232. uni.navigateTo({
  233. url: '../member/orderdetail?id=' + id
  234. });
  235. },
  236. deleteOder(id) {
  237. uni.showModal({
  238. title: '温馨提示',
  239. content: '确定要删除此订单吗?',
  240. showCancel: true,
  241. cancelText: '取消',
  242. confirmText: '确认',
  243. success: res => {
  244. if (res.confirm) {
  245. this.$Request.getT('/app/orders/delete?id=' + id).then(res => {
  246. if (res.status === 0) {
  247. this.getSelectOrderList('', this.tabIndex);
  248. } else {
  249. this.$queue.showToast(res.msg);
  250. }
  251. });
  252. }
  253. }
  254. });
  255. },
  256. getSelectOrderList(type, status) {
  257. this.getDingDanCount();
  258. this.loadingType = 1;
  259. uni.showLoading({
  260. title: '加载中...'
  261. });
  262. let userId = this.$queue.getData('userId');
  263. this.$Request.getT('/app/orders/findMyList?page=' + this.page + '&size=' + this.size + '&userId=' +
  264. userId + '&status=' +
  265. status).then(res => {
  266. if (res.status === 0) {
  267. if (this.page === 0 || res.status) {
  268. this.newsList = [];
  269. }
  270. res.data.content.forEach(d => {
  271. if (d.status === 1) {
  272. d.status = '待付款'
  273. } else if (d.status === 2) {
  274. d.status = '待发货'
  275. } else if (d.status === 3) {
  276. d.status = '已发货'
  277. } else if (d.status === 4) {
  278. d.status = '已收货'
  279. } else if (d.status === 5) {
  280. d.status = '已取消'
  281. } else if (d.status === 6) {
  282. d.status = '退款中'
  283. } else if (d.status === 7) {
  284. d.status = '已退款'
  285. } else if (d.status === 8) {
  286. d.status = '拒绝退款'
  287. } else if (d.status === 10) {
  288. d.status = '已评价'
  289. }
  290. this.newsList.push(d);
  291. });
  292. if (res.data.content.length === this.size) {
  293. this.loadingType = 0;
  294. } else {
  295. this.loadingType = 3;
  296. }
  297. } else {
  298. this.loadingType = 2;
  299. }
  300. uni.hideLoading();
  301. if (type === 'Refresh') {
  302. uni.stopPullDownRefresh(); // 停止刷新
  303. }
  304. });
  305. },
  306. tabSlect(item) {
  307. this.switchTab(item.id);
  308. },
  309. switchTab(index) {
  310. this.page = 0;
  311. this.tabIndex = index;
  312. this.newsList = [];
  313. this.getSelectOrderList('switch', this.tabIndex);
  314. },
  315. topScrollTap: function() {
  316. uni.pageScrollTo({
  317. scrollTop: 0,
  318. duration: 300
  319. });
  320. }
  321. },
  322. //统一登录跳转
  323. goLoginInfo() {
  324. this.$queue.setData('href', '/pages/zysc/my/myList');
  325. //#ifdef H5
  326. uni.navigateTo({
  327. url: '/pages/public/login'
  328. });
  329. //#endif
  330. //#ifndef H5
  331. uni.navigateTo({
  332. url: '/pages/public/login'
  333. });
  334. //#endif
  335. },
  336. /**
  337. * 统一跳转接口,拦截未登录路由
  338. * navigator标签现在默认没有转场动画,所以用view
  339. */
  340. navTo(url) {
  341. let token = this.$queue.getData('token');
  342. if (token) {
  343. uni.navigateTo({
  344. url
  345. });
  346. } else {
  347. this.goLoginInfo();
  348. }
  349. },
  350. onPageScroll: function(e) {
  351. this.scrollTop = e.scrollTop > 200;
  352. },
  353. onReachBottom: function() {
  354. this.page = this.page + 1;
  355. this.getSelectOrderList('', this.tabIndex);
  356. },
  357. onPullDownRefresh: function() {
  358. this.page = 0;
  359. this.getSelectOrderList('Refresh', this.tabIndex);
  360. }
  361. }
  362. </script>
  363. <style lang="less">
  364. @import '../../../../static/less/index.less';
  365. @import '../../../../static/css/index.css';
  366. page {
  367. background: #F2F2F2;
  368. }
  369. .view_button {
  370. margin: 15upx 20upx 10upx 30upx;
  371. line-height: 55upx;
  372. font-size: 24upx;
  373. color: #333333;
  374. width: 150upx;
  375. height: 55upx;
  376. border-radius: 100upx;
  377. border: 3upx solid #bababa;
  378. }
  379. .tui-tabs {
  380. flex: 1;
  381. flex-direction: column;
  382. overflow: hidden;
  383. background-color: #fafafa;
  384. /* #ifdef MP-ALIPAY || MP-BAIDU */
  385. height: 100vh;
  386. /* #endif */
  387. }
  388. .tui-scroll-h {
  389. width: 750rpx;
  390. height: 80rpx;
  391. background-color: #ffffff;
  392. flex-direction: row;
  393. /* #ifndef APP-PLUS */
  394. white-space: nowrap;
  395. /* #endif */
  396. /* #ifdef APP-PLUS */
  397. position: fixed;
  398. top: 0;
  399. left: 0;
  400. z-index: 999;
  401. /* #endif */
  402. /* #ifdef H5 */
  403. position: fixed;
  404. top: 44px;
  405. left: 0;
  406. z-index: 999;
  407. /* #endif */
  408. /* #ifdef MP-WEIXIN */
  409. position: fixed;
  410. top: 0;
  411. left: 0;
  412. z-index: 999;
  413. /* #endif */
  414. }
  415. .tui-line-h {
  416. /* #ifdef APP-PLUS */
  417. height: 1rpx;
  418. background-color: #cccccc;
  419. /* #endif */
  420. position: relative;
  421. }
  422. /* #ifndef APP-PLUS*/
  423. .tui-line-h::after {
  424. content: '';
  425. position: absolute;
  426. border-bottom: 1rpx solid #cccccc;
  427. -webkit-transform: scaleY(0.5);
  428. transform: scaleY(0.5);
  429. bottom: 0;
  430. right: 0;
  431. left: 0;
  432. }
  433. /* #endif */
  434. .tui-tab-item {
  435. /* #ifndef APP-PLUS */
  436. display: flex;
  437. /* #endif */
  438. }
  439. .tui-tab-item-title {
  440. color: #555;
  441. font-size: 30rpx;
  442. /* #ifdef APP-PLUS */
  443. height: 80rpx;
  444. /* #endif */
  445. /* #ifndef APP-PLUS */
  446. height: 82rpx;
  447. /* #endif */
  448. line-height: 80rpx;
  449. flex-wrap: nowrap;
  450. white-space: nowrap;
  451. }
  452. .tui-tab-item-title-active {
  453. color: #05C25C;
  454. font-size: 32upx;
  455. font-weight: bold;
  456. border-bottom-width: 6upx;
  457. text-align: center;
  458. }
  459. </style>