From 0e3eae5a12cd0912c5accc792795cc1dbbf5c164 Mon Sep 17 00:00:00 2001 From: xuxueyang <xuxy@fengyuntec.com> Date: 星期五, 09 八月 2024 22:23:18 +0800 Subject: [PATCH] update 合伙人问题 --- sub_pages/customer/shop/shop.vue | 311 ++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 265 insertions(+), 46 deletions(-) diff --git a/sub_pages/customer/shop/shop.vue b/sub_pages/customer/shop/shop.vue index 4899b93..a3e0675 100644 --- a/sub_pages/customer/shop/shop.vue +++ b/sub_pages/customer/shop/shop.vue @@ -38,7 +38,7 @@ </view> <view class="tj-info m-t-12"> <view class="form-item"> - <view class="value">0</view> + <view class="value">{{page.total || 0}}</view> <view class="label">发布</view> </view> <view class="form-item"> @@ -63,60 +63,61 @@ <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" @click.stop="$refs.popup_column.open()"> + 排序{{ query.columnStr&&('-'+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> - <view class="flex1"> - 参数 + <view class="flex1" @click.stop="$refs.popup_level.open()"> + {{ query.levelStr || '级别' }} <image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image> </view> </view> - <view class="top-title"> + <view class="top-title m-t-12"> 报价已包含打包费、材料费、交易佣金 </view> <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="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/ff/fff3027bd0a146478fd1f0aae816a028%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20240710224139.png"> + <image class="img img100" :src="item.cover" lazy-load> </image> <view class="level"> - A级 + {{item.levelStr||''}} </view> </view> <view class="m-l-12 info-container flex1"> <view class="title"> - 橙色芭比 + {{item.name}} <view class="price"> - ¥6.60/扎 + ¥{{item.price}}/扎 </view> </view> <view class="shop-name"> - 牛油果泡泡·白色 + {{item.categoryStr}} </view> <view class="other-info flex"> <view class="m-r-15"> - 已售:7 + 已售:{{item.sales || 0}} </view> <view class="m-r-15"> - 剩余:13 + 剩余:{{item.stock || 0}} </view> <view class="m-r-15"> - 1支/扎 + {{item.unit}} </view> </view> <view class="bottom-buttons flex"> - + <view class="m-l-0 m-r-a"> + <view class="m-r-15 desc-gray other-info"> + 颜色:{{item.color||'-'}} + </view> + </view> <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> @@ -127,7 +128,10 @@ </view> <view v-if="flg==='1'" class="brand-info-1"> - <trade :hidefooter="true"></trade> + <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"> @@ -147,12 +151,63 @@ </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"> </view> + <view class="value">{{'已实名'}}</view> + </view> --> </view> </view> + <uni-popup ref="popup_column" type="bottom"> + <view class="component-popup_input_all"> + <view class="text-center m-b-40" style="font-size: 48rpx;font-weight: 600;">点击选择不同排序</view> + <view v-for="(item,i) in order_columns" :key="i" class="m-t-20"> + <view class="m-t-12 flex value-items"> + <view class="value-item" @click="()=>{ + if(each.value!==query.value){ + query.column = each.value + query.columnStr = each.label + refreshList('post') + $refs.popup_column.close() + } + }" :class="[query.column==each.value?'cur':'']" v-for="(each, j) in item" :key="j"> + {{ each.label || '-' }} + </view> + </view> + </view> + <view class="button-space"></view> + <view> + <view class="button-green" @click="$refs.popup_column.close()">关闭 + </view> + </view> + </view> + </uni-popup> - + <uni-popup ref="popup_level" type="bottom"> + <view class="component-popup_input_all"> + <view class="text-center m-b-40" style="font-size: 48rpx;font-weight: 600;">点击选择不同级别</view> + <view v-for="(item,i) in level_columns" :key="i" class="m-t-20"> + <view class="m-t-12 flex value-items"> + <view class="value-item" @click="()=>{ + if(each.value!==query.value){ + query.level = each.value + query.levelStr = each.label + refreshList('post') + $refs.popup_level.close() + } + }" :class="[query.level==each.value?'cur':'']" v-for="(each, j) in item" :key="j"> + {{ each.label || '-' }} + </view> + </view> + </view> + <view class="button-space"></view> + <view> + <view class="button-green" @click="$refs.popup_level.close()">关闭 + </view> + </view> + </view> + </uni-popup> </view> </template> @@ -182,36 +237,135 @@ }, ], dto: {}, - list: [{}, {}], + list: [], id: '', + catgoryTree: undefined, + query: { + columnStr: '', + column: '', + levelStr: '', + level: '', + }, + level_show: false, + level_columns: [ + [] + ], + + order_show: false, + order_columns: [ + [] + ] } }, onLoad(options) { this.id = options.id || '' + // this.page.size = if (this.id) { this.getDetail() } + this.listApi = `/api/customer/flower/list` + this.query.supplierId = this.id + this.getList('post') + this.$http.request('get', '/api/code/value', { + params: { + type: 'FLOWER_LEVEL' + } + }).then(res => { + var data = res.data + this.level_columns = [data || []] + this.level_columns[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: '' + }) + }) + }, + // #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() - const { - code, - data - } = await this.$http.request('get', `/api/pub/supplier/detail/${this.id}`, { - params: {} - }) - if (code === 0) { - this.dto = { - ...data, - } - } - this.$message.hideLoading() + async getDetail() { + { + this.$message.showLoading() + const { + code, + data + } = await this.$http.request('get', `/api/pub/supplier/detail/${this.id}`, { + params: {} + }) + if (code === 0) { + this.dto = { + ...data, + } + } + + this.$message.hideLoading() + } + //获取商家下的商品列表 + + // { + // this.$message.showLoading() + // const { + // code, + // data + // } = await this.$http.request('post', `/api/customer/flower/list`, { + // data: { + // supplierId: this.id, + // size: 20 + // } + // }) + // if (code === 0) { + // this.list = data.records || [] + // } + + // this.$message.hideLoading() + // } }, //update 关注 async updateGz(type) { + if (!this.currentInfo.id) { + this.$message.showToast('请先登录') + return + } this.$message.showLoading() const { code @@ -232,16 +386,64 @@ }, - changeTab(flg) { + async changeTab(flg) { console.log('changeTab', flg) - this.flg = ''+flg + if ('1' === ('' + flg)) { + if (!this.catgoryTree) { + this.$message.showLoading() + const { + code, + data + } = await this.$http.request('get', `/api/customer/flower/category/tree`, { + data: { + supplierId: this.dto.supplierId || this.dto.id + }, + params: { + supplierId: this.dto.supplierId || this.dto.id + } + }) + if (code === 0) { + // data 分类树 + this.catgoryTree = data || [] + let tmp = this + this.$nextTick(() => { + tmp.$refs.trade.refInit(tmp.catgoryTree) + }) + } + this.$message.hideLoading() + } + } + 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('请前往登录') @@ -253,6 +455,13 @@ if (!item.shopnum) { item.shopnum = 0 } + if (!item.stock) { + item.stock = 0 + } + if (addnum > 0 & item.shopnum + addnum > item.stock) { + this.$message.showToast('库存不足,无法修改') + return + } if (item.shopnum + addnum >= 0) { } else { @@ -261,7 +470,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 @@ -270,10 +479,15 @@ this.$message.hideLoading() if (code === 0) { item.shopnum += addnum + this.$forceUpdate() } - this.$forceUpdate() }, + toDetail(item) { + uni.navigateTo({ + url: `/sub_pages/customer/trade/detail?id=${item.id}` + }) + }, } } </script> @@ -305,8 +519,14 @@ } } + .brand-info-1 { + // padding: 40rpx 30rpx; + + } + .brand-info-3 { padding: 40rpx 30rpx; + .title { font-weight: 600; font-size: 32rpx; @@ -318,22 +538,21 @@ .form-input { display: flex; border-bottom: 2rpx solid #EEEEEE; + line-height: 80rpx; .label { font-weight: 600; font-size: 28rpx; color: #000000; - line-height: 40rpx; } .value { font-weight: 400; font-size: 28rpx; color: #666666; - line-height: 40rpx; margin-left: auto; margin-right: 0; - + text-align: right; .check { -- Gitblit v1.9.3