xuxueyang
2024-07-24 e7731f1cf08331d23cd0d27549025a2642caa9ab
sub_pages/customer/trade/list.vue
@@ -34,23 +34,29 @@
         <view v-else>
            <!-- 查询条件 -->
            <view class="component-filter-container">
               <view class="flex1">
                  等级<image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image>
          <view class="flex1" @click.stop="order_show=true">
            {{ this.query.columnStr || '排序' }}
            <image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image>
               </view>
               <view class="flex1">
                  等级<image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image>
          <view class="flex1" @click.stop="level_show=true">
            {{ this.query.levelStr || '级别' }}
            <image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"
            ></image>
               </view>
               <view class="flex1">
                  好卖家<image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image>
               </view>
               <view class="flex1">
                  颜色<image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image>
               </view>
               <view class="flex1">
                  筛选<image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image>
          <!--               <view class="flex1">-->
          <!--                  好卖家<image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image>-->
          <!--               </view>-->
          <!--               <view class="flex1">-->
          <!--                  颜色<image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image>-->
          <!--               </view>-->
          <view class="flex1" @click="showSelectParams" v-if="query.category">
            筛选
            <image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image>
               </view>
            </view>
         </view>
         <view class="component-shop-item flex" v-for="(item,index) of list" :key="index"
          @click="toDetail(item)">
            <view class="img">
@@ -110,6 +116,34 @@
      <footer-msg :more="page.total>0&&page.total>page.current*page.size"></footer-msg>
      
      
    <u-picker :show="level_show" @confirm="select_level" keyName="label" :columns="level_columns"
              @cancel="level_show=false"></u-picker>
    <u-picker :show="order_show" @confirm="select_order" keyName="label" :columns="order_columns"
              @cancel="order_show=false"></u-picker>
    <uni-popup ref="popup_param" type="bottom">
      <view class="component-popup_input_all" v-if="params">
        <view class="text-center m-b-40" style="font-size: 48rpx;font-weight: 600;">商品参数设置</view>
        <!-- 输入框-->
        <view v-for="(item,i) in params" :key="i" class="m-t-20">
          <view class="title topic-font" style="font-size: 40rpx;font-weight: 600;">{{ item.name }}</view>
          <view class="m-t-12 flex value-items">
            <view class="value-item" @click="updateValue(item,each)" :class="[item.value===each?'cur':'']"
                  v-for="(each, j) in item.values" :key="j">
              {{ each || '-' }}
            </view>
          </view>
        </view>
        <view class="button-space"></view>
        <view class="button-space"></view>
        <view class="button-green" style="background-color: #fff;bottom: 160rpx;color: #000"
              @click="closeParamPopAndQuery">
          查询
        </view>
        <view class="button-green" @click="closeParamPop">关闭</view>
      </view>
    </uni-popup>
   
   </view>
</template>
@@ -120,17 +154,55 @@
         return {
            query: {
               category: '',
        zoneId: '',
        levelStr: '',
        level: '',
        column: '',
        params: [],
        columnStr: '',
            },
      params: [],
            shoptotal:0,
            list:[{},{},{}]
      list: [],
      level_show: false,
      level_columns: [[]],
      order_show: false,
      order_columns: [[]]
         }
      },
      async onLoad(options) {
         // this.list = [{},{}]
         console.log('options', options)
         this.query.category = options.categoryId || ''
    this.query.zoneId = options.zoneId || ''
         this.listApi = '/api/customer/flower/list'
      this.getList()
    this.$http.request('get', '/api/code/value', {
      params: {
        type: 'FLOWER_LEVEL'
      }
    }).then(res => {
      var data = res.data
      this.level_columns = [data || []]
      this.columns_levels[0].unshift({
        label: '全部',
        value: ''
      })
    })
    this.$http.request('get', '/api/code/value', {
      params: {
        type: 'FLOWER_ORDER_BY'
      }
    }).then(res => {
      var data = res.data
      this.order_columns = [data || []]
      this.order_columns[0].unshift({
        label: '默认',
        value: ''
      })
    })
      // await this.getList('post')
         // this.
@@ -145,6 +217,58 @@
         uni.stopPullDownRefresh()
      },
      methods: {
    updateValue(item, value) {
      item.value = value
      this.$set(item, 'value', value)
      this.$forceUpdate()
    },
    closeParamPop() {
      this.$refs.popup_param.close()
    },
    closeParamPopAndQuery() {
      this.$refs.popup_param.close()
      //设置参数
      this.dto.params = []
      for (var params of this.params) {
        if (params.value) {
          this.dto.params.push({
            id: params.id,
            value: params.value
          })
        }
      }
      this.refreshList('post')
    },
    async showSelectParams() {
      //得有分类才有参数
      this.$message.showLoading()
      const res = await this.$http.request('get', '/api/supplier/flower/params', {
        params: {
          categoryId: this.dto.category
        }
      })
      this.$message.hideLoading()
      if (res.code === 0) {
        // this.columns_params = res.data || []
        this.dto.params = res.data || []
        this.$refs.popup_param.open()
      }
    },
    select_level(e) {
      this.level_show = false
      this.query.levelStr = e.value[0].label
      this.query.level = e.value[0].value
      this.refreshList('post')
    },
    select_order(e) {
      this.order_show = false
      this.query.columnStr = e.value[0].label
      this.query.column = e.value[0].value
      this.refreshList('post')
    },
         toDetail(item) {
            uni.navigateTo({
               url: `/sub_pages/customer/trade/detail?id=${item.id}`
@@ -209,6 +333,7 @@
            background: #FFFFFF;
            border-radius: 8rpx;
            min-width: 260rpx;
            .title {
               font-weight: 400;
               font-size: 24rpx;