waterUse.vue 8.1 KB

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