index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. <navigator @click="goDetail" :url="'/cloud/commodityAdjustment/detail?id='+item.sa_fadid" class="product-item" v-for="item in list" :key="item.sa_fadid">
  18. <u-image :src="item.attinfos.length ? item.attinfos[0].url:''" :width="tovw(86)" :height="tovw(80)" :lazy-load="true" radius="5"></u-image>
  19. <view class="product-info">
  20. <text class="title u-line-1">{{ item.name }}</text>
  21. <text class="price"><text style="margin-right: 2px;">¥</text>{{ CNY(item.pricetype != '阶梯价' ? item.price : item.price_deposit,'') }}<text style="margin-left: 2px;">元</text></text>
  22. </view>
  23. </navigator>
  24. </My_listbox>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. data () {
  31. return {
  32. list:[],
  33. content: {
  34. "sys_enterpriseid": uni.getStorageSync('shop').sys_enterpriseid, //门店信息中获取
  35. "pageNumber": 1,
  36. "pageSize": 20,
  37. "where": {
  38. "condition": "",
  39. "class": ""
  40. }
  41. },
  42. typeList:[],
  43. tabsActive: 0,
  44. total:0
  45. }
  46. },
  47. methods: {
  48. goDetail () {
  49. this.$Http.editProduct = function (id){
  50. this.getList (true)
  51. delete this.$Http.editProduct
  52. }.bind(this)
  53. },
  54. onSearch (condition) {
  55. this.content.where.condition = condition
  56. this.getList(true)
  57. },
  58. changeClass(index) {
  59. this.tabsActive = index;
  60. this.content.where.class = this.typeList[index].value;
  61. this.getList(true);
  62. },
  63. getList(init = false) {
  64. return new Promise((resolve, reject) => {
  65. if (this.paging(this.content, init)) return resolve();
  66. this.$Http.basic({
  67. "id": "20240515153202",
  68. content: this.content
  69. }).then(res => {
  70. this.total = res.total
  71. this.$refs.List.setHeight()
  72. this.$refs.List.RefreshToComplete()
  73. resolve();
  74. if (this.cutoff(res.msg)) return;
  75. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
  76. console.log("获取商品列表", this.list)
  77. this.content = this.$refs.List.paging(this.content, res)
  78. })
  79. })
  80. },
  81. async getType () {
  82. this.getCustomClass("goodstype").then(list => {
  83. console.log("分类列表", list)
  84. this.typeList = list;
  85. this.typeList.unshift({remarks:'全部',value:''})
  86. this.getList()
  87. })
  88. },
  89. onLoad () {
  90. uni.setNavigationBarTitle({
  91. title:'商品调整',
  92. })
  93. this.getType()
  94. }
  95. },
  96. }
  97. </script>
  98. <style lang="scss">
  99. .product {
  100. box-sizing: border-box;
  101. font-family: Source Han Sans SC, Source Han Sans SC;
  102. .tabs-box {
  103. margin-top: 10px;
  104. }
  105. .header-line {
  106. display: flex;
  107. justify-content: space-between;
  108. align-items: center;
  109. align-content: center;
  110. padding: 10px;
  111. font-weight: 400;
  112. font-size: 12px;
  113. color: #666666;
  114. }
  115. .list {
  116. .product-item {
  117. padding: 12px 10px;
  118. display: flex;
  119. align-items: center;
  120. align-content: center;
  121. background: #ffffff;
  122. margin-bottom: 10px;
  123. .product-info {
  124. flex: 1;
  125. margin-left: 20px;
  126. display: flex;
  127. flex-direction: column;
  128. .title {
  129. margin-bottom: 10px;
  130. font-weight: bold;
  131. font-size: 16px;
  132. color: #333333;
  133. }
  134. .price {
  135. font-weight: bold;
  136. font-size: 18px;
  137. color: #E3041F;
  138. text {
  139. font-weight: none;
  140. font-size: 12px;
  141. }
  142. }
  143. }
  144. }
  145. }
  146. }
  147. </style>