时空网前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

184 lines
6.1 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <template>
  2. <view>
  3. <mescroll-uni ref="mescrollRef" @init="mescrollInit" height="100%" top="0" :down="downOption" @down="downCallback"
  4. :up="upOption" @up="upCallback">
  5. <!-- 数据列表 -->
  6. <view>
  7. <block v-for="(item, index) in assetsFlow" :key="index">
  8. <view class="margin-top bg-white">
  9. <view class="flex justify-between align-start solid-bottom padding-tb-sm padding-lr" @tap="goDetails(item)">
  10. <!-- <image src="@/static/tu.png" mode="aspectFill" style="width: 150rpx; height: 150rpx;"></image> -->
  11. <view class='cu-avatar xxl radius' :style="{'background-image':'url('+item.goods.cover+')'}">
  12. <view class='cu-tag badge padding' :style="{'background-color':item.state_text.bg_color,'color':item.state_text.color}">{{item.state_text.text}}</view>
  13. </view>
  14. <view class="flex-sub padding-left-sm">
  15. <view class="bref-box margin-top-xs">
  16. {{item.goods.name}}
  17. </view>
  18. <text class="block margin-top-sm text-gray text-sm">数量 <text class="margin-left margin-right-xs text-gray">x</text>{{item.number}}</text>
  19. <view class="flex justify-between margin-top-sm">
  20. <view class="text-red text-price text-lg">
  21. <amount :value="Number(item.selling_price || 0)" :is-round-up="false" :precision="2" :duration="800" transition></amount>
  22. </view>
  23. <view>
  24. <button v-if="item.state==1" class="cu-btn bg-orange round margin-left-sm" @tap.stop="$routerGo('/pages/order/confirm-order?goods_id='+item.goods_id+'&goods_specs_id='+item.goods_specs_id)">立即付款</button>
  25. <button v-if="item.state==2" class="cu-btn bg-green round margin-left-sm" @tap="$routerGo('/pages/order/order-details?orderid='+item.id)">立即使用</button>
  26. <!-- <button v-if="item.state==2" class="cu-btn line-black round margin-left-sm" @tap="orderClick(item,'modalShowConfirm')">确认收货</button> -->
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="padding-lr padding-tb-sm order-bottom">
  32. <text class="cuIcon-fold bg-white order-ico"></text>
  33. <view class="flex justify-between align-center">
  34. <view style="color: #777777;">{{item.created_at_text}}</view>
  35. <view class="flex align-center justify-end">
  36. 实付
  37. <view class="text-price text-red text-xl">
  38. <amount :value="Number(item.amount || 0)" :is-round-up="false" :precision="2" :duration="800" transition></amount>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </block>
  45. </view>
  46. </mescroll-uni>
  47. <!-- 取消订单 -->
  48. <my-uni-modal title="取消订单" content="您确定要取消该订单吗?" btnText="取消订单" :modalShow="modalShowCancel" @determine="cancelDetermine"
  49. @hideModal="modalShowCancel=false" />
  50. <!-- 删除订单 -->
  51. <my-uni-modal title="删除订单" content="您确定要删除该订单吗?" btnText="删除订单" :modalShow="modalShowDel" @determine="delDetermine"
  52. @hideModal="modalShowDel=false" />
  53. <!-- 确认收货 -->
  54. <my-uni-modal title="确认收货" content="请确认您已经收到商品在点击确认收货,以免造成损失." btnText="确认收货" :modalShow="modalShowConfirm"
  55. @determine="confirmDetermine" @hideModal="modalShowConfirm=false" />
  56. </view>
  57. </template>
  58. <script>
  59. import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
  60. import MescrollMoreItemMixin from "@/components/mescroll-uni/mixins/mescroll-more-item.js";
  61. export default {
  62. mixins: [MescrollMixin, MescrollMoreItemMixin], // 注意此处还需使用MescrollMoreItemMixin (必须写在MescrollMixin后面)
  63. data() {
  64. return {
  65. modalShowCancel: false, //取消订单
  66. modalShowDel: false, //删除订单
  67. modalShowConfirm: false, //确认收货
  68. orderItem: {},
  69. downOption: {
  70. auto: false
  71. },
  72. upOption: {
  73. auto: false
  74. },
  75. assetsFlow: [],
  76. page: 1
  77. }
  78. },
  79. props: {
  80. i: Number, // 每个tab页的专属下标 (除了支付宝小程序必须在这里定义, 其他平台都可不用写, 因为已在MescrollMoreItemMixin定义)
  81. index: { // 当前tab的下标 (除了支付宝小程序必须在这里定义, 其他平台都可不用写, 因为已在MescrollMoreItemMixin定义)
  82. type: Number,
  83. default () {
  84. return 0
  85. }
  86. },
  87. tabs: { // 为了请求数据,演示用,可根据自己的项目判断是否要传
  88. type: Array,
  89. default () {
  90. return []
  91. }
  92. }
  93. },
  94. methods: {
  95. goDetails(item) {
  96. if(item.state==1) {
  97. this.$routerGo('/pages/order/unpay-details?orderid='+item.id)
  98. }else {
  99. this.$routerGo('/pages/order/order-details?orderid='+item.id)
  100. }
  101. },
  102. getUserOrder(pagenum) {
  103. this.$http(this.API.API_USERORDER, {state: this.tabs[this.index].type,page: pagenum,per_page: 20}).then(res => {
  104. if(res.code == 0) {
  105. if(pagenum == 1) this.assetsFlow = []
  106. this.mescroll.endSuccess(res.data.items.length, res.data.has_more_page);
  107. this.assetsFlow=this.assetsFlow.concat(res.data.items);
  108. console.log(this.assetsFlow)
  109. }
  110. }).catch(err => {
  111. this.mescroll.endErr();
  112. });
  113. },
  114. orderClick(item, type) {
  115. this.orderItem = item
  116. this[type] = true
  117. },
  118. //取消订单
  119. cancelDetermine() {
  120. },
  121. //删除订单
  122. delDetermine() {
  123. },
  124. //确认收货
  125. confirmDetermine() {
  126. this.$toast('已成功收货')
  127. },
  128. /*下拉刷新的回调 */
  129. downCallback() {
  130. // 下拉刷新的回调,默认重置上拉加载列表为第一页 (自动执行 page.num=1, 再触发upCallback方法 )
  131. this.mescroll.resetUpScroll()
  132. },
  133. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  134. upCallback(page) {
  135. this.getUserOrder(page.num)
  136. }
  137. },
  138. created() {
  139. this.getUserOrder()
  140. }
  141. }
  142. </script>
  143. <style lang="scss" scoped>
  144. .bref-box {
  145. text-overflow: -o-ellipsis-lastline;
  146. overflow: hidden;
  147. text-overflow: ellipsis;
  148. display: -webkit-box;
  149. -webkit-line-clamp: 2;
  150. -webkit-box-orient: vertical;
  151. }
  152. .order-bottom {
  153. position: relative;
  154. .order-ico {
  155. position: absolute;
  156. right: 50rpx;
  157. top: -19rpx;
  158. color: rgba(0, 0, 0, 0.1)
  159. }
  160. }
  161. </style>