auditList.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <view class="container">
  3. <u-navbar leftIconColor="#fff" titleStyle="color:#fff;fontSize:36rpx;" :autoBack="true" bgColor="#2C6FF3"
  4. :placeholder="true" title="商品建模"></u-navbar>
  5. <view class="content">
  6. <view class="search">
  7. <u-search animation placeholder="商品搜索" :clearabled="false" v-model="keyword" :showAction="false"
  8. @search="search"></u-search>
  9. <view class="scan-icon" @click="scan">
  10. <u-icon name="scan" size="22" color="#909399"></u-icon>
  11. </view>
  12. </view>
  13. <view class="tab-list">
  14. <u-tabs :list="tabList" :scrollable="false" :current="pos" @click="tabClick" lineColor="#2C6FF3">
  15. </u-tabs>
  16. </view>
  17. <view class="list">
  18. <u-list @scrolltolower="scrolltolower" :height="fullHeight" v-if="commList.length>0">
  19. <u-list-item class="list-item" v-for="(item, index) in commList" :key="item.id"
  20. @click.native="goDetail(item)">
  21. <view class="comm-item">
  22. <view class="image">
  23. <u--image width="130rpx" height="130rpx" :src="item.cover" mode="widthFix"
  24. :lazy-load="true"></u--image>
  25. </view>
  26. <view class="item-content">
  27. <view>
  28. {{item.goodsName}}
  29. </view>
  30. <view>
  31. {{item.brandName}}
  32. </view>
  33. <view>
  34. {{item.createTime}}
  35. </view>
  36. <view class="failedMsg" v-if="item.status==-1">
  37. 驳回原因:{{item.failedMsg}}
  38. </view>
  39. </view>
  40. <view class="tag">
  41. <u-tag text="已通过" plain size="mini" type="success" v-if="item.status==1"></u-tag>
  42. <u-tag text="已驳回" plain size="mini" type="error" v-if="item.status==-1"></u-tag>
  43. <u-tag text="审核中" plain size="mini" type="warning" v-if="item.status==0"></u-tag>
  44. </view>
  45. </view>
  46. </u-list-item>
  47. <u-loadmore :status="status" v-if="commList.length>=1" />
  48. </u-list>
  49. <view class="empty" v-else>
  50. <u-empty></u-empty>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="btn safe-bottom">
  55. <xbutton size="large" @click="$tab.navigateTo('/pages/commodity/addCom')">新品建模</xbutton>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. import {
  61. goodsPage
  62. } from "@/api/commodity/goodsMode.js"
  63. export default {
  64. data() {
  65. return {
  66. keyword: '',
  67. tabList: [{
  68. name: '已通过',
  69. id: 1
  70. },
  71. {
  72. name: '审核中',
  73. id: 0
  74. },
  75. {
  76. name: '已驳回',
  77. id: -1
  78. }
  79. ],
  80. page: 1,
  81. size: 10,
  82. keywords: '',
  83. pos: 1,
  84. current: 0,
  85. status: 'loadmore',
  86. commList: [],
  87. fullHeight: 0
  88. }
  89. },
  90. onLoad() {
  91. let _this = this;
  92. const query = uni.createSelectorQuery().in(this);
  93. query.select(".list").boundingClientRect((data) => {
  94. uni.getSystemInfo({
  95. success(res) {
  96. _this.fullHeight = res.windowHeight-218 + 'px';
  97. },
  98. });
  99. }).exec();
  100. this.getList()
  101. },
  102. methods: {
  103. tabClick(e) {
  104. console.log(e)
  105. this.pos = e.index;
  106. this.current = e.id;
  107. this.reset();
  108. this.getList();
  109. },
  110. reset() {
  111. this.status == 'loadmore'
  112. this.page = 1;
  113. this.size = 10;
  114. this.commList = [];
  115. },
  116. getList() {
  117. goodsPage({
  118. page: {
  119. current: this.page,
  120. size: this.size
  121. },
  122. keywords: this.keyword,
  123. status: this.current
  124. }).then(res => {
  125. let data = res.data.records;
  126. if (data.length < 10) {
  127. this.status = "nomore"
  128. } else {
  129. this.status = "loadmore"
  130. }
  131. this.commList = this.commList.concat(data)
  132. })
  133. },
  134. scrolltolower() {
  135. if (this.status == 'nomore') return
  136. this.page++
  137. this.getList()
  138. },
  139. search(val) {
  140. this.reset()
  141. this.getList()
  142. },
  143. scan() {
  144. uni.scanCode({
  145. success: function(res) {
  146. console.log('条码类型:' + res.scanType);
  147. console.log('条码内容:' + res.result);
  148. }
  149. });
  150. },
  151. // 详情
  152. goDetail(e) {
  153. this.$tab.navigateTo('/pages/commodity/addCom?id=' + e.id)
  154. }
  155. }
  156. }
  157. </script>
  158. <style lang="scss" scoped>
  159. page {
  160. height: 100% !important;
  161. }
  162. .container {
  163. height: 100% !important;
  164. .content {
  165. // padding-bottom: 88rpx;
  166. .search {
  167. padding: 24rpx 24rpx;
  168. background-color: #fff;
  169. position: relative;
  170. .scan-icon {
  171. position: absolute;
  172. right: 36rpx;
  173. top: 50%;
  174. transform: translateY(-50%);
  175. z-index: 2;
  176. }
  177. }
  178. .tab-list {
  179. width: 100%;
  180. padding: 0 24rpx;
  181. background-color: #fff;
  182. margin-bottosearchm: 12rpx;
  183. }
  184. .empty {
  185. margin: 40% auto 0;
  186. }
  187. .list {
  188. width: 100%;
  189. padding: 0 24rpx;
  190. margin-top: 16rpx;
  191. .comm-item {
  192. display: flex;
  193. flex-direction: row;
  194. justify-content: flex-start;
  195. align-items: center;
  196. background-color: #fff;
  197. margin-bottom: 12rpx;
  198. border-radius: 12rpx;
  199. box-sizing: border-box;
  200. padding: 12rpx;
  201. position: relative;
  202. .image {
  203. width: 130rpx;
  204. height: 130rpx;
  205. }
  206. .item-content {
  207. padding-left: 24rpx;
  208. color: #999;
  209. >view:nth-child(1) {
  210. font-size: 28rpx;
  211. font-weight: bold;
  212. color: #333;
  213. }
  214. >view:nth-child(2) {
  215. font-size: 24rpx;
  216. padding: 12rpx 0;
  217. }
  218. >view:nth-child(3) {
  219. font-size: 24rpx;
  220. }
  221. .failedMsg{
  222. color: red;
  223. font-size: 24rpx;
  224. line-height: 30rpx;
  225. margin-top: 10rpx;
  226. }
  227. }
  228. .tag {
  229. position: absolute;
  230. right: 12rpx;
  231. top: 12rpx;
  232. }
  233. }
  234. }
  235. }
  236. .btn {
  237. width: 100%;
  238. position: fixed;
  239. left: 0;
  240. bottom: 24rpx;
  241. padding: 0 24rpx;
  242. }
  243. }
  244. </style>