myWholesale.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. <template>
  2. <view class="content">
  3. <view class="navbar flex">
  4. <view class="nav-item" v-for="(navitem,index) in navList" :class="{'action': index == tabCurrentIndex}"
  5. @click="navClick(index)">
  6. {{navitem.tit}}
  7. </view>
  8. </view>
  9. <swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab"
  10. :style="{'height': height}">
  11. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex"
  12. :style="{'height': height}">
  13. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="getMyPackage">
  14. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  15. <view @click="goToOrderDetail(item)" v-for="(item, index) in tabItem.orderList" :key="index"
  16. class="order-item">
  17. <view class="i-top b-b">
  18. <text class="time">订单编号:{{ item.order_id }}</text>
  19. <!-- :style="{ color: item.stateTipColor }" -->
  20. <text class="state">{{ item.status | statusTitle }}</text>
  21. <text v-if="item.status === 4" class="del-btn iconfont icondelete"
  22. @click="deleteOrder(index)"></text>
  23. </view>
  24. <!-- <scroll-view v-if="item.whole.length > 1" class="goods-box" scroll-x> -->
  25. <!-- <view v-for="(goodsItem, goodsIndex) in item.whole" :key="goodsIndex" class="goods-item">
  26. <image class="goods-img" :src="goodsItem.productInfo.image" mode="aspectFill"></image>
  27. </view> -->
  28. <!-- </scroll-view> -->
  29. <view class="goods-box-single">
  30. <image class="goods-img" :src="item.whole.image" mode="scaleToFill"></image>
  31. <view class="right">
  32. <view class="flex-start" style="justify-content: space-between;">
  33. <text class="title clamp">{{ item.whole.title }}</text>
  34. <text class="price">{{ moneyNum(item.whole.price) }}</text>
  35. </view>
  36. <view class="row flex">
  37. <!-- <text class="row_title">{{ goodsItem.productInfo.attrInfo ? goodsItem.productInfo.attrInfo.suk : '' }}</text> -->
  38. <text class="attr-box"> x {{ item.whole.num }}</text>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="action-box b-t" v-if="item.status != 5">
  43. <button class="action-btn" @click.stop="lookMore(item)">查看详情</button>
  44. <button v-if="item.status == 0" class="action-btn recom"
  45. @click.stop="payNew(item)">立即支付</button>
  46. </view>
  47. </view>
  48. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  49. </scroll-view>
  50. </swiper-item>
  51. </swiper>
  52. </view>
  53. </template>
  54. <script>
  55. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  56. import empty from '@/components/empty';
  57. import {
  58. getMyPackage
  59. } from '@/api/whole.js'
  60. export default {
  61. components: {
  62. uniLoadMore,
  63. empty
  64. },
  65. data() {
  66. return {
  67. chooseItem: {},
  68. height: '',
  69. tabCurrentIndex: 0,
  70. navList: [{
  71. tit: '当天预约',
  72. orderList: [],
  73. page: 1,
  74. limit: 10,
  75. loadingType: 'more',
  76. loaded: false,
  77. day: 'today',
  78. status: -4
  79. },
  80. {
  81. tit: '待支付',
  82. orderList: [],
  83. page: 1,
  84. limit: 10,
  85. loadingType: 'more',
  86. loaded: false,
  87. day: 'today',
  88. status: 1
  89. },
  90. ],
  91. }
  92. },
  93. onReady(res) {
  94. // 初始化获取页面宽度
  95. var _this = this;
  96. uni.getSystemInfo({
  97. success: resu => {
  98. const query = uni.createSelectorQuery();
  99. query.select('.swiper-box').boundingClientRect();
  100. query.exec(function(res) {
  101. _this.height = resu.windowHeight - res[0].top + 'px';
  102. console.log('打印页面的剩余高度', _this.height);
  103. });
  104. },
  105. fail: res => {}
  106. });
  107. },
  108. onLoad() {
  109. this.getMyPackage()
  110. },
  111. filters: {
  112. statusTitle(val) {
  113. let str = ''
  114. switch (val) {
  115. case -2:
  116. str = '支付超时'
  117. break;
  118. case -1:
  119. str = '待支付'
  120. break;
  121. case 0:
  122. str = '待支付'
  123. break;
  124. case 1:
  125. str = '待审核'
  126. break;
  127. case 2:
  128. str = '收款'
  129. break;
  130. case 3:
  131. str = '重新发放'
  132. break;
  133. case 4:
  134. str = '完成'
  135. break;
  136. default:
  137. str = ''
  138. break
  139. }
  140. return str
  141. }
  142. },
  143. methods: {
  144. // 查看详情
  145. lookMore(item) {
  146. this.chooseItem = item
  147. uni.navigateTo({
  148. url: '/pages/user/buySellDetail?type=look'
  149. })
  150. },
  151. // 立即支付
  152. payNew(item) {
  153. this.chooseItem = item
  154. uni.navigateTo({
  155. url: '/pages/user/buySellDetail?type=up'
  156. })
  157. },
  158. // 转换金额为数字
  159. moneyNum(value) {
  160. return +value;
  161. },
  162. navClick(index) {
  163. this.tabCurrentIndex = index
  164. },
  165. getMyPackage(tab) {
  166. let obj = this
  167. let index = obj.tabCurrentIndex
  168. let navItem = obj.navList[index]
  169. if (navItem.loadingType == 'noMore' || navItem.loadingType == 'loading') {
  170. return
  171. }
  172. if (tab == 'tab' && navItem.loaded) {
  173. return
  174. }
  175. navItem.loadingType == 'loading'
  176. getMyPackage({
  177. page: navItem.page,
  178. limit: navItem.limit,
  179. data: navItem.day,
  180. status: navItem.status
  181. }).then(({
  182. data
  183. }) => {
  184. navItem.orderList = navItem.orderList.concat(data.data)
  185. navItem.page++
  186. if (navItem.limit == data.data.length) {
  187. navItem.loadingType = 'more'
  188. } else {
  189. navItem.loadingType = 'noMore'
  190. }
  191. navItem.loaded = true
  192. })
  193. }
  194. }
  195. }
  196. </script>
  197. <style lang="scss" scoped>
  198. .navbar {
  199. background-color: #fff;
  200. height: 40px;
  201. .nav-item {
  202. width: 50%;
  203. text-align: center;
  204. font-size: 30rpx;
  205. font-family: PingFang SC;
  206. font-weight: 500;
  207. color: #333333;
  208. }
  209. .action {
  210. font-weight: bold;
  211. position: relative;
  212. color: #FF4C4C;
  213. &::after {
  214. content: '';
  215. width: 84rpx;
  216. height: 4rpx;
  217. background: #FF4C4C;
  218. border-radius: 2px;
  219. position: absolute;
  220. bottom: -20rpx;
  221. left: 0;
  222. right: 0;
  223. margin: auto;
  224. }
  225. }
  226. }
  227. .swiper-box {
  228. padding-top: 20rpx;
  229. // height: calc(100% - 40px);
  230. // background-color: red;
  231. }
  232. .list-scroll-content {
  233. height: 100%;
  234. }
  235. .order-item {
  236. display: flex;
  237. flex-direction: column;
  238. padding-left: 30rpx;
  239. background: #fff;
  240. margin-bottom: 16rpx;
  241. .i-top {
  242. display: flex;
  243. align-items: center;
  244. height: 80rpx;
  245. padding-right: 30rpx;
  246. font-size: $font-base;
  247. color: $font-color-dark;
  248. position: relative;
  249. .time {
  250. flex: 1;
  251. }
  252. .state {
  253. color: $base-color;
  254. }
  255. .del-btn {
  256. padding: 10rpx 0 10rpx 36rpx;
  257. font-size: $font-lg;
  258. color: $font-color-light;
  259. position: relative;
  260. &:after {
  261. content: '';
  262. width: 0;
  263. height: 30rpx;
  264. border-left: 1px solid $border-color-dark;
  265. position: absolute;
  266. left: 20rpx;
  267. top: 50%;
  268. transform: translateY(-50%);
  269. }
  270. }
  271. }
  272. /* 多条商品 */
  273. .goods-box {
  274. height: 160rpx;
  275. padding: 20rpx 0;
  276. white-space: nowrap;
  277. .goods-item {
  278. width: 120rpx;
  279. height: 120rpx;
  280. display: inline-block;
  281. margin-right: 24rpx;
  282. }
  283. .goods-img {
  284. display: block;
  285. width: 100%;
  286. height: 100%;
  287. }
  288. }
  289. /* 单条商品 */
  290. .goods-box-single {
  291. display: flex;
  292. padding: 20rpx 0;
  293. .goods-img {
  294. display: block;
  295. width: 120rpx;
  296. height: 120rpx;
  297. }
  298. .right {
  299. flex: 1;
  300. display: flex;
  301. flex-direction: column;
  302. padding: 0 30rpx 0 24rpx;
  303. overflow: hidden;
  304. .row {
  305. margin-top: 10rpx;
  306. }
  307. .row_title {
  308. padding: 5rpx 10rpx;
  309. background-color: #dddddd;
  310. border-radius: 10rpx;
  311. font-size: 22rpx;
  312. color: #ffffff;
  313. }
  314. .title {
  315. font-size: $font-base + 2rpx;
  316. color: $font-color-dark;
  317. line-height: 1;
  318. width: 80%;
  319. }
  320. .attr-box {
  321. display: flex;
  322. justify-content: flex-end;
  323. font-size: $font-sm + 2rpx;
  324. color: $font-color-light;
  325. }
  326. .price {
  327. display: inline;
  328. font-size: $font-base + 2rpx;
  329. color: $font-color-dark;
  330. &:before {
  331. content: '¥';
  332. font-size: $font-sm;
  333. }
  334. }
  335. }
  336. }
  337. .price-box {
  338. display: flex;
  339. justify-content: flex-end;
  340. align-items: baseline;
  341. padding: 20rpx 30rpx;
  342. font-size: $font-sm + 2rpx;
  343. color: $font-color-light;
  344. .num {
  345. margin: 0 8rpx;
  346. color: $font-color-dark;
  347. }
  348. .price {
  349. font-size: $font-lg;
  350. color: $font-color-dark;
  351. &:before {
  352. content: '¥';
  353. font-size: $font-sm;
  354. margin: 0 2rpx 0 8rpx;
  355. }
  356. }
  357. }
  358. .action-box {
  359. display: flex;
  360. justify-content: flex-end;
  361. align-items: center;
  362. height: 100rpx;
  363. position: relative;
  364. padding-right: 30rpx;
  365. }
  366. .action-btn {
  367. width: 160rpx;
  368. height: 60rpx;
  369. margin: 0;
  370. margin-left: 24rpx;
  371. padding: 0;
  372. text-align: center;
  373. line-height: 60rpx;
  374. font-size: $font-sm + 2rpx;
  375. color: $font-color-dark;
  376. background: #fff;
  377. border-radius: 100px;
  378. &:after {
  379. border-radius: 100px;
  380. }
  381. &.recom {
  382. color: $base-color;
  383. &:after {
  384. border-color: $base-color;
  385. }
  386. }
  387. &.evaluate {
  388. color: $color-yellow;
  389. &:after {
  390. border-color: $color-yellow;
  391. }
  392. }
  393. }
  394. }
  395. </style>