waterUse.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <view class="good-list">
  3. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  4. <!-- 空白页 -->
  5. <!-- #ifdef H5 -->
  6. <empty src="../../static/error/emptyMyCart.png"
  7. v-if="navList[tabCurrentIndex].loaded === true && navList[tabCurrentIndex].orderList.length === 0">
  8. </empty>
  9. <!-- #endif -->
  10. <!-- #ifndef H5 -->
  11. <empty src="../static/error/emptyMyCart.png"
  12. v-if="navList[tabCurrentIndex].loaded === true && navList[tabCurrentIndex].orderList.length === 0">
  13. </empty>
  14. <!-- #endif -->
  15. <view @click="navTo( '/pages/order/orderDetail?id=' + item.order_id )"
  16. v-for="(item, index) in navList[tabCurrentIndex].orderList" :key="index" class="order-item position-relative">
  17. <view class="i-top b-b flex">
  18. <view class="order-code flex">
  19. <view class="no">
  20. 订单编号:
  21. </view>
  22. <view>
  23. {{ item.order_id }}
  24. </view>
  25. </view>
  26. <text class="font-size-sm font-color-gray" >已完成}</text>
  27. </view>
  28. <scroll-view v-if="item.cartInfo.length > 0" class="goods-box" scroll-x>
  29. <view v-for="(goodsItem, goodsIndex) in item.cartInfo" :key="goodsIndex" class="goods-item">
  30. <image class="goods-img" :src="goodsItem.productInfo.image" mode="aspectFill">
  31. </image>
  32. <view class="good-name clamp">
  33. {{goodsItem.productInfo.attrInfo.suk}}*{{goodsItem.cart_num}}
  34. </view>
  35. </view>
  36. </scroll-view>
  37. <view class="info-info">
  38. <view class="js">
  39. 共{{item.cartInfo.length}}件
  40. </view>
  41. <view class="hj">
  42. 合计:¥{{item.pay_price}}
  43. </view>
  44. </view>
  45. <!-- 底部操作栏 -->
  46. <view class="btm-btn-wrap flex">
  47. <view class="btm-left">
  48. 下单时间:{{item._add_time.split(' ')[0].replace(/-/g,'/')}}
  49. </view>
  50. <view class="btm-right flex">
  51. <view class="btm-btn" @click.stop="cancelOrder(item)"
  52. v-if="item._status._title == '未支付'">
  53. 取消订单
  54. </view>
  55. <view class="btm-btn ksps"
  56. @click.stop="navTo( '/pages/user/money/pay?type=1&ordid=' + item.order_id + '&money=' + item.pay_price)"
  57. v-if="item._status._title == '未支付'">
  58. 前往支付
  59. </view>
  60. <view class="btm-btn ksps" @click.stop="orderTake(item, index)"
  61. v-if="item._status._title == '待收货'">
  62. 确认收货
  63. </view>
  64. <view class="btm-btn ksps"
  65. @click.stop="navTo('/pages/order/orderRefund?id=' + item.order_id)"
  66. v-if="item._status._title == '未发货'||item._status._title == '未核销'">
  67. 申请退款
  68. </view>
  69. <view class="btm-btn ksps"
  70. @click.stop="navTo('/pages/order/WriteOff?id=' + item.order_id)"
  71. v-if="item._status._title == '待核销'">
  72. 核销码
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <uni-load-more :status="navList[tabCurrentIndex].loadingType"></uni-load-more>
  78. </scroll-view>
  79. </view>
  80. </template>
  81. <script>
  82. import {
  83. use_certificate
  84. } from '@/api/water.js';
  85. export default {
  86. data() {
  87. return {
  88. tabCurrentIndex: 0,
  89. navList: [{
  90. state: 0,
  91. text: '全部',
  92. loadingType: 'more',
  93. orderList: [],
  94. page: 1, //当前页数
  95. limit: 10 //每次信息条数
  96. }]
  97. };
  98. },
  99. computed: {
  100. allNumber() {
  101. const item = this.navList[0].orderList;
  102. let num = 0;
  103. for (let i = 0; i < item.length; i++) {
  104. num += item[i].certificate_num
  105. }
  106. return num
  107. }
  108. },
  109. onReachBottom() {
  110. this.getGoodList();
  111. },
  112. onLoad: function(option) {
  113. this.getGoodList();
  114. },
  115. methods: {
  116. // 返回退回
  117. back() {
  118. uni.reLaunch({
  119. url: '/pages/home/user'
  120. })
  121. },
  122. // 加载数据
  123. getGoodList(source) {
  124. //这里是将订单挂载到tab列表下
  125. let index = this.tabCurrentIndex;
  126. let navItem = this.navList[index];
  127. let state = navItem.state;
  128. console.log(navItem, '数据');
  129. if (source === 'tabChange' && navItem.loaded === true) {
  130. //tab切换只有第一次需要加载数据
  131. return;
  132. }
  133. if (navItem.loadingType === 'loading') {
  134. //防止重复加载
  135. return;
  136. }
  137. if (navItem.loadingType === 'noMore') {
  138. //防止重复加载
  139. return;
  140. }
  141. // 修改当前对象状态为加载中
  142. navItem.loadingType = 'loading';
  143. use_certificate({
  144. page: navItem.page,
  145. limit: navItem.limit
  146. })
  147. .then(({
  148. data
  149. }) => {
  150. let arr = data.data
  151. navItem.orderList = navItem.orderList.concat(arr);
  152. navItem.page++;
  153. if (navItem.limit == arr.length) {
  154. //判断是否还有数据, 有改为 more, 没有改为noMore
  155. navItem.loadingType = 'more';
  156. return;
  157. } else {
  158. //判断是否还有数据, 有改为 more, 没有改为noMore
  159. navItem.loadingType = 'noMore';
  160. }
  161. uni.hideLoading();
  162. this.$set(navItem, 'loaded', true);
  163. })
  164. .catch(e => {
  165. console.log(e);
  166. });
  167. },
  168. }
  169. };
  170. </script>
  171. <style lang="scss">
  172. .good-list {
  173. width: 750rpx;
  174. height: 100%;
  175. .good {
  176. background: #FFFFFF;
  177. box-shadow: 0px 0px 20px 0px rgba(50, 50, 52, 0.06);
  178. width: 100%;
  179. border-radius: 14rpx;
  180. margin-bottom: 20rpx;
  181. position: relative;
  182. padding: 20rpx;
  183. .good-image {
  184. width: 180rpx;
  185. height: 180rpx;
  186. background-color: #eee;
  187. border-radius: 10rpx;
  188. flex-shrink: 0;
  189. }
  190. .right {
  191. height: 180rpx;
  192. position: relative;
  193. .good-name {
  194. font-size: 28rpx;
  195. font-weight: bold;
  196. color: #333333;
  197. padding-left: 20rpx;
  198. }
  199. .good-key {
  200. font-size: 22rpx;
  201. font-weight: 500;
  202. color: #999999;
  203. padding-left: 20rpx
  204. }
  205. .good-price {
  206. font-size: 28rpx;
  207. font-weight: bold;
  208. position: absolute;
  209. bottom: 0rpx;
  210. padding: 0 20rpx;
  211. left: 0;
  212. right: 0rpx;
  213. .num{
  214. color:$color-red;
  215. }
  216. }
  217. }
  218. }
  219. }
  220. .list-scroll-content {
  221. height: calc(100% - 200px - var(--status-bar-height));
  222. padding: 20rpx;
  223. }
  224. .order-item {
  225. padding-left: 30rpx;
  226. padding-right: 30rpx;
  227. margin: 0 30rpx;
  228. margin-bottom: 30rpx;
  229. border-radius: 30rpx;
  230. background: #fff;
  231. color: #A8ADBF;
  232. .i-top {
  233. height: 80rpx;
  234. .order-code{
  235. font-size: $font-sm;
  236. .no{
  237. padding: 10rpx 10rpx;
  238. background-color: #FFEAE5;
  239. color: #FD5B23;
  240. line-height: 1;
  241. border-top-right-radius: 10rpx;
  242. border-bottom-left-radius: 10rpx;
  243. margin-right: 10rpx;
  244. }
  245. }
  246. .del-btn {
  247. padding: 10rpx 0 10rpx 36rpx;
  248. font-size: $font-lg;
  249. position: relative;
  250. &:after {
  251. content: '';
  252. width: 0;
  253. height: 30rpx;
  254. border-left: 1px solid $border-color-dark;
  255. position: absolute;
  256. left: 20rpx;
  257. top: 50%;
  258. transform: translateY(-50%);
  259. }
  260. }
  261. }
  262. .info-info {
  263. width: 215rpx;
  264. height: 200rpx;
  265. position: absolute;
  266. top: 80rpx;
  267. right: 35rpx;
  268. display: flex;
  269. flex-direction: column;
  270. justify-content: flex-end;
  271. align-items: flex-end;
  272. font-size: 30rpx;
  273. font-weight: 500;
  274. .hj {
  275. padding-top: 40rpx;
  276. color: $font-color-dark;
  277. padding-bottom: 20rpx;
  278. }
  279. }
  280. /* 多条商品 */
  281. .goods-box {
  282. height: 200rpx;
  283. padding: 20rpx 0;
  284. white-space: nowrap;
  285. padding-right: 250rpx;
  286. .goods-item {
  287. width: 120rpx;
  288. height: 180rpx;
  289. display: inline-block;
  290. margin-right: 24rpx;
  291. }
  292. .goods-img {
  293. display: block;
  294. width: 120rpx;
  295. height: 120rpx;
  296. }
  297. .good-name {
  298. font-size: 24rpx;
  299. text-align: center;
  300. width: 120rpx;
  301. padding-top: 10rpx;
  302. margin-right: 0;
  303. color: $font-color-dark;
  304. }
  305. }
  306. .btm-btn-wrap {
  307. height: 90rpx;
  308. width: 100%;
  309. font-size: 24rpx;
  310. font-weight: 500;
  311. color: #A3A8BB;
  312. line-height: 1;
  313. .btm-right {
  314. justify-content: flex-end;
  315. }
  316. .btm-btn {
  317. width: 144rpx;
  318. padding: 10rpx 0;
  319. border: 2px solid #ededed;
  320. border-radius: 28rpx;
  321. font-size: 26rpx;
  322. font-weight: 500;
  323. text-align: center;
  324. margin-left: 10rpx;
  325. color: #999999;
  326. }
  327. .ksps {
  328. border-color: #4589ec;
  329. color: #4589ec;
  330. }
  331. }
  332. }
  333. </style>