index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <view class="product">
  3. <view style="padding: 10px;background: #ffffff;">
  4. <My_search placeholder="搜索名称" @onSearch="onSearch"></My_search>
  5. <view class="tabs-box" v-if="typeList.length">
  6. <v-tabs ref="tabs" v-model="tabsActive" field="remarks" :pills="true" height="24px" pillsBorderRadius="12px"
  7. pillsColor="#C30D23" pillsUnColor="#eee" bgColor="none" itemMargin="0 4px 0 0" color="#333333"
  8. activeColor="#FFFFFF" :tabs="typeList" @change="changeClass" />
  9. </view>
  10. </view>
  11. <view class="header-line">
  12. <text>商品</text>
  13. <text>共{{total}}个</text>
  14. </view>
  15. <view class="list">
  16. <My_listbox ref="List" @getlist="getList" :bottomHeight="70">
  17. <view v-for="item in list" :key="item.sa_fadid" class="box">
  18. <navigator @click="goDetail" :url="'/cloud/commodityAdjustment/detail?id='+item.sa_fadid" class="product-item">
  19. <u-image :src="item.attinfos.length ? item.attinfos[0].url:''" :width="tovw(86)" :height="tovw(80)" :lazy-load="true" radius="5"></u-image>
  20. <view class="product-info">
  21. <text class="title u-line-1">{{ item.name }}</text>
  22. <text class="price"><text style="margin-right: 2px;">¥</text>{{ CNY(item.pricetype != '阶梯价' ? item.price : item.price_deposit,'') }}<text style="margin-left: 2px;">元</text></text>
  23. </view>
  24. </navigator>
  25. <view class="bottom">
  26. <view :style="{'--color1':item.isonsale ? '#E3041F' : '#E3041F'}" class="status">{{ item.isonsale ? '上架' : '下架' }}</view>
  27. <view class="change-date">{{ item.changedate }}</view>
  28. </view>
  29. </view>
  30. </My_listbox>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data () {
  37. return {
  38. list:[],
  39. content: {
  40. "sys_enterpriseid": uni.getStorageSync('shop').sys_enterpriseid, //门店信息中获取
  41. "pageNumber": 1,
  42. "pageSize": 20,
  43. "where": {
  44. "condition": "",
  45. "class": ""
  46. }
  47. },
  48. typeList:[],
  49. tabsActive: 0,
  50. total:0
  51. }
  52. },
  53. methods: {
  54. goDetail () {
  55. this.$Http.editProduct = function (id){
  56. this.getList (true)
  57. delete this.$Http.editProduct
  58. }.bind(this)
  59. },
  60. onSearch (condition) {
  61. this.content.where.condition = condition
  62. this.getList(true)
  63. },
  64. changeClass(index) {
  65. this.tabsActive = index;
  66. this.content.where.class = this.typeList[index].value;
  67. this.getList(true);
  68. },
  69. getList(init = false) {
  70. return new Promise((resolve, reject) => {
  71. if (this.paging(this.content, init)) return resolve();
  72. this.$Http.basic({
  73. "id": "20240515153202",
  74. content: this.content
  75. }).then(res => {
  76. this.total = res.total
  77. this.$refs.List.setHeight()
  78. this.$refs.List.RefreshToComplete()
  79. resolve();
  80. if (this.cutoff(res.msg)) return;
  81. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
  82. console.log("获取商品列表", this.list)
  83. this.content = this.$refs.List.paging(this.content, res)
  84. })
  85. })
  86. },
  87. async getType () {
  88. this.getCustomClass("goodstype").then(list => {
  89. console.log("分类列表", list)
  90. this.typeList = list;
  91. this.typeList.unshift({remarks:'全部',value:''})
  92. this.getList()
  93. })
  94. },
  95. onLoad () {
  96. uni.setNavigationBarTitle({
  97. title:'商品调整',
  98. })
  99. this.getType()
  100. }
  101. },
  102. }
  103. </script>
  104. <style lang="scss">
  105. .product {
  106. box-sizing: border-box;
  107. font-family: Source Han Sans SC, Source Han Sans SC;
  108. .tabs-box {
  109. margin-top: 10px;
  110. }
  111. .header-line {
  112. display: flex;
  113. justify-content: space-between;
  114. align-items: center;
  115. align-content: center;
  116. padding: 10px;
  117. font-weight: 400;
  118. font-size: 12px;
  119. color: #666666;
  120. }
  121. .list {
  122. .product-item {
  123. padding: 12px 10px 12px 0;
  124. margin-left: 10px;
  125. display: flex;
  126. align-items: center;
  127. align-content: center;
  128. background: #ffffff;
  129. border-bottom: 1px solid #DDDDDD;
  130. .product-info {
  131. flex: 1;
  132. margin-left: 20px;
  133. display: flex;
  134. flex-direction: column;
  135. .title {
  136. margin-bottom: 10px;
  137. font-weight: bold;
  138. font-size: 16px;
  139. color: #333333;
  140. }
  141. .price {
  142. font-weight: bold;
  143. font-size: 18px;
  144. color: #E3041F;
  145. text {
  146. font-weight: none;
  147. font-size: 12px;
  148. }
  149. }
  150. }
  151. }
  152. .box {
  153. background: #ffffff;
  154. margin-bottom: 10px;
  155. .bottom {
  156. display: flex;
  157. justify-content: space-between;
  158. align-items: center;
  159. padding: 10px;
  160. .status {
  161. font-weight: bolder;
  162. font-size: 12px;
  163. position: relative;
  164. padding-left: 7px;
  165. color: var(--color1);
  166. &::after {
  167. content: '';
  168. width: 4px;
  169. height: 4px;
  170. border-radius: 50%;
  171. background: var(--color1);
  172. position: absolute;
  173. left: 0;
  174. top: 6px;
  175. }
  176. }
  177. .change-date {
  178. font-weight: 400;
  179. font-size: 12px;
  180. color: #999999;
  181. }
  182. }
  183. }
  184. }
  185. }
  186. </style>