myPayList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. <template>
  2. <view>
  3. <view>
  4. <u-navbar :back-text="i18n('Back')" :back-text-style="backStyle" back-icon-color="#fff" title-color="#fff"
  5. :background="background" title-width="300" :title="i18n('myPayListDetail')"></u-navbar>
  6. </view>
  7. <view class="ui-title">
  8. <view class="u-demo-area" v-if="$i18n.locale=='zh'">
  9. <u-tabs bg-color="#fafafa" :bold="bold" :active-color="activeColor" :list="list" @change="change"
  10. :current="current" :is-scroll="isScroll" :offset="offset" :bar-width='90'></u-tabs>
  11. </view>
  12. <view class="u-demo-area" v-if="$i18n.locale=='en'">
  13. <u-tabs bg-color="#fafafa" :bold="bold" :active-color="activeColor" :list="list1" @change="change"
  14. :current="current" :is-scroll="isScroll" :offset="offset" :bar-width='180'></u-tabs>
  15. </view>
  16. <!-- <uni-section>
  17. <view class="ui-btn" v-if="$i18n.locale=='zh'">
  18. <uni-segmented-control :current="current" :values="items" :style-type="styleType"
  19. :active-color="activeColor" @clickItem="onClickItem" class="ui-pay-btn" />
  20. </view>
  21. <view class="ui-btn-en" v-if="$i18n.locale=='en'">
  22. <uni-segmented-control :current="current" :values="itemsList" :style-type="styleType"
  23. :active-color="activeColor" @clickItem="onClickItem" />
  24. </view>
  25. </uni-section> -->
  26. <view class="content">
  27. <view v-if="current === 0" class="content-text">
  28. <view class="user-list" v-for="(orderList,index) in orderInfo" :key='index'
  29. @tap="toOrderDetail(orderList.id)">
  30. <view class="content-time">
  31. <view class="time-day">{{orderList.createDate|time('YYYY-MM-DD HH:mm:ss')}}</view>
  32. </view>
  33. <view class="list-info">
  34. <view class="list-pic">
  35. <image :src="websiteUrl + orderList.picture" class='pic-right'></image>
  36. </view>
  37. <view class="list-detail">
  38. <view class="list-title" v-if="$i18n.locale=='zh'">{{orderList.commodityName}}</view>
  39. <view class="list-title" v-if="$i18n.locale=='en'">{{orderList.commodityNameEn}}</view>
  40. <view class="list-time">
  41. {{$i18n.locale=='zh'?'有效期至' :'Date of expiry'}}:{{orderList.createDate|time('YYYY-MM-DD')}}
  42. </view>
  43. <view class="list-order">
  44. <view class="list-pay">
  45. {{orderList.point}}{{$i18n.locale=='zh'?'积分' :'intetral'}}
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <uni-load-more :status="status" :contentText="contentText" v-show="this.total>10"></uni-load-more>
  52. </view>
  53. <view v-if="current === 1" class="content-text">
  54. <view class="user-list" v-for="(shopList,index) in orderInfo" :key='index'
  55. @tap="toOrderDetail(shopList.id)">
  56. <view v-if="shopList.orderStatus==0">
  57. <view class="content-time">
  58. <view class="time-day">{{shopList.createDate|time('YYYY-MM-DD HH:mm:ss')}}</view>
  59. </view>
  60. <view class="list-info">
  61. <view class="list-pic">
  62. <image :src="websiteUrl + shopList.picture" class='pic-right'></image>
  63. </view>
  64. <view class="list-detail">
  65. <view class="list-title">{{shopList.commodityName}}</view>
  66. <view class="list-time">
  67. {{$i18n.locale=='zh'?'有效期至' :'Date of expiry'}}:{{shopList.createDate|time('YYYY-MM-DD')}}
  68. </view>
  69. <view class="list-order">
  70. <view class="list-pay">
  71. {{shopList.point}}{{$i18n.locale=='zh'?'积分' :'intetral'}}
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. <uni-load-more :status="status" :contentText="contentText" v-show="this.total>10"></uni-load-more>
  79. </view>
  80. <view v-if="current === 2" class="content-text">
  81. <view class="user-list" v-for="(getList,index) in orderInfo" :key='index'
  82. @tap="toOrderDetail(getList.id)">
  83. <view v-show="getList.orderStatus==1">
  84. <view class="content-time">
  85. <view class="time-day">{{getList.createDate|time('YYYY-MM-DD')}}</view>
  86. </view>
  87. <view class="list-info">
  88. <view class="list-pic">
  89. <image :src="websiteUrl + getList.picture" class='pic-right'></image>
  90. </view>
  91. <view class="list-detail">
  92. <view class="list-title">{{getList.commodityName}}</view>
  93. <view class="list-time">
  94. {{$i18n.locale=='zh'?'有效期至' :'Date of expiry'}}:{{getList.createDate|time('YYYY-MM-DD')}}
  95. </view>
  96. <view class="list-order">
  97. <view class="list-pay">
  98. {{getList.point}}{{$i18n.locale=='zh'?'积分' :'intetral'}}
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. <uni-load-more :status="status" :contentText="contentText" v-show="this.total>10"></uni-load-more>
  106. </view>
  107. <view v-if="current === 3" class="content-text">
  108. <view class="user-list" v-for="(speakList,index) in orderInfo" :key='index'
  109. @tap="toOrderDetail(speakList.id)">
  110. <view v-show="speakList.orderStatus==2">
  111. <view class="content-time">
  112. <view class="time-day">{{speakList.createDate|time('YYYY-MM-DD ')}}</view>
  113. </view>
  114. <view class="list-info">
  115. <view class="list-pic">
  116. <image :src="websiteUrl + speakList.picture" class='pic-right'></image>
  117. </view>
  118. <view class="list-detail">
  119. <view class="list-title">{{speakList.commodityName}}</view>
  120. <view class="list-time">
  121. {{$i18n.locale=='zh'?'有效期至' :'Date of expiry'}}:{{speakList.createDate|time('YYYY-MM-DD')}}
  122. </view>
  123. <view class="list-order">
  124. <view class="list-pay">
  125. {{speakList.point}}{{$i18n.locale=='zh'?'积分' :'intetral'}}
  126. </view>
  127. </view>
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. <uni-load-more :status="status" :contentText="contentText" v-show="this.total>10"></uni-load-more>
  133. </view>
  134. <view v-if="current === 4" class="content-text">
  135. <view class="user-list" v-for="(outList,index) in orderInfo" :key='index'
  136. @tap="toOrderDetail(outList.id)">
  137. <view v-show="outList.orderStatus==3">
  138. <view class="content-time">
  139. <view class="time-day">{{outList.createDate|time('YYYY-MM-DD HH:mm:ss')}}</view>
  140. </view>
  141. <view class="list-info">
  142. <view class="list-pic">
  143. <image :src="websiteUrl + outList.picture" class='pic-right'></image>
  144. </view>
  145. <view class="list-detail">
  146. <view class="list-title">{{outList.commodityName}}</view>
  147. <view class="list-time">
  148. {{$i18n.locale=='zh'?'有效期至' :'Date of expiry'}}:{{outList.createDate|time('YYYY-MM-DD')}}
  149. </view>
  150. <view class="list-order">
  151. <view class="list-pay">
  152. {{outList.point}}{{$i18n.locale=='zh'?'积分' :'intetral'}}
  153. </view>
  154. </view>
  155. </view>
  156. </view>
  157. </view>
  158. </view>
  159. <uni-load-more :status="status" :contentText="contentText" v-show="this.total>10"></uni-load-more>
  160. </view>
  161. <view v-if="current === 5" class="content-text">
  162. <view class="user-list" v-for="(overList,index) in orderInfo" :key='index'
  163. @tap="toOrderDetail(overList.id)">
  164. <view v-show="overList.orderStatus==4">
  165. <view class="content-time">
  166. <view class="time-day">{{overList.createDate|time('YYYY-MM-DD')}}</view>
  167. </view>
  168. <view class="list-info">
  169. <view class="list-pic">
  170. <image :src="websiteUrl + overList.picture" class='pic-right'></image>
  171. </view>
  172. <view class="list-detail">
  173. <view class="list-title">{{overList.commodityName}}</view>
  174. <view class="list-time">
  175. {{$i18n.locale=='zh'?'有效期至' :'Date of expiry'}}:{{moment(overList.createDate).format('YYYY-MM-DD')}}
  176. </view>
  177. <view class="list-order">
  178. <view class="list-pay">
  179. {{overList.point}}{{$i18n.locale=='zh'?'积分' :'intetral'}}
  180. </view>
  181. </view>
  182. </view>
  183. </view>
  184. </view>
  185. </view>
  186. <uni-load-more :status="status" :contentText="contentText" v-show="this.total>10"></uni-load-more>
  187. </view>
  188. </view>
  189. </view>
  190. </view>
  191. </template>
  192. <script>
  193. import moment from 'moment'
  194. export default {
  195. components: {
  196. moment
  197. },
  198. data() {
  199. return {
  200. list1: [],
  201. data1: [{
  202. name: 'All the Orders',
  203. }, {
  204. name: 'Wait Deliver',
  205. }, {
  206. name: 'To Be Received'
  207. }, {
  208. name: 'To Be Commented'
  209. }, {
  210. name: 'Cancelled'
  211. }, {
  212. name: 'Completed'
  213. }, ],
  214. list: [],
  215. data: [{
  216. name: '全部',
  217. }, {
  218. name: '待发货',
  219. }, {
  220. name: '待收货'
  221. }, {
  222. name: '待评价'
  223. }, {
  224. name: '已取消'
  225. }, {
  226. name: '已完成'
  227. }, ],
  228. current: 0,
  229. sectionCurrent: 0,
  230. isScroll: true,
  231. tabCountIndex: 0,
  232. bold: true,
  233. control: true,
  234. offset: [5, -5],
  235. background: {
  236. backgroundImage: 'linear-gradient(270deg, #4BC0E2 0%, #538BE7 100%)',
  237. },
  238. backStyle: {
  239. color: '#FFFFFF',
  240. },
  241. items: ['全部', '待发货', '待收货', '待评价', '已取消', '已完成 '],
  242. itemsList: [' All the Orders', 'Wait Deliver', 'To Be Received', 'To Be Comment', 'Has Cancelled',
  243. 'Has Completed'
  244. ],
  245. styles: [{
  246. value: 'button',
  247. text: '按钮',
  248. checked: true
  249. },
  250. {
  251. value: 'text',
  252. text: '文字'
  253. }
  254. ],
  255. colors: ['#007aff', '#4cd964', '#dd524d'],
  256. activeColor: '#007aff',
  257. styleType: 'button',
  258. orderInfo: {},
  259. pageSize: "10",
  260. pageNo: "1",
  261. total: null,
  262. status: 'more',
  263. contentText: {
  264. contentdown: '查看更多',
  265. contentrefresh: '加载中...',
  266. contentnomore: '没有更多'
  267. }
  268. }
  269. },
  270. onShow() {
  271. this.findBasicInfo();
  272. if (this.$i18n.locale == 'en') {
  273. this.contentText = {
  274. contentdown: 'See more',
  275. contentrefresh: 'Loading...',
  276. contentnomore: 'No more'
  277. }
  278. }
  279. },
  280. onLoad() {
  281. this.list = this.data;
  282. this.list1 = this.data1;
  283. },
  284. filters: {
  285. twoDecimal(value) {
  286. return parseFloat(string(value)).toFixed(2);
  287. },
  288. time(data, type) {
  289. return moment(data).format(type);
  290. }
  291. },
  292. onReachBottom() {
  293. let allTotal = this.pageNo * this.pageSize
  294. if (allTotal < this.total) {
  295. console.log(this.total);
  296. //当前条数小于总条数 则增加请求页数
  297. this.status = 'loading';
  298. if (this.$i18n.locale == 'en') {
  299. this.contentText = {
  300. contentdown: 'See more',
  301. contentrefresh: 'Loading...',
  302. contentnomore: 'No more'
  303. }
  304. }
  305. this.pageSize++;
  306. this.getOrderList() //调用加载数据方法
  307. } else {
  308. this.status = 'noMore';
  309. if (this.$i18n.locale == 'en') {
  310. this.contentText = {
  311. contentdown: 'See more',
  312. contentrefresh: 'Loading...',
  313. contentnomore: 'No more'
  314. }
  315. }
  316. // console.log('已加载全部数据')
  317. }
  318. },
  319. onPullDownRefresh() {
  320. //调用获取数据方法
  321. this.getOrderList()
  322. setTimeout(() => {
  323. uni.stopPullDownRefresh();
  324. }, 1000);
  325. },
  326. methods: {
  327. change(index) {
  328. this.current = index;
  329. },
  330. onClickItem(e) {
  331. if (this.current !== e.currentIndex) {
  332. this.current = e.currentIndex
  333. }
  334. this.getOrderList()
  335. },
  336. i18n(data) {
  337. return this.$t('common.' + data);
  338. },
  339. toOrderDetail(id) {
  340. uni.navigateTo({
  341. url: './orderListDetail?id=' + id
  342. })
  343. },
  344. async findBasicInfo() {
  345. const result = await this.$myRequest({
  346. url: '/uc/userCenter/findBasicInfo',
  347. data: {},
  348. });
  349. this.form = result.data;
  350. this.getOrderList()
  351. },
  352. async getOrderList() {
  353. const res = await this.$myRequest({
  354. url: '/uc/umsPointCommodityOrders/getMyOrderPage',
  355. data: {
  356. "pageSize": this.pageSize,
  357. "pageNo": this.pageNo,
  358. "userId": this.form.id,
  359. }
  360. });
  361. this.orderInfo = res.data.umsPointCommodityOrders
  362. this.total = res.data.page.totalCount
  363. }
  364. }
  365. }
  366. </script>
  367. <style lang="scss" scoped>
  368. .ui-btn {
  369. width: 100%;
  370. .ui-pay-btn {
  371. width: 100%;
  372. background-color: #FFF;
  373. }
  374. }
  375. .ui-btn-en {
  376. width: 100%;
  377. .ui-pay-btn {
  378. width: 100%;
  379. }
  380. /deep/ .segmented-control__text[data-v-064e9cd1] {
  381. width: 57px;
  382. height: 40px;
  383. line-height: 20px;
  384. font-size: 11px;
  385. white-space: break-word;
  386. text-align: center;
  387. }
  388. /deep/.segmented-control__item--button[data-v-064e9cd1] {
  389. border-style: solid;
  390. border-top-width: 1px;
  391. width: 57px !important;
  392. border-bottom-width: 1px;
  393. border-right-width: 1px;
  394. border-left-width: 0;
  395. }
  396. }
  397. .user-list {
  398. width: 94%;
  399. margin-left: 3%;
  400. margin-top: 20rpx;
  401. border-radius: 40rpx;
  402. background-color: #fff;
  403. .content-time {
  404. display: flex;
  405. width: 94%;
  406. height: 60rpx;
  407. margin-left: 3%;
  408. .time-day {
  409. width: 50%;
  410. height: 60rpx;
  411. line-height: 60rpx;
  412. font-size: 26rpx;
  413. font-weight: 700;
  414. color: #00000080;
  415. }
  416. }
  417. .list-info {
  418. display: flex;
  419. justify-content: space-around;
  420. width: 94%;
  421. margin-left: 3%;
  422. .list-pic {
  423. width: 35%;
  424. height: 280rpx;
  425. .pic-right {
  426. width: 90%;
  427. height: 250rpx;
  428. margin-left: 5%;
  429. }
  430. }
  431. .list-detail {
  432. width: 62%;
  433. .list-title {
  434. font-size: 28rpx;
  435. margin-left: 10rpx;
  436. font-weight: 700;
  437. height: 50rpx;
  438. line-height: 50rpx;
  439. }
  440. .list-time {
  441. font-size: 24rpx;
  442. margin-left: 10rpx;
  443. height: 50rpx;
  444. line-height: 50rpx;
  445. color: #00000080;
  446. }
  447. .list-order {
  448. // display: flex;
  449. // justify-content: space-around;
  450. margin-top: 60rpx;
  451. .list-pay {
  452. font-size: 32rpx;
  453. color: red;
  454. margin-left: 10rpx;
  455. font-weight: 700;
  456. letter-spacing: 3rpx;
  457. }
  458. }
  459. }
  460. }
  461. }
  462. </style>