myorder.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <view class="page">
  3. <u-tabs :font-size='28' :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
  4. <view class="list">
  5. <view class="box" v-for="(item,index) in orderlist" :key="index">
  6. <view class="u-flex u-row-between">
  7. <text class="order">订单编号:{{item.order_on}}</text>
  8. <view class="">
  9. <text v-if="item.status==0" class="state">
  10. {{item.status_text}}
  11. </text>
  12. <text v-else class="state" style="color: rgba(0, 0, 0, 0.60);">
  13. {{item.status_text}}
  14. </text>
  15. </view>
  16. </view>
  17. <view class="book">
  18. <view class="u-flex" style="margin-top: 26rpx;" v-for="(item1,index) in item.goods">
  19. <view class="" style="padding: 0 20rpx;">
  20. <image :src="item1.good_item.image" style="width: 120rpx;height: 160rpx;" mode=""></image>
  21. </view>
  22. <view class="" style="margin-left: 20rpx;">
  23. <view class="name u-line-1">{{item1.good_item.title}}</view>
  24. <view class="type">资源类型:付费资源</view>
  25. <view class="money">¥{{item1.good_item.price}}</view>
  26. </view>
  27. </view>
  28. <view class="shapping u-flex " style="justify-content: end;">
  29. <text class="font1">商品金额:</text>
  30. <text class="font3">¥</text>
  31. <text class="font2">{{item.total_price}}</text>
  32. </view>
  33. <view class="u-flex " style="margin-top: 28rpx;justify-content: end;">
  34. <view v-if="item.status ==0" class="cancel" @click="cancel(item.id)">取消订单</view>
  35. <view v-if="item.status ==0" class="pay" style="color: #fff;">立即付款</view>
  36. <view v-if="item.status ==-1" class=" cancel" @click="delect(item.id)">删除订单</view>
  37. <view v-if="item.status ==1||item.status ==0" class="details cancel"
  38. @click="orderinfo(item.id)">查看详情</view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. export default {
  47. data() {
  48. return {
  49. list: [{
  50. name: '全部'
  51. }, {
  52. name: '待支付'
  53. }, {
  54. name: '已完成',
  55. }, {
  56. name: '已取消',
  57. }],
  58. current: 0,
  59. page: 1,
  60. limit: 10,
  61. status: '',
  62. orderlist: []
  63. };
  64. },
  65. onLoad() {
  66. this.getOrderList()
  67. },
  68. methods: {
  69. orderinfo(id) {
  70. uni.navigateTo({
  71. url: '/pages/success?id=' + id
  72. })
  73. },
  74. change(index) {
  75. this.current = index;
  76. if (this.current == 0) {
  77. this.status = ''
  78. } else if (this.current < 3) {
  79. this.status = index - 1
  80. } else if (this.current == 3) {
  81. this.status = -1
  82. }
  83. this.getOrderList()
  84. },
  85. //删除订单
  86. delect(id) {
  87. var that = this
  88. uni.showModal({
  89. title: '提示',
  90. content: '确定删除该订单吗',
  91. success: function(res) {
  92. if (res.confirm) {
  93. that.delect1(id)
  94. } else if (res.cancel) {
  95. console.log('用户点击取消');
  96. }
  97. }
  98. });
  99. },
  100. delect1(id) {
  101. this.$u.post('api/order/delOrder', {
  102. id: id
  103. }).then(res => {
  104. if (res.code == 1) {
  105. this.$u.toast('订单已删除')
  106. this.getOrderList()
  107. }
  108. })
  109. },
  110. cancel(id) {
  111. var that = this
  112. uni.showModal({
  113. title: '提示',
  114. content: '确定取消该订单吗',
  115. success: function(res) {
  116. if (res.confirm) {
  117. that.cancel1(id)
  118. } else if (res.cancel) {
  119. console.log('用户点击取消');
  120. this.getOrderList()
  121. }
  122. }
  123. });
  124. },
  125. cancel1(id) {
  126. this.$u.post('api/order/cancellationOrder', {
  127. id: id
  128. }).then(res => {
  129. if (res.code == 1) {
  130. this.$u.toast('订单已取消')
  131. }
  132. })
  133. },
  134. getOrderList() {
  135. this.$u.post('api/order/getOrderList', {
  136. page: this.page,
  137. limit: this.limit,
  138. status: this.status
  139. }).then(res => {
  140. if (res.code == 1) {
  141. this.orderlist = res.data.data
  142. }
  143. })
  144. }
  145. }
  146. }
  147. </script>
  148. <style lang="scss">
  149. .cancel {
  150. width: 148rpx;
  151. height: 68rpx;
  152. border-radius: 8rpx;
  153. border: 2rpx solid #979797;
  154. line-height: 68rpx;
  155. text-align: center;
  156. margin-left: 20rpx;
  157. }
  158. .pay {
  159. width: 160rpx;
  160. height: 68rpx;
  161. background: #06A971;
  162. border-radius: 8rpx;
  163. line-height: 68rpx;
  164. text-align: center;
  165. margin-left: 20rpx;
  166. }
  167. .name {
  168. font-size: 28rpx;
  169. font-family: PingFangHK, PingFangHK;
  170. font-weight: 400;
  171. color: #333333;
  172. width: 500rpx;
  173. }
  174. .font1 {
  175. font-size: 26rpx;
  176. font-family: PingFangSC, PingFang SC;
  177. font-weight: 400;
  178. color: #222222;
  179. }
  180. .font2 {
  181. font-size: 36rpx;
  182. font-family: JDZhengHT, JDZhengHT;
  183. font-weight: 500;
  184. color: #222222;
  185. }
  186. .font3 {
  187. font-size: 26rpx;
  188. font-family: JDZhengHT, JDZhengHT;
  189. font-weight: 300;
  190. color: #222222;
  191. margin-left: 14rpx;
  192. margin-top: 10rpx;
  193. }
  194. .type {
  195. font-size: 24rpx;
  196. font-family: PingFangSC, PingFang SC;
  197. font-weight: 400;
  198. color: #444444;
  199. margin-top: 8rpx;
  200. }
  201. .shapping {
  202. margin-top: 28rpx;
  203. }
  204. .money {
  205. font-size: 32rpx;
  206. font-family: SFPro, SFPro;
  207. font-weight: 400;
  208. color: #333333;
  209. margin-top: 42rpx;
  210. }
  211. ::v-deep .u-tab-bar {
  212. background-color: #06A971 !important;
  213. }
  214. .state {
  215. font-size: 24rpx;
  216. font-family: PingFangSC, PingFang SC;
  217. font-weight: 400;
  218. color: #CF1534;
  219. }
  220. ::v-deep .u-tab-item {
  221. color: #222 !important
  222. }
  223. .book {
  224. margin: 28rpx 0 0 0;
  225. border-top: 2rpx solid rgba(151, 151, 151, 0.2);
  226. }
  227. .order {
  228. font-size: 24rpx;
  229. font-family: SFPro, SFPro;
  230. font-weight: 400;
  231. color: #222222;
  232. }
  233. .box {
  234. width: 694rpx;
  235. // height: 472rpx;
  236. background: #FFFFFF;
  237. border-radius: 16rpx;
  238. padding: 28rpx 20rpx 30rpx;
  239. margin-top: 20rpx;
  240. box-sizing: border-box;
  241. }
  242. .list {
  243. padding: 20rpx 28rpx;
  244. }
  245. .page {
  246. background: #F6F6F6;
  247. min-height: 100vh;
  248. }
  249. </style>