xuxueyang
2024-08-06 623859790a3f074c103c792e5eaca33b199dbb91
sub_pages/customer/shop/shop.vue
@@ -63,7 +63,7 @@
      <view class="brand-info">
         <view v-if="flg==='0'" class="brand-info-0">
            <view class="component-filter-container" style="padding-top: 12rpx;">
               <view class="flex1">
               <!-- <view class="flex1">
                  排序
                  <image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image>
               </view>
@@ -74,7 +74,7 @@
               <view class="flex1">
                  参数
                  <image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image>
               </view>
               </view> -->
            </view>
            <view class="top-title">
               报价已包含打包费、材料费、交易佣金
@@ -82,8 +82,7 @@
            <view class="component-shop-item flex" v-for="(item,index) of list" :key="index"
               @click.stop="toDetail(item)">
               <view class="img">
                  <image class="img img100"
                     :src="item.cover" lazy-load>
                  <image class="img img100" :src="item.cover" lazy-load>
                  </image>
                  <view class="level">
                     {{item.levelStr||''}}
@@ -120,7 +119,9 @@
                     <view class="icons flex">
                        <uni-icons v-if="item.shopnum&&item.shopnum>=1" type="minus" size="32"
                           @click.stop="addnum(item,-1)"></uni-icons>
                        <view class="curnums" v-if="item.shopnum&&item.shopnum>=1">{{ item.shopnum }}</view>
                        <view class="curnums" @click="updateItemNum(item)" v-if="item.shopnum&&item.shopnum>=1">
                           {{ item.shopnum }}
                        </view>
                        <uni-icons v-if="!item.shopnum||item.shopnum<=99" type="plus-filled" size="32"
                           @click.stop="addnum(item,1)"></uni-icons>
                     </view>
@@ -134,7 +135,7 @@
            <trade :hidefooter="true" :catgoryTree="catgoryTree" v-if="catgoryTree" ref="trade"></trade>
            <!-- // 构建一个分类树 -->
            <!-- catgoryTree -->
         </view>
         <view v-if="flg==='2'" class="brand-info-3">
            <view class="title">
@@ -154,8 +155,12 @@
            </view>
            <view class="form-input flex">
               <view class="label">身份认证</view>
               <view class="value">个人身份认证</view>
               <view class="value">{{dto.idcardTypeStr||'未认证'}}</view>
            </view>
            <!--    <view class="form-input flex">
               <view class="label">&nbsp;&nbsp;</view>
               <view class="value">{{'已实名'}}</view>
            </view> -->
         </view>
      </view>
@@ -191,7 +196,7 @@
            dto: {},
            list: [],
            id: '',
            catgoryTree:undefined,
            catgoryTree: undefined,
         }
      },
      onLoad(options) {
@@ -200,16 +205,41 @@
         if (this.id) {
            this.getDetail()
         }
         this.listApi =  `/api/customer/flower/list`
         this.query.supplierId = this.id
         this.listApi = `/api/customer/flower/list`
         this.query.supplierId = this.id
         this.getList('post')
      },
      onReachBottom(){
         if(this.flg==='0'){
      // #ifdef PUB_CUSTOMER
      onShareAppMessage() {
         let that = this;
         var name = that.currentInfo.customerDTO && that.currentInfo.customerDTO.name || that.currentInfo.supplierDTO &&
            that.currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && that.currentInfo.partnerDTO.name || ''
         var url =
            `/sub_pages/customer/shop/shop?id=${this.id}&shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数
         return {
            title: this.dto.id && this.dto.name ? (this.dto.name + " 的店铺") : "花满芫",
            path: url,
         }
      },
      onShareTimeline() {
         let that = this;
         var name = that.currentInfo.customerDTO && that.currentInfo.customerDTO.name || that.currentInfo.supplierDTO &&
            that.currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && that.currentInfo.partnerDTO.name || ''
         var url =
            `/sub_pages/customer/shop/shop?id=${this.id}&shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数
         return {
            title: this.dto.id && this.dto.name ? (this.dto.name + " 的店铺") : "花满芫",
            path: url,
         }
      },
      // #endif
      onReachBottom() {
         if (this.flg === '0') {
            this.getMore('post')
         }
      },
      methods: {
         async getDetail() {
            {
               this.$message.showLoading()
@@ -249,10 +279,10 @@
         },
         //update 关注
         async updateGz(type) {
            if(!this.currentInfo.id){
               this.$message.showToast('请先登录')
               return
         async updateGz(type) {
            if (!this.currentInfo.id) {
               this.$message.showToast('请先登录')
               return
            }
            this.$message.showLoading()
            const {
@@ -276,11 +306,12 @@
         },
         async changeTab(flg) {
            console.log('changeTab', flg)
            if('1'===(''+flg)){
               if(!this.catgoryTree){
            if ('1' === ('' + flg)) {
               if (!this.catgoryTree) {
                  this.$message.showLoading()
                  const {
                     code,data
                     code,
                     data
                  } = await this.$http.request('get', `/api/customer/flower/category/tree`, {
                     data: {
                        supplierId: this.dto.supplierId || this.dto.id
@@ -293,7 +324,7 @@
                     // data 分类树
                     this.catgoryTree = data || []
                     let tmp = this
                     this.$nextTick(()=>{
                     this.$nextTick(() => {
                        tmp.$refs.trade.refInit(tmp.catgoryTree)
                     })
                  }
@@ -302,13 +333,35 @@
            }
            this.flg = '' + flg
            //如果没有加载数据,需要加载一下
         },
         buttonSearchFlow() {
         },
         async updateItemNum(item) {
            const res = await this.$message.confirm('', {
               editable: true,
               title: '请输入想要购买的数量'
            })
            if (res.content && res.confirm) {
               // 发送请求
               var t = parseInt(res.content)
               if (isNaN(t) || t < 0) {
                  this.$message.showToast('数目需要大于等于0')
               } else {
                  if (!item.stock || t > item.stock) {
                     this.$message.showToast('库存不足无法修改')
                     return
                  }
                  this.addnum(item, (t - item.shopnum))
               }
            } else {
            }
         },
         async addnum(item, addnum) {
            if (!this.currentInfo.id) {
               await this.$message.confirm('请前往登录')
@@ -319,13 +372,13 @@
            }
            if (!item.shopnum) {
               item.shopnum = 0
            }
            if (!item.stock) {
               item.stock = 0
            }
            if (item.shopnum + addnum > item.stock) {
               this.$message.showToast('库存不足,无法添加')
               return
            }
            if (!item.stock) {
               item.stock = 0
            }
            if (addnum > 0 & item.shopnum + addnum > item.stock) {
               this.$message.showToast('库存不足,无法修改')
               return
            }
            if (item.shopnum + addnum >= 0) {
@@ -335,7 +388,7 @@
            this.$message.showLoading()
            const {
               code
            } = await http.request('post', '/api/customer/flower/cart/change-num', {
            } = await this.$http.request('post', '/api/customer/flower/cart/change-num', {
               data: {
                  id: item.id,
                  num: addnum
@@ -343,7 +396,7 @@
            })
            this.$message.hideLoading()
            if (code === 0) {
               item.shopnum += addnum
               item.shopnum += addnum
               this.$forceUpdate()
            }
         },
@@ -378,10 +431,12 @@
               padding-left: 20rpx;
            }
         }
         .brand-info-1{
         .brand-info-1 {
            // padding: 40rpx 30rpx;
         }
         .brand-info-3 {
            padding: 40rpx 30rpx;