From e8d258576a34f35cfefbd6bfe07b7f22e72d87d4 Mon Sep 17 00:00:00 2001 From: 陶杰 <1378534974@qq.com> Date: 星期三, 11 九月 2024 10:42:57 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/v2' into v2 --- sub_pages/customer/trade/list.vue | 1228 +++++----- sub_pages/customer/self/history.vue | 8 sub_pages/customer/self/collect.vue | 7 package.json | 75 sub_pages/customer/shop/shop.vue | 1541 ++++++------ sub_pages/customer/shopping/confirm.vue | 4 sub_pages/customer/trade/trade.vue | 992 ++++---- pages/user/supplier-user.vue | 1346 +++++----- sub_pages/customer/trade/detail.vue | 1618 +++++++------- 9 files changed, 3,381 insertions(+), 3,438 deletions(-) diff --git a/package.json b/package.json index 192b117..4647904 100644 --- a/package.json +++ b/package.json @@ -1,27 +1,27 @@ -{ - "uni-app": { - "scripts": { - "supplier": { - "title": "花农/供应商-小程序", - "BROWSER": "Chrome", - "env": { - "UNI_PLATFORM": "mp-weixin", - "PUB_TYPE": "supplier" - }, - "define": { - "PUB_SUPPLIER": true - } - }, - "partner": { - "title": "合伙人-小程序", - "BROWSER": "Chrome", - "env": { - "UNI_PLATFORM": "mp-weixin", - "PUB_TYPE": "partner" - }, - "define": { - "PUB_PARTNER": true - } +{ + "uni-app": { + "scripts": { + "supplier": { + "title": "花农/供应商-小程序", + "BROWSER": "Chrome", + "env": { + "UNI_PLATFORM": "mp-weixin", + "PUB_TYPE": "supplier" + }, + "define": { + "PUB_SUPPLIER": true + } + }, + "partner": { + "title": "合伙人-小程序", + "BROWSER": "Chrome", + "env": { + "UNI_PLATFORM": "mp-weixin", + "PUB_TYPE": "partner" + }, + "define": { + "PUB_PARTNER": true + } }, "customer":{ "title": "花店/用户-小程序", @@ -42,19 +42,18 @@ "PUB_TYPE": "customer" }, "define": { - "PUB_CUSTOMER": true, - "PUB_CUSTOMER_DEV": true + "PUB_CUSTOMER": true } - } - - } - }, - "dependencies": { - "moment": "^2.30.1", - "uview-ui": "^2.0.36" - }, - "devDependencies": { - "sass": "^1.77.6", - "sass-loader": "^10.5.2" - } + } + + } + }, + "dependencies": { + "moment": "^2.30.1", + "uview-ui": "^2.0.36" + }, + "devDependencies": { + "sass": "^1.77.6", + "sass-loader": "^10.5.2" + } } \ No newline at end of file diff --git a/pages/user/supplier-user.vue b/pages/user/supplier-user.vue index 8e66cea..ab64e5b 100644 --- a/pages/user/supplier-user.vue +++ b/pages/user/supplier-user.vue @@ -1,675 +1,675 @@ -<template> - <view class="main-container user-container"> - <!-- <view> - 我的 - </view> --> - <!-- 背景图 --> - <view class="top-bg img100 relative" :style="{'padding-top':(StatusBar)+'px','line-height':CustomBar+'rpx' }"> - <image class="component-bg" - src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/21/21c95c14e9504be69edff7785e3b44a9bg.png" - mode="scaleToFill" /> - - <view class="title" style="position: relative;"> - 个人中心 - - </view> - <!-- v-if="currentInfo&&(currentInfo.id)" --> - <view class="flex user-info"> - <!-- 头像 --> - - <image class="user-icon" v-if=" - currentInfo.customerDTO&¤tInfo.customerDTO.cover - ||currentInfo.supplierDTO&¤tInfo.supplierDTO.cover - || currentInfo.picture - " :src=" - currentInfo.customerDTO&¤tInfo.customerDTO.cover - ||currentInfo.supplierDTO&¤tInfo.supplierDTO.cover - || currentInfo.picture - " mode="scaleToFill"></image> - <image class="user-icon" v-else - src='https://youzhen123.oss-cn-huhehaote.aliyuncs.com/WechatOwnerProperty/images/mrtx.png' - mode="scaleToFill"></image> - - <view class="name" v-if="currentInfo.id"> - <view class="t1"> - {{ - (!!currentInfo.partnerDTO ? (currentInfo.partnerDTO.name) : "") || (!!currentInfo.supplierDTO ? (currentInfo.supplierDTO.name) : "") || (!!currentInfo.customerDTO ? (currentInfo.customerDTO.name) : "") || currentInfo.nickName || currentInfo.loginName || '-' - }} - <span v-if="currentInfo.supplierDTO&¤tInfo.supplierDTO.status!=='P'"> - ({{ currentInfo.supplierDTO ? currentInfo.supplierDTO.statusStr : '' }})</span> - <span v-if="currentInfo.partnerDTO&¤tInfo.partnerDTO.status!=='P'"> - ({{ currentInfo.partnerDTO ? currentInfo.partnerDTO.statusStr : '' }})</span> - - <!-- #ifdef PUB_CUSTOMER_DEV --> - <span class="member-level" @click="goto('/sub_pages/customer/self/member-center',true)" - v-if="currentInfo&¤tInfo.customerDTO&¤tInfo.customerDTO.userGrowthRecord"> - <view v-if="currentInfo.customerDTO.userGrowthRecord.currentMemberLevel=='普通会员'" class="v1"> +<template> + <view class="main-container user-container"> + <!-- <view> + 我的 + </view> --> + <!-- 背景图 --> + <view class="top-bg img100 relative" :style="{'padding-top':(StatusBar)+'px','line-height':CustomBar+'rpx' }"> + <image class="component-bg" + src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/21/21c95c14e9504be69edff7785e3b44a9bg.png" + mode="scaleToFill" /> + + <view class="title" style="position: relative;"> + 个人中心 + + </view> + <!-- v-if="currentInfo&&(currentInfo.id)" --> + <view class="flex user-info"> + <!-- 头像 --> + + <image class="user-icon" v-if=" + currentInfo.customerDTO&¤tInfo.customerDTO.cover + ||currentInfo.supplierDTO&¤tInfo.supplierDTO.cover + || currentInfo.picture + " :src=" + currentInfo.customerDTO&¤tInfo.customerDTO.cover + ||currentInfo.supplierDTO&¤tInfo.supplierDTO.cover + || currentInfo.picture + " mode="scaleToFill"></image> + <image class="user-icon" v-else + src='https://youzhen123.oss-cn-huhehaote.aliyuncs.com/WechatOwnerProperty/images/mrtx.png' + mode="scaleToFill"></image> + + <view class="name" v-if="currentInfo.id"> + <view class="t1"> + {{ + (!!currentInfo.partnerDTO ? (currentInfo.partnerDTO.name) : "") || (!!currentInfo.supplierDTO ? (currentInfo.supplierDTO.name) : "") || (!!currentInfo.customerDTO ? (currentInfo.customerDTO.name) : "") || currentInfo.nickName || currentInfo.loginName || '-' + }} + <span v-if="currentInfo.supplierDTO&¤tInfo.supplierDTO.status!=='P'"> + ({{ currentInfo.supplierDTO ? currentInfo.supplierDTO.statusStr : '' }})</span> + <span v-if="currentInfo.partnerDTO&¤tInfo.partnerDTO.status!=='P'"> + ({{ currentInfo.partnerDTO ? currentInfo.partnerDTO.statusStr : '' }})</span> + + <!-- #ifdef PUB_CUSTOMER --> + <span class="member-level" @click="goto('/sub_pages/customer/self/member-center',true)" + v-if="currentInfo&¤tInfo.customerDTO&¤tInfo.customerDTO.userGrowthRecord"> + <view v-if="currentInfo.customerDTO.userGrowthRecord.currentMemberLevel=='普通会员'" class="v1"> <image class="member-icon" - src="../../static/images/customer/coupon/member/icon-member-1.png"></image> - {{currentInfo.customerDTO.userGrowthRecord.currentMemberLevel}} - <uni-icons color="#7CC662" type="right" size="18"></uni-icons> - - </view> - <view v-else-if="currentInfo.customerDTO.userGrowthRecord.currentMemberLevel=='银卡会员'" class="v2"> - <image class="member-icon v2" - src="../../static/images/customer/coupon/member/icon-member-2.png"></image> - {{currentInfo.customerDTO.userGrowthRecord.currentMemberLevel}} - <uni-icons color="#7498E0" type="right" size="18"></uni-icons> - - </view> - <view v-else-if="currentInfo.customerDTO.userGrowthRecord.currentMemberLevel=='金卡会员'" class="v3"> - <image class="member-icon v3" - src="../../static/images/customer/coupon/member/icon-member-3.png"></image> - {{currentInfo.customerDTO.userGrowthRecord.currentMemberLevel}} - <uni-icons color="#C47810" type="right" size="18"></uni-icons> - </view> - <view v-else class="v4"> - <image class="member-icon v4" - src="../../static/images/customer/coupon/member/icon-member-4.png"></image> - {{currentInfo.customerDTO.userGrowthRecord.currentMemberLevel}} - <uni-icons color="#DD834E" type="right" size="18"></uni-icons> - </view> - - - </span> - <!-- #endif --> - </view> - <view class="t2">{{ currentInfo.tel || '暂无电话' }}</view> - </view> - <view class="name" v-if="!currentInfo.id" open-type="getUserInfo" @click.stop="toCustomerLogin" - style="font-size: 48rpx;margin-top: 16rpx;"> - <!-- getUserProfile --> - {{ '点击登陆/注册' }} - </view> - <image class="icon-setting" @click="toInfo" src="../../static/common/icon-setting.png" mode="aspectFit"> - </image> - </view> - <!-- #ifdef PUB_CUSTOMER --> - <view class="customer-info-records"> - <view class="item" @click="goto('/sub_pages/customer/self/collect',true)"> - <view class="num">{{ tj.collectNum || 0 }} - </view> - <view class="name">我的收藏</view> - </view> - <view class="line"></view> - <view class="item" @click="goto('/sub_pages/customer/self/follow',true)"> - <view class="num">{{ tj.followNum || 0 }} - </view> - <view class="name">关注店铺</view> - </view> - <view class="line"></view> - <view class="item" @click="goto('/sub_pages/customer/self/history',true)"> - <view class="num">{{ tj.browseNum || 0 }}</view> - <view class="name">浏览记录</view> - </view> - </view> - <!-- #endif --> - - - </view> - - <!-- #ifdef PUB_CUSTOMER_DEV --> - <view class="m-20 coupon-info-container" @click="goto( `/sub_pages/customer/coupon/good-all`,true)" - v-if="selftype==='customer'||!selftype"> - <view> - <view class="title">积分商城</view> - <view class="score m-t-8">拥有积分:{{currentInfo.currentPoint || 0}}</view> - </view> - <view class="button m-l-a m-r-0 m-t-12"> - 去兑换 <uni-icons color="#ffffff" type="right" size="16"></uni-icons> - </view> - </view> - <!-- #endif --> - <!-- #ifdef PUB_CUSTOMER --> - - - <view class="user-utils m-20 user-customer-order-infos" v-if="selftype==='customer'||!selftype"> - <view class="user-util m-t-12"> - <view class="title flex"> - <view class="flex1">我的订单</view> - <view class="m-r-a m-r-0 more" @click="goto('/pages/order/order',true)">全部订单 - <uni-icons class="" type="right" size="12"></uni-icons> - </view> - </view> - - <view class="flex order-icons-container"> - <view class="order-icons" style="position: relative;" - @click="goto('/pages/order/order?status=PENDING',true)"> - <image src="../../static/images/customer/order/order-type-1.png" class="order-icon dfk" - style="position: relative;"> - <view class="image-shop-number" v-if="tj_order.pendingCount">{{tj_order.pendingCount||''}} - </view> - </image> - <view>待付款</view> - </view> - <view class="order-icons" @click="goto('/pages/order/order?status=SEND',true)"> - <image src="../../static/images/customer/order/order-type-2.png" class="order-icon dfh" - style="position: relative;"> - <view class="image-shop-number" v-if="tj_order.sendCount">{{tj_order.sendCount||''}}</view> - - </image> - <view>待发货</view> - </view> - <view class="order-icons" @click="goto('/pages/order/order?status=RECEIVE',true)"> - <image src="../../static/images/customer/order/order-type-3.png" class="order-icon dsh" - style="position: relative;"> - <view class="image-shop-number" v-if="tj_order.receiveCount">{{tj_order.receiveCount||''}} - </view> - - </image> - <view>待收货</view> - </view> - <view class="order-icons" @click="goto('/pages/order/order?status=EVALUATE',true)"> - <image src="../../static/images/customer/order/order-type-4.png" class="order-icon dpj" - style="position: relative;"> - <view class="image-shop-number" v-if="tj_order.evaluateCount">{{tj_order.evaluateCount||''}} - </view> - - </image> - <view>待评价</view> - </view> - <view class="order-icons" @click="goto('/pages/order/order-sale/order-sale',true)"> - <image src="../../static/images/customer/order/order-type-5.png" class="order-icon sh" - style="position: relative;"> - <view class="image-shop-number" v-if="tj_order.salesPendingCount"> - {{tj_order.salesPendingCount||''}} - </view> - - </image> - <view>售后</view> - </view> - </view> - </view> - </view> - <view class="user-utils m-20" v-if="selftype==='customer'||!selftype"> - <view class="user-util m-t-12 user-customer-service-infos"> - <view class="title flex"> - <view>我的服务</view> - </view> - <view class="flex service-icons-container"> - <view class="service-icons" @click="goto('/sub_pages/customer/self/follow',true)"> - <image src="../../static/images/customer/service/service-icon-1.png" class="service-icon "> - </image> - <view>关注店铺</view> - </view> - <view class="service-icons" @click="goto('/sub_pages/customer/self/collect',true)"> - <image src="../../static/images/customer/service/service-icon-2.png" class="service-icon "> - </image> - <view>我的收藏</view> - </view> - <view class="service-icons" @click="goto('/pages/user/address/address',true)"> - <image src="../../static/images/customer/service/service-icon-3.png" class="service-icon "> - </image> - <view>地址管理</view> - </view> - <view class="service-icons" @click="goto('/pages/help/content?id=售后规则',false)"> - <image src="../../static/images/customer/service/service-icon-4.png" class="service-icon "> - </image> - <view>售后规则</view> - </view> - </view> - <view class="flex service-icons-container"> - <view class="service-icons" @click="goto('/pages/help/content?id=新手帮助',false)"> - <image src="../../static/images/customer/service/service-icon-5.png" class="t2 service-icon "> - </image> - <view>新手帮助</view> - </view> - <view class="service-icons" @click="goto('/sub_pages/customer/self/feedback',true)"> - <image src="../../static/images/customer/service/service-icon-7.png" class="t2 service-icon "> - </image> - <view>投诉反馈</view> - </view> - <!-- #ifdef PUB_CUSTOMER_DEV --> - <view class="service-icons" @click="goto('/sub_pages/customer/coupon/coupon-self',true)"> - <image src="../../static/images/customer/service/service-icon-8.png" class="t2 service-icon "> - </image> - <view>优惠券</view> - </view> - - <view class="service-icons" @click="goto('/sub_pages/customer/coupon/good-self',true)"> - <image src="../../static/images/customer/service/service-icon-9.png" class="t2 service-icon "> - </image> - <view>兑换券</view> - </view> - <!-- #endif --> - <!-- #ifndef PUB_CUSTOMER_DEV --> - <view class="service-icons"> - - </view> - - <view class="service-icons"> - - </view> - <!-- #endif --> - </view> - </view> - </view> - <!-- #endif --> - <view class="user-utils m-20"> - <view class="user-util m-t-12 flex" v-if="selftype==='customer'||!selftype" - @click="goto('/sub_pages/customer/customer-info/customer-info',true)"> - <view class="title">个人信息</view> - <view class="right-icon"> - <uni-icons type="right"></uni-icons> - </view> - </view> - <view class="user-util m-t-12 flex" v-if="selftype==='partner'" - @click="goto('/sub_pages/partner/partner-info/partner-info',true)"> - <view class="title">合伙人信息</view> - <view class="right-icon"> - <uni-icons type="right"></uni-icons> - </view> - </view> - <!-- #ifdef PUB_PARTNER --> - <view class="user-util m-t-12 flex" - v-if="selftype==='partner'&¤tInfo.partnerDTO&¤tInfo.partnerDTO.id&¤tInfo.partnerDTO.status=='P'" - @click="goto('/sub_pages/partner/partner-info/partner-code',true)"> - <view class="title">推广的注册二维码</view> - <view class="right-icon"> - <uni-icons type="right"></uni-icons> - </view> - </view> - <!-- <view class="user-util m-t-12 flex" v-if="selftype==='partner'" - @click="goto('/sub_pages/partner/partner-info/partner-code-v2',true)"> - <view class="title">测试二维码</view> - <view class="right-icon"> - <uni-icons type="right"></uni-icons> - </view> - </view> --> - <!-- #endif --> - <!-- #ifdef PUB_CUSTOMER --> - <view class="user-util m-t-12 flex" - v-if="(selftype==='customer'||!selftype)&¤tInfo.id&¤tInfo.customerDTO&&!currentInfo.customerDTO.partnerId" - @click="scanPartnerCode"> - <view class="title">扫码绑定合伙人</view> - <view class="right-icon"> - <uni-icons type="right"></uni-icons> - </view> - </view> - <!-- #endif --> - <view class="user-util m-t-12 flex" - v-if="selftype==='supplier'&¤tInfo&¤tInfo.id&¤tInfo.supplierDTO&¤tInfo.supplierDTO.status==='P'" - @click="goto('/sub_pages/supplier/supplier-info/supplier-info-update',true)"> - <view class="title">信息维护</view> - <view class="right-icon"> - <uni-icons type="right"></uni-icons> - </view> - </view> - <view class="user-util m-t-12 flex" v-if="selftype==='supplier'" - @click="goto('/sub_pages/supplier/supplier-info/supplier-info',true)"> - <view class="title">店铺信息</view> - <view class="right-icon"> - <uni-icons type="right"></uni-icons> - </view> - </view> - - <view class="user-util m-t-12 flex" @click="goto('/pages/user/user-pwd/user-pwd',true)"> - <view class="title">修改密码</view> - <view class="right-icon"> - <uni-icons type="right"></uni-icons> - </view> - </view> - - <!-- <view class="user-util m-t-12 flex" @click="goto('/sub_pages/partner/delivery/delivery-detail',true)"> - <view class="title">debug</view> - <view class="right-icon"> - <uni-icons type="right"></uni-icons> - </view> - </view> --> - <view class="user-util m-t-12 flex" v-if="currentInfo&¤tInfo.id" - @click="goto('/pages/user/user-bind-wx/user-bind-wx',true)"> - <view class="title">绑定当前微信</view> - <view class="right-icon"> - <uni-icons type="right"></uni-icons> - </view> - </view> - <!-- <view class="user-util m-t-12 flex" @click="goto('/sub_pages/customer/self/feedback',true)"> - <view class="title">投诉反馈</view> - <view class="right-icon"> - <uni-icons type="right"></uni-icons> - </view> - </view> --> - - <!-- v-if="selftype==='customer'" --> - <view class="user-util m-t-12 flex" @click="clearlogout"> - <view class="title">退出登录</view> - <view class="right-icon"> - <uni-icons type="right"></uni-icons> - </view> - </view> - - - - - - <view class="user-util m-t-12 " v-if="selftype==='supplier'||selftype==='customer' || !selftype"> - <view class="title">我的客服</view> - <view class="flex flex-wrap-normal"> - <image class="icon-clock m-r-6 m-t-2" src="../../static/common/icon-call.png"></image> - <!-- @click="callTel" --> - <button open-type="contact" class="component-button-contact" @handleContact="handleContact"> - <view class="name"> - 客服电话 : <span class="topic-gray">{{ tel }}</span> - </view> - <view class="right-icon"> - <uni-icons type="right"></uni-icons> - </view> - </button> - - </view> - </view> - <!-- <view class="user-util m-t-12 " @click="callTel" v-if="selftype==='partner'"> - <view class="name"> - 账号: <span class="topic-gray">{{tel}}</span> - </view> - <view class="name"> - 密码: <span class="topic-gray">{{tel}}</span> - </view> - </view> --> - </view> - - - <!-- #ifdef PUB_CUSTOMER --> - <view style="padding-bottom:140rpx"> - </view> - <common-footer flg="3"></common-footer> - - <uni-popup ref="popup_info" type="bottom"> - <view class="popup-form"> - - <view class="infocontainar"> - <cu-custom bgColor="none" :isBack="false"> - <block slot="content"><span style="color: #333;font-weight: 400;">获取用户头像、昵称</span></block> - </cu-custom> - - - <view class="avatarUrl"> - <button type="balanced" open-type="chooseAvatar" @chooseavatar="onChooseavatar"> - <image :src="regAvatarUrl" class="refreshIcon"></image> - </button> - </view> - <view class="userName"> - <text style="padding-bottom: 20rpx;">修改昵称:</text> - <input :clearable="false" type="nickname" class="weui-input" :value="regUserName" - @blur="onBindblur" placeholder="请输入昵称" @input="onBindinput" /> - </view> - - <view style="width: 100%;height: 1px; background: #EEE;"> - - </view> - <view style="width: 700rpx; height: 20px; font-size: 13px; margin: auto; margin-top: 40rpx;"> - · 申请获取以下权限 - </view> - <view - style="width: 700rpx; height: 20px; font-size: 13px; margin: auto; color: #cbcbcb; margin-top: 25rpx;"> - · 获得你的信息(昵称、头像等) - </view> - - <view class="btn"> - <view @click="onWxCheckSubmit" class="button-green">保存</view> - </view> - - </view> - </view> - </uni-popup> - - - <!-- #endif --> - <!-- #ifndef PUB_CUSTOMER --> - <!-- <view class="button-login-out topic-gray" @click="clearlogout"> - 退出登录 - </view> --> - - <view style="padding-bottom:160rpx"> - </view> - <common-footer flg="1"></common-footer> - <!-- #endif --> - - - </view> -</template> - -<script> - export default { - data() { - return { - CustomBar: uni.getStorageSync('CustomBar'), - StatusBar: uni.getStorageSync('StatusBar'), - tcode: '', - inviterName: '', - // StatusBar:0, - tel: '15974805814', - tj: {}, - tj_order: {}, - cacheUserId: '', - // order_pendding_num: 0, - - }; - }, - // #ifndef PUB_CUSTOMER - onShareAppMessage() { - let that = this; - var name = that.currentInfo.customerDTO && currentInfo.customerDTO.name || that.currentInfo.supplierDTO && - currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && currentInfo.partnerDTO.name || '' - var url = - `/pages/login/supplier-login?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 - return { - title: "花满芫", - 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 = - `/pages/login/supplier-login?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 - return { - title: "花满芫", - path: url, - } - }, - // #endif - // #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 = - `/pages/home/home?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 - return { - title: "花满芫", - 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 = - `/pages/home/home?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 - return { - title: "花满芫", - path: url, - } - }, - // #endif - onShow() { - this.cacheUserId = '' - this.getTj() - }, - onLoad(options) { - // const url = options.q ? decodeURIComponent(options.q) : ''; - // const urlcode = options.url && decodeURIComponent(options.url) || '' - // #ifdef PUB_CUSTOMER - if (options.partnerUserId) { - this.bindPartnerUser(options.partnerUserId, options.partnerUserName) - } - // #endif - - - }, - created() { - - }, - async onPullDownRefresh() { - await this.$store.dispatch('getCurrentInfo') - uni.stopPullDownRefresh() - }, - methods: { - async bindPartnerUser(userId, name) { - // await this.$message.confirm(`确定要绑定${name}合伙人吗?`) - //调用接口绑定 - this.$message.showLoading() - const { - code, - data - } = await this.$http.request('post', '/api/customer/bind/partner', { - data: { - partnerUserId: userId - } - }) - this.$message.hideLoading() - if (code == 0) { - this.$message.showToast(`绑定合伙人${name}成功`) - await this.$store.dispatch('getCurrentInfo') - } - }, - async scanPartnerCode() { - //扫二维码确认 - let that = this - uni.scanCode({ - success: async function(res) { - console.log('条码内容:' + res.result); - if (!res.result) { - that.$message.showToast('未识别出合伙人信息,请用微信扫码打开') - return - } - var dto = undefined - try { - if (res.result && (res.result.startsWith('https://') || res.result.startsWith( - 'http://')) && res.result.indexOf( - 'partnerUserId') >= 0) { - var arr = res.result.split("?")[1].split("&") - dto = {} - for (var item of arr) { - var tarr = item.split("=") - // console.log('tarr',tarr) - if (tarr[1]) { - dto[tarr[0]] = tarr[1] - } - } - dto['name'] = dto['partnerUserName'] || '' - dto['userId'] = dto['partnerUserId'] || '' - // console.log('tmp arr',arr,dto) - - } else { - dto = JSON.parse(res.result) - - } - if (!!dto['userId']) { - var partnerName = dto['name'] || '' - var partnerId = dto['userId'] || '' - that.bindPartnerUser(partnerId, partnerName) - - } else { - that.$message.showToast('二维码格式不正确扫码失败') - } - } catch (e) { - console.log('e', e) - that.$message.showToast('二维码扫码错误') - } - }, - fail() { - that.$message.showToast('扫码失败') - - } - }); - }, - - - toInfo() { - var url = '' - if (this.currentInfo.id) { - // #ifdef PUB_CUSTOMER - url = '/sub_pages/customer/customer-info/customer-info' - // #endif - // #ifdef PUB_PARTNER - url = '/sub_pages/partner/partner-info/partner-info' - // #endif - // #ifdef PUB_SUPPLIER - url = '/sub_pages/supplier/supplier-info/supplier-info' - // #endif - if (url) { - uni.navigateTo({ - url: url - }) - } - } - }, - getTj() { - // /api/supplier/delivery - - if (this.currentInfo.id && this.currentInfo.id !== this.cacheUserId) { - this.cacheUserId = this.currentInfo.id - let that = this - setTimeout(() => { - // #ifdef PUB_CUSTOMER - this.$http.request('get', '/api/customer/center/tj', {}).then(res => { - if (res.code === 0) { - that.tj = res.data || {} - } - }) - //获取待支付数目 - - this.$http.request('get', '/api/customer/order/statistics/count', { - params: {} - }).then(res => { - if (res.code === 0) { - // that.order_pendding_num = res.data || 0 - that.tj_order = res.data || {} - // this.$forceUpdate() - console.log('tj_order', that.tj_order) - } - }) - - - // #endif - }, 200) - } - - }, - - async clearlogout() { - await this.$message.confirm('是否退出登录?') - this.$store.commit('updateLogin', false) - - uni.reLaunch({ - url: '/pages/login/supplier-login' - }) - }, - async callTel() { - await this.$message.confirm('是否拨打客服电话') - uni.makePhoneCall({ - phoneNumber: this.tel //仅为示例 - }); - }, - toCustomerLogin() { - uni.navigateTo({ - url: '/pages/login/supplier-login' - }) - }, - } - } -</script> - -<style lang="scss" scoped> - @import "./user.scss"; -</style> -<!-- #ifdef PUB_CUSTOMER --> -<style lang="scss" scoped> - @import "./user-customer.scss"; -</style> -<!-- #endif --> -<style lang="scss" scoped> + src="../../static/images/customer/coupon/member/icon-member-1.png"></image> + {{currentInfo.customerDTO.userGrowthRecord.currentMemberLevel}} + <uni-icons color="#7CC662" type="right" size="18"></uni-icons> + + </view> + <view v-else-if="currentInfo.customerDTO.userGrowthRecord.currentMemberLevel=='银卡会员'" class="v2"> + <image class="member-icon v2" + src="../../static/images/customer/coupon/member/icon-member-2.png"></image> + {{currentInfo.customerDTO.userGrowthRecord.currentMemberLevel}} + <uni-icons color="#7498E0" type="right" size="18"></uni-icons> + + </view> + <view v-else-if="currentInfo.customerDTO.userGrowthRecord.currentMemberLevel=='金卡会员'" class="v3"> + <image class="member-icon v3" + src="../../static/images/customer/coupon/member/icon-member-3.png"></image> + {{currentInfo.customerDTO.userGrowthRecord.currentMemberLevel}} + <uni-icons color="#C47810" type="right" size="18"></uni-icons> + </view> + <view v-else class="v4"> + <image class="member-icon v4" + src="../../static/images/customer/coupon/member/icon-member-4.png"></image> + {{currentInfo.customerDTO.userGrowthRecord.currentMemberLevel}} + <uni-icons color="#DD834E" type="right" size="18"></uni-icons> + </view> + + + </span> + <!-- #endif --> + </view> + <view class="t2">{{ currentInfo.tel || '暂无电话' }}</view> + </view> + <view class="name" v-if="!currentInfo.id" open-type="getUserInfo" @click.stop="toCustomerLogin" + style="font-size: 48rpx;margin-top: 16rpx;"> + <!-- getUserProfile --> + {{ '点击登陆/注册' }} + </view> + <image class="icon-setting" @click="toInfo" src="../../static/common/icon-setting.png" mode="aspectFit"> + </image> + </view> + <!-- #ifdef PUB_CUSTOMER --> + <view class="customer-info-records"> + <view class="item" @click="goto('/sub_pages/customer/self/collect',true)"> + <view class="num">{{ tj.collectNum || 0 }} + </view> + <view class="name">我的收藏</view> + </view> + <view class="line"></view> + <view class="item" @click="goto('/sub_pages/customer/self/follow',true)"> + <view class="num">{{ tj.followNum || 0 }} + </view> + <view class="name">关注店铺</view> + </view> + <view class="line"></view> + <view class="item" @click="goto('/sub_pages/customer/self/history',true)"> + <view class="num">{{ tj.browseNum || 0 }}</view> + <view class="name">浏览记录</view> + </view> + </view> + <!-- #endif --> + + + </view> + + <!-- #ifdef PUB_CUSTOMER --> + <view class="m-20 coupon-info-container" @click="goto( `/sub_pages/customer/coupon/good-all`,true)" + v-if="selftype==='customer'||!selftype"> + <view> + <view class="title">积分商城</view> + <view class="score m-t-8">拥有积分:{{currentInfo.currentPoint || 0}}</view> + </view> + <view class="button m-l-a m-r-0 m-t-12"> + 去兑换 <uni-icons color="#ffffff" type="right" size="16"></uni-icons> + </view> + </view> + <!-- #endif --> + <!-- #ifdef PUB_CUSTOMER --> + + + <view class="user-utils m-20 user-customer-order-infos" v-if="selftype==='customer'||!selftype"> + <view class="user-util m-t-12"> + <view class="title flex"> + <view class="flex1">我的订单</view> + <view class="m-r-a m-r-0 more" @click="goto('/pages/order/order',true)">全部订单 + <uni-icons class="" type="right" size="12"></uni-icons> + </view> + </view> + + <view class="flex order-icons-container"> + <view class="order-icons" style="position: relative;" + @click="goto('/pages/order/order?status=PENDING',true)"> + <image src="../../static/images/customer/order/order-type-1.png" class="order-icon dfk" + style="position: relative;"> + <view class="image-shop-number" v-if="tj_order.pendingCount">{{tj_order.pendingCount||''}} + </view> + </image> + <view>待付款</view> + </view> + <view class="order-icons" @click="goto('/pages/order/order?status=SEND',true)"> + <image src="../../static/images/customer/order/order-type-2.png" class="order-icon dfh" + style="position: relative;"> + <view class="image-shop-number" v-if="tj_order.sendCount">{{tj_order.sendCount||''}}</view> + + </image> + <view>待发货</view> + </view> + <view class="order-icons" @click="goto('/pages/order/order?status=RECEIVE',true)"> + <image src="../../static/images/customer/order/order-type-3.png" class="order-icon dsh" + style="position: relative;"> + <view class="image-shop-number" v-if="tj_order.receiveCount">{{tj_order.receiveCount||''}} + </view> + + </image> + <view>待收货</view> + </view> + <view class="order-icons" @click="goto('/pages/order/order?status=EVALUATE',true)"> + <image src="../../static/images/customer/order/order-type-4.png" class="order-icon dpj" + style="position: relative;"> + <view class="image-shop-number" v-if="tj_order.evaluateCount">{{tj_order.evaluateCount||''}} + </view> + + </image> + <view>待评价</view> + </view> + <view class="order-icons" @click="goto('/pages/order/order-sale/order-sale',true)"> + <image src="../../static/images/customer/order/order-type-5.png" class="order-icon sh" + style="position: relative;"> + <view class="image-shop-number" v-if="tj_order.salesPendingCount"> + {{tj_order.salesPendingCount||''}} + </view> + + </image> + <view>售后</view> + </view> + </view> + </view> + </view> + <view class="user-utils m-20" v-if="selftype==='customer'||!selftype"> + <view class="user-util m-t-12 user-customer-service-infos"> + <view class="title flex"> + <view>我的服务</view> + </view> + <view class="flex service-icons-container"> + <view class="service-icons" @click="goto('/sub_pages/customer/self/follow',true)"> + <image src="../../static/images/customer/service/service-icon-1.png" class="service-icon "> + </image> + <view>关注店铺</view> + </view> + <view class="service-icons" @click="goto('/sub_pages/customer/self/collect',true)"> + <image src="../../static/images/customer/service/service-icon-2.png" class="service-icon "> + </image> + <view>我的收藏</view> + </view> + <view class="service-icons" @click="goto('/pages/user/address/address',true)"> + <image src="../../static/images/customer/service/service-icon-3.png" class="service-icon "> + </image> + <view>地址管理</view> + </view> + <view class="service-icons" @click="goto('/pages/help/content?id=售后规则',false)"> + <image src="../../static/images/customer/service/service-icon-4.png" class="service-icon "> + </image> + <view>售后规则</view> + </view> + </view> + <view class="flex service-icons-container"> + <view class="service-icons" @click="goto('/pages/help/content?id=新手帮助',false)"> + <image src="../../static/images/customer/service/service-icon-5.png" class="t2 service-icon "> + </image> + <view>新手帮助</view> + </view> + <view class="service-icons" @click="goto('/sub_pages/customer/self/feedback',true)"> + <image src="../../static/images/customer/service/service-icon-7.png" class="t2 service-icon "> + </image> + <view>投诉反馈</view> + </view> + <!-- #ifdef PUB_CUSTOMER --> + <view class="service-icons" @click="goto('/sub_pages/customer/coupon/coupon-self',true)"> + <image src="../../static/images/customer/service/service-icon-8.png" class="t2 service-icon "> + </image> + <view>优惠券</view> + </view> + + <view class="service-icons" @click="goto('/sub_pages/customer/coupon/good-self',true)"> + <image src="../../static/images/customer/service/service-icon-9.png" class="t2 service-icon "> + </image> + <view>兑换券</view> + </view> + <!-- #endif --> + <!-- #ifndef PUB_CUSTOMER --> + <view class="service-icons"> + + </view> + + <view class="service-icons"> + + </view> + <!-- #endif --> + </view> + </view> + </view> + <!-- #endif --> + <view class="user-utils m-20"> + <view class="user-util m-t-12 flex" v-if="selftype==='customer'||!selftype" + @click="goto('/sub_pages/customer/customer-info/customer-info',true)"> + <view class="title">个人信息</view> + <view class="right-icon"> + <uni-icons type="right"></uni-icons> + </view> + </view> + <view class="user-util m-t-12 flex" v-if="selftype==='partner'" + @click="goto('/sub_pages/partner/partner-info/partner-info',true)"> + <view class="title">合伙人信息</view> + <view class="right-icon"> + <uni-icons type="right"></uni-icons> + </view> + </view> + <!-- #ifdef PUB_PARTNER --> + <view class="user-util m-t-12 flex" + v-if="selftype==='partner'&¤tInfo.partnerDTO&¤tInfo.partnerDTO.id&¤tInfo.partnerDTO.status=='P'" + @click="goto('/sub_pages/partner/partner-info/partner-code',true)"> + <view class="title">推广的注册二维码</view> + <view class="right-icon"> + <uni-icons type="right"></uni-icons> + </view> + </view> + <!-- <view class="user-util m-t-12 flex" v-if="selftype==='partner'" + @click="goto('/sub_pages/partner/partner-info/partner-code-v2',true)"> + <view class="title">测试二维码</view> + <view class="right-icon"> + <uni-icons type="right"></uni-icons> + </view> + </view> --> + <!-- #endif --> + <!-- #ifdef PUB_CUSTOMER --> + <view class="user-util m-t-12 flex" + v-if="(selftype==='customer'||!selftype)&¤tInfo.id&¤tInfo.customerDTO&&!currentInfo.customerDTO.partnerId" + @click="scanPartnerCode"> + <view class="title">扫码绑定合伙人</view> + <view class="right-icon"> + <uni-icons type="right"></uni-icons> + </view> + </view> + <!-- #endif --> + <view class="user-util m-t-12 flex" + v-if="selftype==='supplier'&¤tInfo&¤tInfo.id&¤tInfo.supplierDTO&¤tInfo.supplierDTO.status==='P'" + @click="goto('/sub_pages/supplier/supplier-info/supplier-info-update',true)"> + <view class="title">信息维护</view> + <view class="right-icon"> + <uni-icons type="right"></uni-icons> + </view> + </view> + <view class="user-util m-t-12 flex" v-if="selftype==='supplier'" + @click="goto('/sub_pages/supplier/supplier-info/supplier-info',true)"> + <view class="title">店铺信息</view> + <view class="right-icon"> + <uni-icons type="right"></uni-icons> + </view> + </view> + + <view class="user-util m-t-12 flex" @click="goto('/pages/user/user-pwd/user-pwd',true)"> + <view class="title">修改密码</view> + <view class="right-icon"> + <uni-icons type="right"></uni-icons> + </view> + </view> + + <!-- <view class="user-util m-t-12 flex" @click="goto('/sub_pages/partner/delivery/delivery-detail',true)"> + <view class="title">debug</view> + <view class="right-icon"> + <uni-icons type="right"></uni-icons> + </view> + </view> --> + <view class="user-util m-t-12 flex" v-if="currentInfo&¤tInfo.id" + @click="goto('/pages/user/user-bind-wx/user-bind-wx',true)"> + <view class="title">绑定当前微信</view> + <view class="right-icon"> + <uni-icons type="right"></uni-icons> + </view> + </view> + <!-- <view class="user-util m-t-12 flex" @click="goto('/sub_pages/customer/self/feedback',true)"> + <view class="title">投诉反馈</view> + <view class="right-icon"> + <uni-icons type="right"></uni-icons> + </view> + </view> --> + + <!-- v-if="selftype==='customer'" --> + <view class="user-util m-t-12 flex" @click="clearlogout"> + <view class="title">退出登录</view> + <view class="right-icon"> + <uni-icons type="right"></uni-icons> + </view> + </view> + + + + + + <view class="user-util m-t-12 " v-if="selftype==='supplier'||selftype==='customer' || !selftype"> + <view class="title">我的客服</view> + <view class="flex flex-wrap-normal"> + <image class="icon-clock m-r-6 m-t-2" src="../../static/common/icon-call.png"></image> + <!-- @click="callTel" --> + <button open-type="contact" class="component-button-contact" @handleContact="handleContact"> + <view class="name"> + 客服电话 : <span class="topic-gray">{{ tel }}</span> + </view> + <view class="right-icon"> + <uni-icons type="right"></uni-icons> + </view> + </button> + + </view> + </view> + <!-- <view class="user-util m-t-12 " @click="callTel" v-if="selftype==='partner'"> + <view class="name"> + 账号: <span class="topic-gray">{{tel}}</span> + </view> + <view class="name"> + 密码: <span class="topic-gray">{{tel}}</span> + </view> + </view> --> + </view> + + + <!-- #ifdef PUB_CUSTOMER --> + <view style="padding-bottom:140rpx"> + </view> + <common-footer flg="3"></common-footer> + + <uni-popup ref="popup_info" type="bottom"> + <view class="popup-form"> + + <view class="infocontainar"> + <cu-custom bgColor="none" :isBack="false"> + <block slot="content"><span style="color: #333;font-weight: 400;">获取用户头像、昵称</span></block> + </cu-custom> + + + <view class="avatarUrl"> + <button type="balanced" open-type="chooseAvatar" @chooseavatar="onChooseavatar"> + <image :src="regAvatarUrl" class="refreshIcon"></image> + </button> + </view> + <view class="userName"> + <text style="padding-bottom: 20rpx;">修改昵称:</text> + <input :clearable="false" type="nickname" class="weui-input" :value="regUserName" + @blur="onBindblur" placeholder="请输入昵称" @input="onBindinput" /> + </view> + + <view style="width: 100%;height: 1px; background: #EEE;"> + + </view> + <view style="width: 700rpx; height: 20px; font-size: 13px; margin: auto; margin-top: 40rpx;"> + · 申请获取以下权限 + </view> + <view + style="width: 700rpx; height: 20px; font-size: 13px; margin: auto; color: #cbcbcb; margin-top: 25rpx;"> + · 获得你的信息(昵称、头像等) + </view> + + <view class="btn"> + <view @click="onWxCheckSubmit" class="button-green">保存</view> + </view> + + </view> + </view> + </uni-popup> + + + <!-- #endif --> + <!-- #ifndef PUB_CUSTOMER --> + <!-- <view class="button-login-out topic-gray" @click="clearlogout"> + 退出登录 + </view> --> + + <view style="padding-bottom:160rpx"> + </view> + <common-footer flg="1"></common-footer> + <!-- #endif --> + + + </view> +</template> + +<script> + export default { + data() { + return { + CustomBar: uni.getStorageSync('CustomBar'), + StatusBar: uni.getStorageSync('StatusBar'), + tcode: '', + inviterName: '', + // StatusBar:0, + tel: '15974805814', + tj: {}, + tj_order: {}, + cacheUserId: '', + // order_pendding_num: 0, + + }; + }, + // #ifndef PUB_CUSTOMER + onShareAppMessage() { + let that = this; + var name = that.currentInfo.customerDTO && currentInfo.customerDTO.name || that.currentInfo.supplierDTO && + currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && currentInfo.partnerDTO.name || '' + var url = + `/pages/login/supplier-login?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + 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 = + `/pages/login/supplier-login?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + path: url, + } + }, + // #endif + // #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 = + `/pages/home/home?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + 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 = + `/pages/home/home?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + path: url, + } + }, + // #endif + onShow() { + this.cacheUserId = '' + this.getTj() + }, + onLoad(options) { + // const url = options.q ? decodeURIComponent(options.q) : ''; + // const urlcode = options.url && decodeURIComponent(options.url) || '' + // #ifdef PUB_CUSTOMER + if (options.partnerUserId) { + this.bindPartnerUser(options.partnerUserId, options.partnerUserName) + } + // #endif + + + }, + created() { + + }, + async onPullDownRefresh() { + await this.$store.dispatch('getCurrentInfo') + uni.stopPullDownRefresh() + }, + methods: { + async bindPartnerUser(userId, name) { + // await this.$message.confirm(`确定要绑定${name}合伙人吗?`) + //调用接口绑定 + this.$message.showLoading() + const { + code, + data + } = await this.$http.request('post', '/api/customer/bind/partner', { + data: { + partnerUserId: userId + } + }) + this.$message.hideLoading() + if (code == 0) { + this.$message.showToast(`绑定合伙人${name}成功`) + await this.$store.dispatch('getCurrentInfo') + } + }, + async scanPartnerCode() { + //扫二维码确认 + let that = this + uni.scanCode({ + success: async function(res) { + console.log('条码内容:' + res.result); + if (!res.result) { + that.$message.showToast('未识别出合伙人信息,请用微信扫码打开') + return + } + var dto = undefined + try { + if (res.result && (res.result.startsWith('https://') || res.result.startsWith( + 'http://')) && res.result.indexOf( + 'partnerUserId') >= 0) { + var arr = res.result.split("?")[1].split("&") + dto = {} + for (var item of arr) { + var tarr = item.split("=") + // console.log('tarr',tarr) + if (tarr[1]) { + dto[tarr[0]] = tarr[1] + } + } + dto['name'] = dto['partnerUserName'] || '' + dto['userId'] = dto['partnerUserId'] || '' + // console.log('tmp arr',arr,dto) + + } else { + dto = JSON.parse(res.result) + + } + if (!!dto['userId']) { + var partnerName = dto['name'] || '' + var partnerId = dto['userId'] || '' + that.bindPartnerUser(partnerId, partnerName) + + } else { + that.$message.showToast('二维码格式不正确扫码失败') + } + } catch (e) { + console.log('e', e) + that.$message.showToast('二维码扫码错误') + } + }, + fail() { + that.$message.showToast('扫码失败') + + } + }); + }, + + + toInfo() { + var url = '' + if (this.currentInfo.id) { + // #ifdef PUB_CUSTOMER + url = '/sub_pages/customer/customer-info/customer-info' + // #endif + // #ifdef PUB_PARTNER + url = '/sub_pages/partner/partner-info/partner-info' + // #endif + // #ifdef PUB_SUPPLIER + url = '/sub_pages/supplier/supplier-info/supplier-info' + // #endif + if (url) { + uni.navigateTo({ + url: url + }) + } + } + }, + getTj() { + // /api/supplier/delivery + + if (this.currentInfo.id && this.currentInfo.id !== this.cacheUserId) { + this.cacheUserId = this.currentInfo.id + let that = this + setTimeout(() => { + // #ifdef PUB_CUSTOMER + this.$http.request('get', '/api/customer/center/tj', {}).then(res => { + if (res.code === 0) { + that.tj = res.data || {} + } + }) + //获取待支付数目 + + this.$http.request('get', '/api/customer/order/statistics/count', { + params: {} + }).then(res => { + if (res.code === 0) { + // that.order_pendding_num = res.data || 0 + that.tj_order = res.data || {} + // this.$forceUpdate() + console.log('tj_order', that.tj_order) + } + }) + + + // #endif + }, 200) + } + + }, + + async clearlogout() { + await this.$message.confirm('是否退出登录?') + this.$store.commit('updateLogin', false) + + uni.reLaunch({ + url: '/pages/login/supplier-login' + }) + }, + async callTel() { + await this.$message.confirm('是否拨打客服电话') + uni.makePhoneCall({ + phoneNumber: this.tel //仅为示例 + }); + }, + toCustomerLogin() { + uni.navigateTo({ + url: '/pages/login/supplier-login' + }) + }, + } + } +</script> + +<style lang="scss" scoped> + @import "./user.scss"; +</style> +<!-- #ifdef PUB_CUSTOMER --> +<style lang="scss" scoped> + @import "./user-customer.scss"; +</style> +<!-- #endif --> +<style lang="scss" scoped> </style> \ No newline at end of file diff --git a/sub_pages/customer/self/collect.vue b/sub_pages/customer/self/collect.vue index ad4929f..7e5734d 100644 --- a/sub_pages/customer/self/collect.vue +++ b/sub_pages/customer/self/collect.vue @@ -246,19 +246,12 @@ {{ dto.name || '-' }} </view> - <!-- #ifdef PUB_CUSTOMER_DEV --> <view class="price m-l-a m-r-0 component-price-new"> <span class="tip">会员价</span>¥<span class="p">{{ dto.priceMember || dto.price || '-' }}</span>/扎 <view class="component-price-old"> ¥{{dto.price}}/扎 </view> </view> - <!-- #endif --> - <!-- #ifndef PUB_CUSTOMER_DEV --> - <view class="price m-l-a m-r-0"> - ¥{{ dto.price || '-' }}/扎 - </view> - <!-- #endif --> </view> <view class="flex"> <view class="desc p-t-12 flex" @click.stop="toDetail(dto)"> diff --git a/sub_pages/customer/self/history.vue b/sub_pages/customer/self/history.vue index 5b9e6dd..3e8a408 100644 --- a/sub_pages/customer/self/history.vue +++ b/sub_pages/customer/self/history.vue @@ -234,19 +234,13 @@ {{ dto.name || '-' }} </view> - <!-- #ifdef PUB_CUSTOMER_DEV --> <view class="price m-l-a m-r-0 component-price-new"> <span class="tip">会员价</span>¥<span class="p">{{ dto.priceMember || dto.price || '-' }}</span>/扎 <view class="component-price-old"> ¥{{dto.price}}/扎 </view> </view> - <!-- #endif --> - <!-- #ifndef PUB_CUSTOMER_DEV --> - <view class="price m-l-a m-r-0"> - ¥{{ dto.price || '-' }}/扎 - </view> - <!-- #endif --> + </view> <view class="flex"> <view class="desc p-t-12 flex" @click.stop="toDetail(dto)"> diff --git a/sub_pages/customer/shop/shop.vue b/sub_pages/customer/shop/shop.vue index dc097ed..8d7bd8b 100644 --- a/sub_pages/customer/shop/shop.vue +++ b/sub_pages/customer/shop/shop.vue @@ -1,775 +1,768 @@ -<template> - <view class="brand-detail" style="background: #20613D;"> - - <view class="brand-top-info"> - - <view class="info-brand m-t-12" v-if="id"> - <view class="flex"> - <image class="store-logo" :src="dto.cover"></image> - <view> - <view class="store-name">{{dto.name}}</view> - <view class="store-address"> - {{ ((dto.province||'')+ (dto.city&&'-'||'') + (dto.city||'')+ (dto.region&&'-'||'')+(dto.region||'')) ||dto.address || '暂无详细地址'}} - </view> - </view> - <view class="store-sc m-l-a m-r-0" @click="updateGz(!dto.followed)"> - <view class="icon-view"> - <image src="../../../static/icon-gz-1.png" class="icon" v-if="dto.followed"></image> - <image src="../../../static/icon-gz-0.png" class="icon" v-if="!dto.followed"></image> - </view> - <view>{{dto.followed?'取消':'关注'}}</view> - </view> - <!-- <view class="store-sc m-l-a m-r-0" @click="updateGz(!dto.followed)"> - <image src="../../../static/icon-gz-1.png" class="icon" v-if="dto.followed" - ></image> - <image src="../../../static/icon-gz-0.png" class="icon" v-if="!dto.followed" - ></image> - 关注 - </view> --> - </view> - </view> - <view class="tj-info m-t-12"> - <view class="form-item"> - <view class="value">{{page.total || 0}}</view> - <view class="label">发布</view> - </view> - <view class="form-item"> - <view class="value">*</view> - <view class="label">获赞</view> - </view> - <view class="form-item"> - <view class="value">*</view> - <view class="label">粉丝</view> - </view> - <!-- <view class="form-item"> - <view class="value">0</view> - <view class="label">关注</view> - </view> --> - </view> - <view class="p10" style="padding-left: 20rpx;padding-right: 20rpx;"> - <top-tabs :tabs="tabs" :flg="flg" @change="changeTab"> - - </top-tabs> - </view> - </view> - <view class="brand-info"> - <view v-show="flg==='0'||flg==='1'" class="brand-info-0"> - <view class="search-container flex" - style="padding-left: 20rpx;padding-right: 20rpx;padding-top: 20rpx"> - <view class="flex1 input"> - <u-input placeholder="请输入花名" v-model="query.name" clearable @confirm="buttonSearchFlow" @clear="()=>{ - $nextTick(()=>{buttonSearchFlow()}) - }"> - <template slot="suffix"> - <uni-icons color="#20613D" type="search" size="24" - @click="buttonSearchFlow"></uni-icons> - </template> - </u-input> - </view> - </view> - <view class="component-filter-container" style="padding-top: 12rpx;" v-show="flg==='0'"> - <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" @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 m-t-12" v-show="flg==='0'"> - 报价已包含打包费、材料费、交易佣金 - </view> - <no-data v-if="(!list||list.length==0)&&true" style="width: 100%;margin-top: 120rpx;"></no-data> - <view class="flex m-t-12 flex-wrap-normal"> - <view class="type-list" v-if="flg==='1'"> - <view v-for="(item,index) of catgoryTree" @click="changeType(item)" - :class="[query.categoryRoot===item.id?'current':'']" :key="index" - class="p10 flex type-item"> - {{item.name || '-'}} - </view> - </view> - <view class="flex1"> - - - <view class="component-shop-item flex" v-for="(item,index) of list" :key="index" - :class="flg==='1'?'flg-category':''"> - <view class="img" @click.stop="toDetail(item)"> - <image class="img img100" :src="item.cover" lazy-load> - </image> - <view class="level"> - {{item.levelStr||''}} - </view> - </view> - - <view class="m-l-12 info-container flex1"> - <view class="title" @click.stop="toDetail(item)"> - {{item.name}} - <!-- #ifdef PUB_CUSTOMER_DEV --> - <view class="price component-price-new"> - <span class="tip">会员价</span>¥<span class="p">{{item.priceMember||item.price}}</span>/扎 - <view class="component-price-old"> - ¥{{item.price}}/扎 - </view> - </view> - <!-- #endif --> - <!-- #ifndef PUB_CUSTOMER_DEV --> - <view class="price"> - ¥{{item.price}}/扎 - </view> - <!-- #endif --> - - </view> - <view class="tags" v-if="item.tags||false" @click.stop="toDetail(item)"> - <!-- <view class="tag red">限时抢购</view> - <view class="tag green">品质严选</view> --> - <view class="tag red" v-for="(tag,k) of item.tagArr" :class="[k===0?'red':'green']" - :key="tag">{{ - tag - }} - </view> - </view> - <!-- <view class="shop-name" @click.stop="toDetail(item)"> - {{item.categoryStr}} - </view> --> - <view class="other-info flex" @click.stop="toDetail(item)"> - <view class="m-r-15"> - 已售:{{ ((item.sales||0) +(item.realSales||0)) || 0}} - </view> - <view class="m-r-15"> - 剩余:{{item.stock || 0}} - </view> - <view class="m-r-15"> - {{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" @click.stop="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> - </view> - </view> - </view> - </view> - </view> - </view> - - <!-- <view v-show="flg==='1'" class="brand-info-1"> - <trade :hidefooter="true" :supplierId="id" :catgoryTree="catgoryTree" v-if="catgoryTree" ref="trade"> - </trade> - </view> - --> - <view v-if="flg==='2'" class="brand-info-3"> - <view class="title"> - 基础信息 - </view> - <view class="form-input flex"> - <view class="label ">经营模式</view> - <view class="value">供应商</view> - </view> - <view class="form-input flex"> - <view class="label ">商家详细</view> - <view class="value">{{dto.address || '暂无'}}</view> - </view> - <view class="form-input flex"> - <view class="label ">商家介绍</view> - <view class="value">{{dto.description || '-'}}</view> - </view> - <view class="form-input flex"> - <view class="label">身份认证</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> - -<script> - import trade from './shop-trade.vue' - import http from "../../../plugins/http"; - - export default { - components: { - trade, - }, - data() { - return { - // search_flow: '', - flg: '0', - tabs: [{ - name: '全部商品' - }, - { - name: '分类' - }, - // { - // name: '评价' - // }, - { - name: '商家' - }, - ], - dto: {}, - list: [], - id: '', - catgoryTree: undefined, - query: { - columnStr: '', - column: '', - levelStr: '', - level: '', - name: '', - categoryRoot: '', - }, - level_show: false, - level_columns: [ - [] - ], - - order_show: false, - order_columns: [ - [] - ] - } - }, - onShow() { - //避免商品数目不一样 - this.refreshList('post') - }, - async onPullDownRefresh() { - if (this.id) { - await this.getDetail() - } - await this.refreshList('post') - uni.stopPullDownRefresh() - - }, - onLoad(options) { - this.id = options.id || '' - this.page.size = 300 - 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: { - getList_after() { - if (this.list) { - for (var item of this.list) { - item.tagArr = [] - if (item.tags) { - item.tagArr = item.tags.split(",") || [] - } - } - } - }, - - 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 - } = await this.$http.request(type ? 'post' : 'get', `/api/follow/${type ? 'add' : 'delete'}`, { - data: { - supplierId: this.dto.supplierId || this.dto.id - }, - params: { - supplierId: this.dto.supplierId || this.dto.id - } - }) - if (code === 0) { - this.dto.followed = !this.dto.followed - await this.$store.dispatch('sign_add', 'follow') - this.$forceUpdate() - } - this.$message.hideLoading() - - - }, - async changeTab(flg) { - console.log('changeTab', flg) - if ('0' === ('' + flg)) { - //刷新list数据 - this.query.categoryRoot = '' - this.refreshList('post') - } - if ('1' === ('' + flg)) { - this.list = [] - 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() - } - //如果存在第一个分类,根据一级分类查询 - if (this.catgoryTree.length > 0) { - this.query.categoryRoot = this.catgoryTree[0].id - //然后刷新 - this.refreshList('post') - - } - - } - this.flg = '' + flg - //如果没有加载数据,需要加载一下 - - - }, - changeType(item) { - if (item.id !== this.query.categoryRoot) { - this.query.categoryRoot = item.id || '' - this.refreshList('post') - //拼接二级分类,然后查询商品列表 - } - - }, - buttonSearchFlow() { - // this.query.name = this.search_flow || '' - this.refreshList('post') - }, - 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('请前往登录') - uni.navigateTo({ - url: '/pages/user/supplier-user' - }) - return - } - 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 { - return - } - this.$message.showLoading() - const { - code - } = await this.$http.request('post', '/api/customer/flower/cart/change-num', { - data: { - id: item.id, - num: addnum - } - }) - this.$message.hideLoading() - if (code === 0) { - item.shopnum += addnum - this.$forceUpdate() - } - }, - - toDetail(item) { - uni.navigateTo({ - url: `/sub_pages/customer/trade/detail?id=${item.id}` - }) - }, - } - } -</script> - -<style lang="scss" scoped> - .brand-detail { - .tags { - margin-top: 12rpx; - display: flex; - - .tag { - // min-width: 60rpx; - padding-left: 10rpx; - padding-right: 10rpx; - line-height: 30rpx; - background: #FEE6E6; - border-radius: 10rpx; - font-size: 18rpx; - color: #CD1212; - margin-right: 6rpx; - text-align: center; - } - - .tag.green { - color: rgba(110, 159, 102, 1); - background: rgba(202, 229, 214, 1); - border-radius: 10rpx; - // opacity: 0.57; - } - } - - // min-height: 99vh; - .brand-info { - background: #FFFFFF; - // border-radius: 40rpx 40rpx 0rpx 0rpx; - border-top-left-radius: 40rpx; - border-top-right-radius: 40rpx; - overflow: hidden; - overflow-y: scroll; - padding: 40rpx 32rpx; - min-height: calc(100vh - 470rpx); - max-height: calc(100vh - 470rpx); - padding-top: 0rpx; - - .type-list { - max-width: 140rpx; - min-width: 140rpx; - background: #EEF7F5; - border-radius: 8rpx; - min-height: calc(100vh - 600rpx); - // max-height: calc(100vh - 600rpx); - overflow-y: scroll; - margin-right: 10rpx; - - .type-item { - text-align: center; - font-weight: 400; - font-size: 24rpx; - color: #000000; - display: block; - line-height: 60rpx; - // padding-left: 30rpx; - // padding-right: 30rpx; - } - - .type-item.current { - font-weight: 600; - color: #04BA97; - } - } - - .flg-category.component-shop-item { - .img { - width: 140rpx; - height: 140rpx; - margin-top: 10rpx; - } - - .info-container { - .title { - margin-top: 0rpx; - } - - .shop-name {} - - .other-info { - margin-bottom: 60rpx; - } - - .bottom-buttons { - bottom: -50rpx; - } - } - - } - - .brand-info-0 { - .top-title { - height: 60rpx; - background: #E4ECE8; - border-radius: 4rpx; - font-weight: 400; - font-size: 24rpx; - color: #779787; - margin-top: 10rpx; - line-height: 60rpx; - padding-left: 20rpx; - } - } - - .brand-info-1 { - // padding: 40rpx 30rpx; - - } - - .brand-info-3 { - padding: 40rpx 30rpx; - - .title { - font-weight: 600; - font-size: 32rpx; - color: #000000; - line-height: 44rpx; - margin-bottom: 20rpx; - } - - .form-input { - display: flex; - border-bottom: 2rpx solid #EEEEEE; - line-height: 80rpx; - - .label { - font-weight: 600; - font-size: 28rpx; - color: #000000; - } - - .value { - font-weight: 400; - font-size: 28rpx; - color: #666666; - margin-left: auto; - margin-right: 0; - - text-align: right; - - .check { - background: #20613D; - border-radius: 4rpx; - } - } - } - } - } - - .brand-top-info { - background-image: url('https://hmy-flower.oss-cn-shanghai.aliyuncs.com/37/37dc02b58bd44af79e45031af2bb6c0b%E4%BD%8D%E5%9B%BE@2x.png'); - background-size: 100% 100%; - - .tj-info { - display: flex; - - .form-item { - flex: 1; - text-align: center; - - .label { - font-weight: 400; - font-size: 32rpx; - color: #FFFFFF; - line-height: 44rpx; - } - - .value { - font-weight: 600; - font-size: 48rpx; - color: #FFFFFF; - line-height: 66rpx; - - } - } - } - - .search-container { - display: flex; - margin: 12rpx 0rpx 20rpx 0rpx; - position: relative; - z-index: 1; - - .input { - - background-color: #fff !important; - - border-radius: 8rpx; - } - - } - } - } +<template> + <view class="brand-detail" style="background: #20613D;"> + + <view class="brand-top-info"> + + <view class="info-brand m-t-12" v-if="id"> + <view class="flex"> + <image class="store-logo" :src="dto.cover"></image> + <view> + <view class="store-name">{{dto.name}}</view> + <view class="store-address"> + {{ ((dto.province||'')+ (dto.city&&'-'||'') + (dto.city||'')+ (dto.region&&'-'||'')+(dto.region||'')) ||dto.address || '暂无详细地址'}} + </view> + </view> + <view class="store-sc m-l-a m-r-0" @click="updateGz(!dto.followed)"> + <view class="icon-view"> + <image src="../../../static/icon-gz-1.png" class="icon" v-if="dto.followed"></image> + <image src="../../../static/icon-gz-0.png" class="icon" v-if="!dto.followed"></image> + </view> + <view>{{dto.followed?'取消':'关注'}}</view> + </view> + <!-- <view class="store-sc m-l-a m-r-0" @click="updateGz(!dto.followed)"> + <image src="../../../static/icon-gz-1.png" class="icon" v-if="dto.followed" + ></image> + <image src="../../../static/icon-gz-0.png" class="icon" v-if="!dto.followed" + ></image> + 关注 + </view> --> + </view> + </view> + <view class="tj-info m-t-12"> + <view class="form-item"> + <view class="value">{{page.total || 0}}</view> + <view class="label">发布</view> + </view> + <view class="form-item"> + <view class="value">*</view> + <view class="label">获赞</view> + </view> + <view class="form-item"> + <view class="value">*</view> + <view class="label">粉丝</view> + </view> + <!-- <view class="form-item"> + <view class="value">0</view> + <view class="label">关注</view> + </view> --> + </view> + <view class="p10" style="padding-left: 20rpx;padding-right: 20rpx;"> + <top-tabs :tabs="tabs" :flg="flg" @change="changeTab"> + + </top-tabs> + </view> + </view> + <view class="brand-info"> + <view v-show="flg==='0'||flg==='1'" class="brand-info-0"> + <view class="search-container flex" + style="padding-left: 20rpx;padding-right: 20rpx;padding-top: 20rpx"> + <view class="flex1 input"> + <u-input placeholder="请输入花名" v-model="query.name" clearable @confirm="buttonSearchFlow" @clear="()=>{ + $nextTick(()=>{buttonSearchFlow()}) + }"> + <template slot="suffix"> + <uni-icons color="#20613D" type="search" size="24" + @click="buttonSearchFlow"></uni-icons> + </template> + </u-input> + </view> + </view> + <view class="component-filter-container" style="padding-top: 12rpx;" v-show="flg==='0'"> + <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" @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 m-t-12" v-show="flg==='0'"> + 报价已包含打包费、材料费、交易佣金 + </view> + <no-data v-if="(!list||list.length==0)&&true" style="width: 100%;margin-top: 120rpx;"></no-data> + <view class="flex m-t-12 flex-wrap-normal"> + <view class="type-list" v-if="flg==='1'"> + <view v-for="(item,index) of catgoryTree" @click="changeType(item)" + :class="[query.categoryRoot===item.id?'current':'']" :key="index" + class="p10 flex type-item"> + {{item.name || '-'}} + </view> + </view> + <view class="flex1"> + + + <view class="component-shop-item flex" v-for="(item,index) of list" :key="index" + :class="flg==='1'?'flg-category':''"> + <view class="img" @click.stop="toDetail(item)"> + <image class="img img100" :src="item.cover" lazy-load> + </image> + <view class="level"> + {{item.levelStr||''}} + </view> + </view> + + <view class="m-l-12 info-container flex1"> + <view class="title" @click.stop="toDetail(item)"> + {{item.name}} + <view class="price component-price-new"> + <span class="tip">会员价</span>¥<span class="p">{{item.priceMember||item.price}}</span>/扎 + <view class="component-price-old"> + ¥{{item.price}}/扎 + </view> + </view> + + </view> + <view class="tags" v-if="item.tags||false" @click.stop="toDetail(item)"> + <!-- <view class="tag red">限时抢购</view> + <view class="tag green">品质严选</view> --> + <view class="tag red" v-for="(tag,k) of item.tagArr" :class="[k===0?'red':'green']" + :key="tag">{{ + tag + }} + </view> + </view> + <!-- <view class="shop-name" @click.stop="toDetail(item)"> + {{item.categoryStr}} + </view> --> + <view class="other-info flex" @click.stop="toDetail(item)"> + <view class="m-r-15"> + 已售:{{ ((item.sales||0) +(item.realSales||0)) || 0}} + </view> + <view class="m-r-15"> + 剩余:{{item.stock || 0}} + </view> + <view class="m-r-15"> + {{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" @click.stop="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> + </view> + </view> + </view> + </view> + </view> + </view> + + <!-- <view v-show="flg==='1'" class="brand-info-1"> + <trade :hidefooter="true" :supplierId="id" :catgoryTree="catgoryTree" v-if="catgoryTree" ref="trade"> + </trade> + </view> + --> + <view v-if="flg==='2'" class="brand-info-3"> + <view class="title"> + 基础信息 + </view> + <view class="form-input flex"> + <view class="label ">经营模式</view> + <view class="value">供应商</view> + </view> + <view class="form-input flex"> + <view class="label ">商家详细</view> + <view class="value">{{dto.address || '暂无'}}</view> + </view> + <view class="form-input flex"> + <view class="label ">商家介绍</view> + <view class="value">{{dto.description || '-'}}</view> + </view> + <view class="form-input flex"> + <view class="label">身份认证</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> + +<script> + import trade from './shop-trade.vue' + import http from "../../../plugins/http"; + + export default { + components: { + trade, + }, + data() { + return { + // search_flow: '', + flg: '0', + tabs: [{ + name: '全部商品' + }, + { + name: '分类' + }, + // { + // name: '评价' + // }, + { + name: '商家' + }, + ], + dto: {}, + list: [], + id: '', + catgoryTree: undefined, + query: { + columnStr: '', + column: '', + levelStr: '', + level: '', + name: '', + categoryRoot: '', + }, + level_show: false, + level_columns: [ + [] + ], + + order_show: false, + order_columns: [ + [] + ] + } + }, + onShow() { + //避免商品数目不一样 + this.refreshList('post') + }, + async onPullDownRefresh() { + if (this.id) { + await this.getDetail() + } + await this.refreshList('post') + uni.stopPullDownRefresh() + + }, + onLoad(options) { + this.id = options.id || '' + this.page.size = 300 + 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: { + getList_after() { + if (this.list) { + for (var item of this.list) { + item.tagArr = [] + if (item.tags) { + item.tagArr = item.tags.split(",") || [] + } + } + } + }, + + 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 + } = await this.$http.request(type ? 'post' : 'get', `/api/follow/${type ? 'add' : 'delete'}`, { + data: { + supplierId: this.dto.supplierId || this.dto.id + }, + params: { + supplierId: this.dto.supplierId || this.dto.id + } + }) + if (code === 0) { + this.dto.followed = !this.dto.followed + await this.$store.dispatch('sign_add', 'follow') + this.$forceUpdate() + } + this.$message.hideLoading() + + + }, + async changeTab(flg) { + console.log('changeTab', flg) + if ('0' === ('' + flg)) { + //刷新list数据 + this.query.categoryRoot = '' + this.refreshList('post') + } + if ('1' === ('' + flg)) { + this.list = [] + 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() + } + //如果存在第一个分类,根据一级分类查询 + if (this.catgoryTree.length > 0) { + this.query.categoryRoot = this.catgoryTree[0].id + //然后刷新 + this.refreshList('post') + + } + + } + this.flg = '' + flg + //如果没有加载数据,需要加载一下 + + + }, + changeType(item) { + if (item.id !== this.query.categoryRoot) { + this.query.categoryRoot = item.id || '' + this.refreshList('post') + //拼接二级分类,然后查询商品列表 + } + + }, + buttonSearchFlow() { + // this.query.name = this.search_flow || '' + this.refreshList('post') + }, + 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('请前往登录') + uni.navigateTo({ + url: '/pages/user/supplier-user' + }) + return + } + 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 { + return + } + this.$message.showLoading() + const { + code + } = await this.$http.request('post', '/api/customer/flower/cart/change-num', { + data: { + id: item.id, + num: addnum + } + }) + this.$message.hideLoading() + if (code === 0) { + item.shopnum += addnum + this.$forceUpdate() + } + }, + + toDetail(item) { + uni.navigateTo({ + url: `/sub_pages/customer/trade/detail?id=${item.id}` + }) + }, + } + } +</script> + +<style lang="scss" scoped> + .brand-detail { + .tags { + margin-top: 12rpx; + display: flex; + + .tag { + // min-width: 60rpx; + padding-left: 10rpx; + padding-right: 10rpx; + line-height: 30rpx; + background: #FEE6E6; + border-radius: 10rpx; + font-size: 18rpx; + color: #CD1212; + margin-right: 6rpx; + text-align: center; + } + + .tag.green { + color: rgba(110, 159, 102, 1); + background: rgba(202, 229, 214, 1); + border-radius: 10rpx; + // opacity: 0.57; + } + } + + // min-height: 99vh; + .brand-info { + background: #FFFFFF; + // border-radius: 40rpx 40rpx 0rpx 0rpx; + border-top-left-radius: 40rpx; + border-top-right-radius: 40rpx; + overflow: hidden; + overflow-y: scroll; + padding: 40rpx 32rpx; + min-height: calc(100vh - 470rpx); + max-height: calc(100vh - 470rpx); + padding-top: 0rpx; + + .type-list { + max-width: 140rpx; + min-width: 140rpx; + background: #EEF7F5; + border-radius: 8rpx; + min-height: calc(100vh - 600rpx); + // max-height: calc(100vh - 600rpx); + overflow-y: scroll; + margin-right: 10rpx; + + .type-item { + text-align: center; + font-weight: 400; + font-size: 24rpx; + color: #000000; + display: block; + line-height: 60rpx; + // padding-left: 30rpx; + // padding-right: 30rpx; + } + + .type-item.current { + font-weight: 600; + color: #04BA97; + } + } + + .flg-category.component-shop-item { + .img { + width: 140rpx; + height: 140rpx; + margin-top: 10rpx; + } + + .info-container { + .title { + margin-top: 0rpx; + } + + .shop-name {} + + .other-info { + margin-bottom: 60rpx; + } + + .bottom-buttons { + bottom: -50rpx; + } + } + + } + + .brand-info-0 { + .top-title { + height: 60rpx; + background: #E4ECE8; + border-radius: 4rpx; + font-weight: 400; + font-size: 24rpx; + color: #779787; + margin-top: 10rpx; + line-height: 60rpx; + padding-left: 20rpx; + } + } + + .brand-info-1 { + // padding: 40rpx 30rpx; + + } + + .brand-info-3 { + padding: 40rpx 30rpx; + + .title { + font-weight: 600; + font-size: 32rpx; + color: #000000; + line-height: 44rpx; + margin-bottom: 20rpx; + } + + .form-input { + display: flex; + border-bottom: 2rpx solid #EEEEEE; + line-height: 80rpx; + + .label { + font-weight: 600; + font-size: 28rpx; + color: #000000; + } + + .value { + font-weight: 400; + font-size: 28rpx; + color: #666666; + margin-left: auto; + margin-right: 0; + + text-align: right; + + .check { + background: #20613D; + border-radius: 4rpx; + } + } + } + } + } + + .brand-top-info { + background-image: url('https://hmy-flower.oss-cn-shanghai.aliyuncs.com/37/37dc02b58bd44af79e45031af2bb6c0b%E4%BD%8D%E5%9B%BE@2x.png'); + background-size: 100% 100%; + + .tj-info { + display: flex; + + .form-item { + flex: 1; + text-align: center; + + .label { + font-weight: 400; + font-size: 32rpx; + color: #FFFFFF; + line-height: 44rpx; + } + + .value { + font-weight: 600; + font-size: 48rpx; + color: #FFFFFF; + line-height: 66rpx; + + } + } + } + + .search-container { + display: flex; + margin: 12rpx 0rpx 20rpx 0rpx; + position: relative; + z-index: 1; + + .input { + + background-color: #fff !important; + + border-radius: 8rpx; + } + + } + } + } </style> \ No newline at end of file diff --git a/sub_pages/customer/shopping/confirm.vue b/sub_pages/customer/shopping/confirm.vue index 81b83ad..e97c9b9 100644 --- a/sub_pages/customer/shopping/confirm.vue +++ b/sub_pages/customer/shopping/confirm.vue @@ -407,7 +407,6 @@ </view> <view class="p10 bg-white m-t-20 br-4"> - <!-- #ifdef PUB_CUSTOMER_DEV --> <view class="form-item flex "> <view class="label">优惠券</view> @@ -417,7 +416,6 @@ <u-icon class="m-l-a" name="arrow-right"></u-icon> </view> </view> - <!-- #endif --> <view class="form-item flex m-t-12"> <view class="label">特殊需求</view> @@ -439,7 +437,6 @@ </view> </view> </view> - <!-- #ifdef PUB_CUSTOMER_DEV --> <view class="form-item flex "> <view class="label">兑换券</view> @@ -450,7 +447,6 @@ <u-icon class="m-l-a" name="arrow-right"></u-icon> </view> </view> - <!-- #endif --> </view> </view> diff --git a/sub_pages/customer/trade/detail.vue b/sub_pages/customer/trade/detail.vue index 32e7c41..b8ad709 100644 --- a/sub_pages/customer/trade/detail.vue +++ b/sub_pages/customer/trade/detail.vue @@ -1,78 +1,77 @@ -<template> - <view class="trade-detail"> - <view class="top-img-container"> - - <!-- <image :src="dto.cover" class="top-img" mode="aspectFill"></image> --> - <uni-swiper-dot class="uni-swiper-dot-box" :mode="'dot'" field="content"> - <swiper class="swiper-box" :interval="10000" :circular="true" :current="0" :autoplay="true"> - - <swiper-item v-if="dto.video"> - <video :src="dto.video" class="top-img" :auto-pause-if-navigate="true" - style="display: block;margin: 0 auto;"></video> - <view class="index-tag"> - 1/{{(dto.video&&1||0)+(dto.cover&&1||0)+(dto.bannerList&&dto.bannerList.length||0)}} - </view> - </swiper-item> - <swiper-item v-for="(url, index) in dto.bannerList" :key="index"> - <image class="top-img" :lazy-load="true" mode="scaleToFill" @click="previewImg(url)" :src="url"> - </image> - <view class="index-tag"> - {{index+1+(dto.video&&1)}}/{{(dto.video&&1||0)+(dto.cover&&1||0)+(dto.bannerList&&dto.bannerList.length||0)}} - </view> - </swiper-item> - - <swiper-item> - <image :src="dto.cover" :lazy-load="true" @click="previewImg(dto.cover)" class="top-img" - mode="scaleToFill"> - </image> - <view class="index-tag"> - {{(dto.bannerList&&dto.bannerList.length||0)+1+(dto.video&&1||0)}}/{{(dto.video&&1||0)+(dto.cover&&1||0)+(dto.bannerList&&dto.bannerList.length||0)}} - </view> - </swiper-item> - - - </swiper> - </uni-swiper-dot> - - - - - <view class="icon-container"> - <image v-if="!dto.collection" src="../../../static/common/icon-sc.png" @click="collectItem(dto)" - class="icon-sc"></image> - <image v-if="dto.collection" src="../../../static/common/icon-sc-fill.png" @click="collectItem(dto)" - class="icon-sc"></image> - </view> - <view class="icon-container"> - <image src="../../../static/common/icon-shop.png" @click="toShopping(dto)" class="icon-shop"> - <view class="image-shop-number" v-if="shopnum">{{shopnum||''}}</view> - </image> - - </view> - </view> - <view class="trade-info-container"> - <view class="title flex"> - <view class="level m-r-15">{{ dto.levelStr || '-' }}</view> - <view class=""> - {{ dto.name || '-' }} - </view> - </view> - - <view class="tags" v-if="dto.tags||false"> - <!-- <view class="tag red">限时抢购</view> --> - <!-- <view class="tag green">品质严选</view> --> - <view class="tag red" v-for="(tag,k) of dto.tagArr" :class="[k===0?'red':'green']" :key="tag">{{ - tag - }} - </view> - </view> - <view class="desc m-t-12"> - <view class="m-r-15">已售:{{ ((dto.sales||0) +(dto.realSales||0)) || 0 }}</view> - <view class="m-r-15">剩余:{{ dto.stock || 0 }}</view> - <view class=" ">{{ dto.unit || '-' }}</view> - </view> +<template> + <view class="trade-detail"> + <view class="top-img-container"> + + <!-- <image :src="dto.cover" class="top-img" mode="aspectFill"></image> --> + <uni-swiper-dot class="uni-swiper-dot-box" :mode="'dot'" field="content"> + <swiper class="swiper-box" :interval="10000" :circular="true" :current="0" :autoplay="true"> + + <swiper-item v-if="dto.video"> + <video :src="dto.video" class="top-img" :auto-pause-if-navigate="true" + style="display: block;margin: 0 auto;"></video> + <view class="index-tag"> + 1/{{(dto.video&&1||0)+(dto.cover&&1||0)+(dto.bannerList&&dto.bannerList.length||0)}} + </view> + </swiper-item> + <swiper-item v-for="(url, index) in dto.bannerList" :key="index"> + <image class="top-img" :lazy-load="true" mode="scaleToFill" @click="previewImg(url)" :src="url"> + </image> + <view class="index-tag"> + {{index+1+(dto.video&&1)}}/{{(dto.video&&1||0)+(dto.cover&&1||0)+(dto.bannerList&&dto.bannerList.length||0)}} + </view> + </swiper-item> + + <swiper-item> + <image :src="dto.cover" :lazy-load="true" @click="previewImg(dto.cover)" class="top-img" + mode="scaleToFill"> + </image> + <view class="index-tag"> + {{(dto.bannerList&&dto.bannerList.length||0)+1+(dto.video&&1||0)}}/{{(dto.video&&1||0)+(dto.cover&&1||0)+(dto.bannerList&&dto.bannerList.length||0)}} + </view> + </swiper-item> + + + </swiper> + </uni-swiper-dot> + + + + + <view class="icon-container"> + <image v-if="!dto.collection" src="../../../static/common/icon-sc.png" @click="collectItem(dto)" + class="icon-sc"></image> + <image v-if="dto.collection" src="../../../static/common/icon-sc-fill.png" @click="collectItem(dto)" + class="icon-sc"></image> + </view> + <view class="icon-container"> + <image src="../../../static/common/icon-shop.png" @click="toShopping(dto)" class="icon-shop"> + <view class="image-shop-number" v-if="shopnum">{{shopnum||''}}</view> + </image> + + </view> + </view> + <view class="trade-info-container"> + <view class="title flex"> + <view class="level m-r-15">{{ dto.levelStr || '-' }}</view> + <view class=""> + {{ dto.name || '-' }} + </view> + </view> + + <view class="tags" v-if="dto.tags||false"> + <!-- <view class="tag red">限时抢购</view> --> + <!-- <view class="tag green">品质严选</view> --> + <view class="tag red" v-for="(tag,k) of dto.tagArr" :class="[k===0?'red':'green']" :key="tag">{{ + tag + }} + </view> + </view> + <view class="desc m-t-12"> + <view class="m-r-15">已售:{{ ((dto.sales||0) +(dto.realSales||0)) || 0 }}</view> + <view class="m-r-15">剩余:{{ dto.stock || 0 }}</view> + <view class=" ">{{ dto.unit || '-' }}</view> + </view> <view class="flex m-t-12"> - <!-- #ifdef PUB_CUSTOMER_DEV --> <view> <view class="price m-r-a component-price-new"> <span class="tip">会员价</span><span class="num p">{{ dto.priceMember || dto.price || '-' }}</span> @@ -83,172 +82,167 @@ 元/扎 </view> </view> - <!-- #endif --> - <!-- #ifndef PUB_CUSTOMER_DEV --> - <view class="price m-r-a"> - <span class="num">{{ dto.price || '-' }}</span> - 元/扎 + + + + + <view class="m-l-a m-r-15"> + <button open-type="contact" class="component-button-contact"> + <image src="../../../static/common/icon-kf.png" class="icon-kf m-l-15 img100"></image> + + </button> + </view> - <!-- #endif --> - - - <view class="m-l-a m-r-15"> - <button open-type="contact" class="component-button-contact"> - <image src="../../../static/common/icon-kf.png" class="icon-kf m-l-15 img100"></image> - - </button> - - </view> - <view class="m-r-0 gwc" @click="submitShopping(dto)" v-if="!dto.shopnum"> - + 购物车 - </view> - <view class="m-r-0 button-icons flex" v-if="dto.shopnum"> - <uni-icons v-if="dto.shopnum&&dto.shopnum>=1" type="minus" size="32" - @click.stop="addnum(dto,-1)"></uni-icons> - <view class="curnums" @click.stop="updateItemNum(dto)" v-if="dto.shopnum&&dto.shopnum>=1"> - {{ dto.shopnum }} - </view> - <uni-icons v-if="!dto.shopnum||dto.shopnum<=99" type="plus-filled" size="32" - @click.stop="addnum(dto,1)"></uni-icons> - </view> - - </view> - </view> - <view class="line"> - - </view> - <view class="info-detail" v-if="dto.params"> - <view class="title-before-blue" style="padding-top: 0rpx;padding-bottom: 0rpx;">详情</view> - <view class="flex flex-wrap-normal m-t-8" v-for="(param,index) of dto.params" :key="index"> - <view class="label">{{ param.name}}:</view> - <view class="value">{{ param.value || '-'}}</view> - </view> - <view v-if="!dto.params"> - <view class="flex m-t-8"> - <view class="label">暂无</view> - </view> - </view> - </view> - <view class="line"> - - </view> - - <view class="info-brand m-t-12" @click.stop="openbrand"> - <view class="title-before-blue" style="padding-top: 0rpx;padding-bottom: 0rpx;">店铺</view> - <view class="flex m-t-12"> - <image class="store-logo" :src="dto.supplierCover"></image> - <view> - <view class="store-name t1">{{dto.supplierName||'-'}}</view> - <view class="store-address t1">{{dto.supplierStation||'-'}}</view> - </view> - <view class="store-to m-l-a m-r-0">进入店铺</view> - </view> - </view> - - <!-- <view class="line" v-if="dto.bannerList&&dto.bannerList.length>0"> - - </view> - <uni-swiper-dot class="uni-swiper-dot-box" :mode="'dot'" field="content" - v-if="dto.bannerList&&dto.bannerList.length>0"> - <swiper class="swiper-box" :interval="10000" :circular="true" :current="0" :autoplay="true"> - <swiper-item v-for="(url, index) in dto.bannerList" :key="index"> - <view class="swiper-item" :class="'swiper-item' + index"> - <image class="home-banner-image m-auto m-t-12 m-b-12" style="display: block;" mode="scaleToFill" - @click="previewImg(url)" :src="url"> - </image> - </view> - </swiper-item> - </swiper> - </uni-swiper-dot> --> - - <!-- <view class="line" v-if="dto.video"> - - </view> - <view class="info-brand m-t-12" v-if="dto.video"> - <video :src="dto.video" :auto-pause-if-navigate="true" style="display: block;margin: 0 auto;"></video> - - </view> --> - - - - - <view class="m-t-20 shop-recommend-container" v-if="false"> - <view class="shop-recommend-title">店铺推荐</view> - <view class="flex"> - <view v-for="i in 3" :key="i" class="shop-recommend"> - <image src="" class="shop-recommend-image"></image> - <view class="shop-recommend-title m-t-8"> - <view class="level m-r-15">B级</view> - <view class=""> - {{ dto.name || '-' }} - </view> - </view> - <view class="shop-recommend-price m-t-8"> - ¥23.01/扎 - </view> - </view> - </view> - </view> - <view class="line"> - - </view> - <view class="comment-container m-t-12" v-if="false"> - <view class="title-before-blue" style="padding-top: 0rpx;padding-bottom: 0rpx;"> - <view>评价</view> - <view class="desc"> - 7条评论 - <uni-icons type="right" size="18" color="#B3B3B3"></uni-icons> - - </view> - </view> - <view v-for="i in 3" :key="i" class="m-t-20 flex user-item"> - <image class="user-icon m-r-10"></image> - <view> - <view class="name">用户名3370</view> - <view class="comment">非常棒,会回购</view> - </view> - <view class="stars"> - - </view> - <view class="date"> - 04-07 08:00 - </view> - </view> - </view> - - </view> -</template> - -<script> - export default { - data() { - return { - id: '', - dto: {}, - shopnum: 0, - sharePartnerUserId: '', - } - }, - onShow() { - if (this.id) { - this.getDetail() - } - this.refreshShopNum() - }, - async onLoad(options) { - console.log('trade detail options', options) - this.id = options.id || '' - - // #ifdef PUB_CUSTOMER - - if (options.partnerUserId) { - let tmp = this - tmp.sharePartnerUserId = options.partnerUserId - //合伙人绑定的,判断当前用户,是否有登录,登录没绑定,没登录先缓存合伙人id,等注册和登录时候再弄 - // setTimeout(() => { - //并且当前用户没有绑定 - if (tmp.currentInfo.id && tmp.currentInfo.customerDTO.partnerId) { - + <view class="m-r-0 gwc" @click="submitShopping(dto)" v-if="!dto.shopnum"> + + 购物车 + </view> + <view class="m-r-0 button-icons flex" v-if="dto.shopnum"> + <uni-icons v-if="dto.shopnum&&dto.shopnum>=1" type="minus" size="32" + @click.stop="addnum(dto,-1)"></uni-icons> + <view class="curnums" @click.stop="updateItemNum(dto)" v-if="dto.shopnum&&dto.shopnum>=1"> + {{ dto.shopnum }} + </view> + <uni-icons v-if="!dto.shopnum||dto.shopnum<=99" type="plus-filled" size="32" + @click.stop="addnum(dto,1)"></uni-icons> + </view> + + </view> + </view> + <view class="line"> + + </view> + <view class="info-detail" v-if="dto.params"> + <view class="title-before-blue" style="padding-top: 0rpx;padding-bottom: 0rpx;">详情</view> + <view class="flex flex-wrap-normal m-t-8" v-for="(param,index) of dto.params" :key="index"> + <view class="label">{{ param.name}}:</view> + <view class="value">{{ param.value || '-'}}</view> + </view> + <view v-if="!dto.params"> + <view class="flex m-t-8"> + <view class="label">暂无</view> + </view> + </view> + </view> + <view class="line"> + + </view> + + <view class="info-brand m-t-12" @click.stop="openbrand"> + <view class="title-before-blue" style="padding-top: 0rpx;padding-bottom: 0rpx;">店铺</view> + <view class="flex m-t-12"> + <image class="store-logo" :src="dto.supplierCover"></image> + <view> + <view class="store-name t1">{{dto.supplierName||'-'}}</view> + <view class="store-address t1">{{dto.supplierStation||'-'}}</view> + </view> + <view class="store-to m-l-a m-r-0">进入店铺</view> + </view> + </view> + + <!-- <view class="line" v-if="dto.bannerList&&dto.bannerList.length>0"> + + </view> + <uni-swiper-dot class="uni-swiper-dot-box" :mode="'dot'" field="content" + v-if="dto.bannerList&&dto.bannerList.length>0"> + <swiper class="swiper-box" :interval="10000" :circular="true" :current="0" :autoplay="true"> + <swiper-item v-for="(url, index) in dto.bannerList" :key="index"> + <view class="swiper-item" :class="'swiper-item' + index"> + <image class="home-banner-image m-auto m-t-12 m-b-12" style="display: block;" mode="scaleToFill" + @click="previewImg(url)" :src="url"> + </image> + </view> + </swiper-item> + </swiper> + </uni-swiper-dot> --> + + <!-- <view class="line" v-if="dto.video"> + + </view> + <view class="info-brand m-t-12" v-if="dto.video"> + <video :src="dto.video" :auto-pause-if-navigate="true" style="display: block;margin: 0 auto;"></video> + + </view> --> + + + + + <view class="m-t-20 shop-recommend-container" v-if="false"> + <view class="shop-recommend-title">店铺推荐</view> + <view class="flex"> + <view v-for="i in 3" :key="i" class="shop-recommend"> + <image src="" class="shop-recommend-image"></image> + <view class="shop-recommend-title m-t-8"> + <view class="level m-r-15">B级</view> + <view class=""> + {{ dto.name || '-' }} + </view> + </view> + <view class="shop-recommend-price m-t-8"> + ¥23.01/扎 + </view> + </view> + </view> + </view> + <view class="line"> + + </view> + <view class="comment-container m-t-12" v-if="false"> + <view class="title-before-blue" style="padding-top: 0rpx;padding-bottom: 0rpx;"> + <view>评价</view> + <view class="desc"> + 7条评论 + <uni-icons type="right" size="18" color="#B3B3B3"></uni-icons> + + </view> + </view> + <view v-for="i in 3" :key="i" class="m-t-20 flex user-item"> + <image class="user-icon m-r-10"></image> + <view> + <view class="name">用户名3370</view> + <view class="comment">非常棒,会回购</view> + </view> + <view class="stars"> + + </view> + <view class="date"> + 04-07 08:00 + </view> + </view> + </view> + + </view> +</template> + +<script> + export default { + data() { + return { + id: '', + dto: {}, + shopnum: 0, + sharePartnerUserId: '', + } + }, + onShow() { + if (this.id) { + this.getDetail() + } + this.refreshShopNum() + }, + async onLoad(options) { + console.log('trade detail options', options) + this.id = options.id || '' + + // #ifdef PUB_CUSTOMER + + if (options.partnerUserId) { + let tmp = this + tmp.sharePartnerUserId = options.partnerUserId + //合伙人绑定的,判断当前用户,是否有登录,登录没绑定,没登录先缓存合伙人id,等注册和登录时候再弄 + // setTimeout(() => { + //并且当前用户没有绑定 + if (tmp.currentInfo.id && tmp.currentInfo.customerDTO.partnerId) { + }else{ if (tmp.currentInfo.id) { await tmp.bindPartnerUser(options.partnerUserId, '') @@ -259,355 +253,355 @@ tmp.$storage.setItem('cache_sharePartnerUserId', tmp.sharePartnerUserId) } } - } - - - // }, 1000) - } - // #endif - if (this.id) { - this.getDetail() - } - this.refreshShopNum() - - }, - // #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 || '' - //如果是合伙人的id,那么分享出去,需要附加id了 - console.log('onShareAppMessage', this.currentInfo) - - var partnerUserId = '' - - if (that.currentInfo.customerDTO && that.currentInfo.customerDTO.partnerId) { - partnerUserId = that.currentInfo.customerDTO.partnerId - } - // if (that.currentInfo.partnerDTO && currentInfo.partnerDTO.id) { - // partnerUserId = this.currentInfo.id - // } - var url = - `/sub_pages/customer/trade/detail?partnerUserId=${partnerUserId}&id=${this.id}&shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 - return { - // - title: this.dto.id ? (this.dto.name + " " + (this.dto.price || '-') + '元/扎 ' + (this.dto.unit || '')) : - "花满芫", - path: url, - } - }, - onShareTimeline() { - let that = this; - var name = that.currentInfo.customerDTO && that.currentInfo.customerDTO.name || that.currentInfo.supplierDTO && - currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && that.currentInfo.partnerDTO.name || '' - //如果是合伙人的id,那么分享出去,需要附加id了 - var partnerUserId = '' - - if (that.currentInfo.customerDTO && that.currentInfo.customerDTO.partnerId) { - partnerUserId = that.currentInfo.customerDTO.partnerId - } - var url = - `/sub_pages/customer/trade/detail?partnerUserId=${partnerUserId}&id=${this.id}&shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 - return { - // - title: this.dto.id ? (this.dto.name + " " + (this.dto.price || '-') + '元/扎 ' + (this.dto.unit || '')) : - "花满芫", - path: url, - } - }, - // #endif - methods: { - async bindPartnerUser(userId, name) { - //调用接口绑定 - this.$message.showLoading() - const { - code, - data - } = await this.$http.request('post', '/api/customer/bind/partner', { - data: { - partnerUserId: userId - } - }) - this.$message.hideLoading() - if (code == 0) { - this.$message.showToast(`绑定合伙人${name}成功`) - await this.$store.dispatch('getCurrentInfo') - } - }, - 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('请前往登录') - uni.navigateTo({ - url: `/pages/login/supplier-login?source=jump&sharePartnerUserId=${this.sharePartnerUserId}` - }) - return - } - 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 { - return - } - this.$message.showLoading() - const { - code - } = await this.$http.request('post', '/api/customer/flower/cart/change-num', { - data: { - id: item.id, - num: addnum - } - }) - this.$message.hideLoading() - if (code === 0) { - item.shopnum += addnum - this.refreshShopNum() - this.$forceUpdate() - } - }, - - async refreshShopNum() { - this.shopnum = await this.$store.dispatch('countShopping'); - this.$store.dispatch('sign_add', 'shopnum') - - }, - async collectItem(dto) { - if (!this.currentInfo.id) { - // this.$message.showToast('请先登录') - uni.navigateTo({ - url: `/pages/login/supplier-login?source=jump&sharePartnerUserId=${this.sharePartnerUserId}` - }) - return - } - await this.$message.confirm(`是否${dto.collection?'移除':'添加到'}收藏`) - this.$message.showLoading() - const { - code, - data - } = await this.$http.request(dto.collection ? "get" : 'post', dto.collection ? '/api/collect/delete' : - '/api/collect/add', { - data: { - flowerId: dto.id - }, - params: { - flowerId: dto.id - } - }) - if (code === 0) { - this.$message.showToast('操作成功') - dto.collection = !dto.collection - this.$forceUpdate() - } - - this.$message.hideLoading() - }, - async submitShopping(dto) { - //提交到购物车中 - // this.$message.showLoading() - if (!this.currentInfo.id) { - // this.$message.showToast('请先登录') - uni.navigateTo({ - url: `/pages/login/supplier-login?source=jump&sharePartnerUserId=${this.sharePartnerUserId}` - }) - return - } - const { - code, - data - } = await this.$store.dispatch('submitShopping', dto); - // this.$message.hideLoading() - if (code == 0) { - dto.shopnum = data || 0 - this.refreshShopNum() - this.$forceUpdate() - - } - }, - async getDetail() { - var params = { - id: this.id, - } - if (this.sharePartnerUserId && !isNaN(parseInt(this.sharePartnerUserId))) { - params.partnerId = parseInt(this.sharePartnerUserId) - } - this.$message.showLoading() - const { - code, - data - } = await this.$http.request('get', '/api/customer/flower/list/view', { - params: params - }) - if (code === 0) { - this.dto = { - bannerList: [], - ...data, - } - if (!this.dto.bannerList) { - this.dto.bannerList = [] - } - if (this.dto.tags) { - this.dto.tagArr = this.dto.tags.split(",") || [] - } else { - this.dto.tagArr = [] - } - } - - this.$message.hideLoading() - - }, - toShopping() { - if (!this.currentInfo.id) { - // this.$message.showToast('请先登录') - uni.navigateTo({ - url: `/pages/login/supplier-login?source=jump&sharePartnerUserId=${this.sharePartnerUserId}` - }) - return - } - //判断堆栈,如果是购物车,就直接返回 - const pages = getCurrentPages(); - //如果上一层就是购物车,那么就返回,而不是跳转 - // console.log('toShopping',pages) - if (pages && pages.length >= 2) { - if (pages[pages.length - 2].route === "sub_pages/customer/shopping/shopping") { - uni.navigateBack() - return - } - } - if (pages.length >= 10) { - //直接强制购物车 - uni.reLaunch({ - url: '/sub_pages/customer/shopping/shopping' - }) - } else { - uni.navigateTo({ - url: '/sub_pages/customer/shopping/shopping' - }) - } - - }, - openbrand() { - //也要判断一下是否重复进入 - //判断堆栈,如果是店铺,就直接返回 - //或者是:从商铺到列表再到详情,再到商铺,这种也不行 - const pages = getCurrentPages(); - console.log('toShopping', pages) - if (pages && pages.length >= 2) { - if (pages[pages.length - 2].route === "sub_pages/customer/shop/shop") { - uni.navigateBack() - return - } - } - if (pages && pages.length >= 3) { - if (pages[pages.length - 3].route === "sub_pages/customer/shop/shop" && - pages[pages.length - 2].route === "sub_pages/customer/trade/list" - ) { - uni.navigateBack({ - delta: 2 - }) - return - } - } - - if (pages.length >= 10) { - //直接强制购物车 - uni.reLaunch({ - url: '/sub_pages/customer/shop/shop?id=' + (this.dto.supplierId || '') - }) - } else { - uni.navigateTo({ - url: '/sub_pages/customer/shop/shop?id=' + (this.dto.supplierId || '') - }) - } - - } - } - } -</script> - -<style lang="scss" scoped> - .trade-detail { - background-color: #FFFFFF; - - swiper { - height: 320rpx; - } - - .swiper-box { - position: relative; - - swiper-item { - background-color: #fff; - border-radius: 8rpx; - position: relative; - - .index-tag { - position: absolute; - color: #fff; - font-size: 22rpx; - right: 10rpx; - bottom: 10rpx; - padding: 10rpx 20rpx; - text-align: center; - background-color: #545454; - border-radius: 30rpx; - } - } - } - - .image-shop-number { - width: 30rpx; - height: 30rpx; - background: #F20000; - line-height: 30rpx; - text-align: center; - position: absolute; - right: 0rpx; - top: -6rpx; - color: #FFFFFF; - border-radius: 50%; - font-size: 24rpx; - } - - - .trade-info-container { - padding: 46rpx 30rpx; - border-radius: 40rpx 40rpx 0rpx 0rpx; - - .tags { - margin-top: 12rpx; - display: flex; - + } + + + // }, 1000) + } + // #endif + if (this.id) { + this.getDetail() + } + this.refreshShopNum() + + }, + // #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 || '' + //如果是合伙人的id,那么分享出去,需要附加id了 + console.log('onShareAppMessage', this.currentInfo) + + var partnerUserId = '' + + if (that.currentInfo.customerDTO && that.currentInfo.customerDTO.partnerId) { + partnerUserId = that.currentInfo.customerDTO.partnerId + } + // if (that.currentInfo.partnerDTO && currentInfo.partnerDTO.id) { + // partnerUserId = this.currentInfo.id + // } + var url = + `/sub_pages/customer/trade/detail?partnerUserId=${partnerUserId}&id=${this.id}&shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + // + title: this.dto.id ? (this.dto.name + " " + (this.dto.price || '-') + '元/扎 ' + (this.dto.unit || '')) : + "花满芫", + path: url, + } + }, + onShareTimeline() { + let that = this; + var name = that.currentInfo.customerDTO && that.currentInfo.customerDTO.name || that.currentInfo.supplierDTO && + currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && that.currentInfo.partnerDTO.name || '' + //如果是合伙人的id,那么分享出去,需要附加id了 + var partnerUserId = '' + + if (that.currentInfo.customerDTO && that.currentInfo.customerDTO.partnerId) { + partnerUserId = that.currentInfo.customerDTO.partnerId + } + var url = + `/sub_pages/customer/trade/detail?partnerUserId=${partnerUserId}&id=${this.id}&shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + // + title: this.dto.id ? (this.dto.name + " " + (this.dto.price || '-') + '元/扎 ' + (this.dto.unit || '')) : + "花满芫", + path: url, + } + }, + // #endif + methods: { + async bindPartnerUser(userId, name) { + //调用接口绑定 + this.$message.showLoading() + const { + code, + data + } = await this.$http.request('post', '/api/customer/bind/partner', { + data: { + partnerUserId: userId + } + }) + this.$message.hideLoading() + if (code == 0) { + this.$message.showToast(`绑定合伙人${name}成功`) + await this.$store.dispatch('getCurrentInfo') + } + }, + 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('请前往登录') + uni.navigateTo({ + url: `/pages/login/supplier-login?source=jump&sharePartnerUserId=${this.sharePartnerUserId}` + }) + return + } + 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 { + return + } + this.$message.showLoading() + const { + code + } = await this.$http.request('post', '/api/customer/flower/cart/change-num', { + data: { + id: item.id, + num: addnum + } + }) + this.$message.hideLoading() + if (code === 0) { + item.shopnum += addnum + this.refreshShopNum() + this.$forceUpdate() + } + }, + + async refreshShopNum() { + this.shopnum = await this.$store.dispatch('countShopping'); + this.$store.dispatch('sign_add', 'shopnum') + + }, + async collectItem(dto) { + if (!this.currentInfo.id) { + // this.$message.showToast('请先登录') + uni.navigateTo({ + url: `/pages/login/supplier-login?source=jump&sharePartnerUserId=${this.sharePartnerUserId}` + }) + return + } + await this.$message.confirm(`是否${dto.collection?'移除':'添加到'}收藏`) + this.$message.showLoading() + const { + code, + data + } = await this.$http.request(dto.collection ? "get" : 'post', dto.collection ? '/api/collect/delete' : + '/api/collect/add', { + data: { + flowerId: dto.id + }, + params: { + flowerId: dto.id + } + }) + if (code === 0) { + this.$message.showToast('操作成功') + dto.collection = !dto.collection + this.$forceUpdate() + } + + this.$message.hideLoading() + }, + async submitShopping(dto) { + //提交到购物车中 + // this.$message.showLoading() + if (!this.currentInfo.id) { + // this.$message.showToast('请先登录') + uni.navigateTo({ + url: `/pages/login/supplier-login?source=jump&sharePartnerUserId=${this.sharePartnerUserId}` + }) + return + } + const { + code, + data + } = await this.$store.dispatch('submitShopping', dto); + // this.$message.hideLoading() + if (code == 0) { + dto.shopnum = data || 0 + this.refreshShopNum() + this.$forceUpdate() + + } + }, + async getDetail() { + var params = { + id: this.id, + } + if (this.sharePartnerUserId && !isNaN(parseInt(this.sharePartnerUserId))) { + params.partnerId = parseInt(this.sharePartnerUserId) + } + this.$message.showLoading() + const { + code, + data + } = await this.$http.request('get', '/api/customer/flower/list/view', { + params: params + }) + if (code === 0) { + this.dto = { + bannerList: [], + ...data, + } + if (!this.dto.bannerList) { + this.dto.bannerList = [] + } + if (this.dto.tags) { + this.dto.tagArr = this.dto.tags.split(",") || [] + } else { + this.dto.tagArr = [] + } + } + + this.$message.hideLoading() + + }, + toShopping() { + if (!this.currentInfo.id) { + // this.$message.showToast('请先登录') + uni.navigateTo({ + url: `/pages/login/supplier-login?source=jump&sharePartnerUserId=${this.sharePartnerUserId}` + }) + return + } + //判断堆栈,如果是购物车,就直接返回 + const pages = getCurrentPages(); + //如果上一层就是购物车,那么就返回,而不是跳转 + // console.log('toShopping',pages) + if (pages && pages.length >= 2) { + if (pages[pages.length - 2].route === "sub_pages/customer/shopping/shopping") { + uni.navigateBack() + return + } + } + if (pages.length >= 10) { + //直接强制购物车 + uni.reLaunch({ + url: '/sub_pages/customer/shopping/shopping' + }) + } else { + uni.navigateTo({ + url: '/sub_pages/customer/shopping/shopping' + }) + } + + }, + openbrand() { + //也要判断一下是否重复进入 + //判断堆栈,如果是店铺,就直接返回 + //或者是:从商铺到列表再到详情,再到商铺,这种也不行 + const pages = getCurrentPages(); + console.log('toShopping', pages) + if (pages && pages.length >= 2) { + if (pages[pages.length - 2].route === "sub_pages/customer/shop/shop") { + uni.navigateBack() + return + } + } + if (pages && pages.length >= 3) { + if (pages[pages.length - 3].route === "sub_pages/customer/shop/shop" && + pages[pages.length - 2].route === "sub_pages/customer/trade/list" + ) { + uni.navigateBack({ + delta: 2 + }) + return + } + } + + if (pages.length >= 10) { + //直接强制购物车 + uni.reLaunch({ + url: '/sub_pages/customer/shop/shop?id=' + (this.dto.supplierId || '') + }) + } else { + uni.navigateTo({ + url: '/sub_pages/customer/shop/shop?id=' + (this.dto.supplierId || '') + }) + } + + } + } + } +</script> + +<style lang="scss" scoped> + .trade-detail { + background-color: #FFFFFF; + + swiper { + height: 320rpx; + } + + .swiper-box { + position: relative; + + swiper-item { + background-color: #fff; + border-radius: 8rpx; + position: relative; + + .index-tag { + position: absolute; + color: #fff; + font-size: 22rpx; + right: 10rpx; + bottom: 10rpx; + padding: 10rpx 20rpx; + text-align: center; + background-color: #545454; + border-radius: 30rpx; + } + } + } + + .image-shop-number { + width: 30rpx; + height: 30rpx; + background: #F20000; + line-height: 30rpx; + text-align: center; + position: absolute; + right: 0rpx; + top: -6rpx; + color: #FFFFFF; + border-radius: 50%; + font-size: 24rpx; + } + + + .trade-info-container { + padding: 46rpx 30rpx; + border-radius: 40rpx 40rpx 0rpx 0rpx; + + .tags { + margin-top: 12rpx; + display: flex; + .tag { // min-width: 60rpx; padding-left: 10rpx; @@ -626,228 +620,228 @@ background: rgba(202, 229, 214, 1); border-radius: 10rpx; // opacity: 0.57; - } - } - - .title { - font-weight: 600; - font-size: 36rpx; - color: #000000; - line-height: 50rpx; - - .level { - color: #20613D; - } - } - - .button-icons { - line-height: 40rpx; - - .curnums { - padding-left: 20rpx; - padding-right: 20rpx; - } - } - - .desc { - font-weight: 400; - font-size: 28rpx; - color: #666666; - line-height: 40rpx; - } - - .price { - font-weight: 600; - font-size: 28rpx; - color: #CF0000; - line-height: 40rpx; - margin-top: -10rpx; - - .num { - font-size: 48rpx; - line-height: 66rpx; - } - } - - .icon-kf { - width: 44rpx; - height: 44rpx; - } - - .gwc { - width: 168rpx; - height: 48rpx; - border-radius: 30rpx; - border: 2rpx solid #20613D; - font-size: 24rpx; - color: #20613D; - line-height: 48rpx; - text-align: center; - } - - } - - .line { - min-height: 20rpx; - background: #F7F7F7; - } - - .info-detail { - padding: 18rpx 30rpx; - - .label { - font-weight: 400; - font-size: 28rpx; - color: #666666; - line-height: 40rpx; - min-width: 160rpx; - margin-right: 20rpx; - } - - .value { - font-weight: 400; - font-size: 28rpx; - color: #666666; - line-height: 40rpx; - } - } - - .shop-recommend-title { - font-weight: 400; - font-size: 24rpx; - color: #666666; - line-height: 34rpx; - } - - - .shop-recommend-container { - padding: 24rpx 30rpx; - - .shop-recommend { - .shop-recommend-image { - width: 214rpx; - height: 214rpx; - background-size: 100% 100%; - border-radius: 8rpx; - } - - .shop-recommend-title { - font-weight: 600; - font-size: 28rpx; - color: #000000; - line-height: 40rpx; - - .level { - color: #20613D; - ; - } - } - } - } - - .comment-container { - padding: 18rpx 30rpx; - - .desc { - font-weight: 400; - font-size: 24rpx; - color: #666666; - line-height: 34rpx; - } - - .user-item { - .user-icon { - width: 72rpx; - height: 72rpx; - background-size: 100% 100%; - border-radius: 50%; - } - - .name { - font-weight: 600; - font-size: 24rpx; - color: #000000; - line-height: 34rpx; - } - - .comment { - font-weight: 400; - font-size: 24rpx; - color: #666666; - line-height: 34rpx; - } - - .date { - font-weight: 400; - font-size: 24rpx; - color: #666666; - line-height: 72rpx; - } - } - } - - - .top-img-container { - position: relative; - - swiper { - width: 750rpx; - height: 764rpx; - } - - .top-img { - width: 750rpx; - height: 764rpx; - } - - .icon-container { - position: absolute; - top: 20rpx; - width: 80rpx; - right: 140rpx; - height: 80rpx; - background: rgba(0, 0, 0, 0.42); - border-radius: 50%; - display: flex; - - .icon-sc { - width: 54rpx; - height: 54rpx; - margin: 0 auto; - margin-top: 12rpx; - display: inline-block; - } - - .icon-shop { - width: 54rpx; - height: 54rpx; - margin: 0 auto; - margin-top: 12rpx; - display: inline-block; - margin-left: 12rpx; - position: relative; - - } - - .num { - font-weight: 400; - font-size: 20rpx; - color: #FFFFFF; - line-height: 28rpx; - position: absolute; - top: 6prx; - right: 16rpx; - } - } - - .icon-container:last-child { - right: 20rpx; - } - - // .icon-container:first-child { - // left: 40rpx; - // } - - } - } + } + } + + .title { + font-weight: 600; + font-size: 36rpx; + color: #000000; + line-height: 50rpx; + + .level { + color: #20613D; + } + } + + .button-icons { + line-height: 40rpx; + + .curnums { + padding-left: 20rpx; + padding-right: 20rpx; + } + } + + .desc { + font-weight: 400; + font-size: 28rpx; + color: #666666; + line-height: 40rpx; + } + + .price { + font-weight: 600; + font-size: 28rpx; + color: #CF0000; + line-height: 40rpx; + margin-top: -10rpx; + + .num { + font-size: 48rpx; + line-height: 66rpx; + } + } + + .icon-kf { + width: 44rpx; + height: 44rpx; + } + + .gwc { + width: 168rpx; + height: 48rpx; + border-radius: 30rpx; + border: 2rpx solid #20613D; + font-size: 24rpx; + color: #20613D; + line-height: 48rpx; + text-align: center; + } + + } + + .line { + min-height: 20rpx; + background: #F7F7F7; + } + + .info-detail { + padding: 18rpx 30rpx; + + .label { + font-weight: 400; + font-size: 28rpx; + color: #666666; + line-height: 40rpx; + min-width: 160rpx; + margin-right: 20rpx; + } + + .value { + font-weight: 400; + font-size: 28rpx; + color: #666666; + line-height: 40rpx; + } + } + + .shop-recommend-title { + font-weight: 400; + font-size: 24rpx; + color: #666666; + line-height: 34rpx; + } + + + .shop-recommend-container { + padding: 24rpx 30rpx; + + .shop-recommend { + .shop-recommend-image { + width: 214rpx; + height: 214rpx; + background-size: 100% 100%; + border-radius: 8rpx; + } + + .shop-recommend-title { + font-weight: 600; + font-size: 28rpx; + color: #000000; + line-height: 40rpx; + + .level { + color: #20613D; + ; + } + } + } + } + + .comment-container { + padding: 18rpx 30rpx; + + .desc { + font-weight: 400; + font-size: 24rpx; + color: #666666; + line-height: 34rpx; + } + + .user-item { + .user-icon { + width: 72rpx; + height: 72rpx; + background-size: 100% 100%; + border-radius: 50%; + } + + .name { + font-weight: 600; + font-size: 24rpx; + color: #000000; + line-height: 34rpx; + } + + .comment { + font-weight: 400; + font-size: 24rpx; + color: #666666; + line-height: 34rpx; + } + + .date { + font-weight: 400; + font-size: 24rpx; + color: #666666; + line-height: 72rpx; + } + } + } + + + .top-img-container { + position: relative; + + swiper { + width: 750rpx; + height: 764rpx; + } + + .top-img { + width: 750rpx; + height: 764rpx; + } + + .icon-container { + position: absolute; + top: 20rpx; + width: 80rpx; + right: 140rpx; + height: 80rpx; + background: rgba(0, 0, 0, 0.42); + border-radius: 50%; + display: flex; + + .icon-sc { + width: 54rpx; + height: 54rpx; + margin: 0 auto; + margin-top: 12rpx; + display: inline-block; + } + + .icon-shop { + width: 54rpx; + height: 54rpx; + margin: 0 auto; + margin-top: 12rpx; + display: inline-block; + margin-left: 12rpx; + position: relative; + + } + + .num { + font-weight: 400; + font-size: 20rpx; + color: #FFFFFF; + line-height: 28rpx; + position: absolute; + top: 6prx; + right: 16rpx; + } + } + + .icon-container:last-child { + right: 20rpx; + } + + // .icon-container:first-child { + // left: 40rpx; + // } + + } + } </style> \ No newline at end of file diff --git a/sub_pages/customer/trade/list.vue b/sub_pages/customer/trade/list.vue index 0909deb..5bd4f24 100644 --- a/sub_pages/customer/trade/list.vue +++ b/sub_pages/customer/trade/list.vue @@ -1,361 +1,355 @@ -<template> - <!-- 列表页面 --> - <view class="trade-list"> - <view class="category-detail flex" v-if="query.category"> - <view class="flex1 info"> - <view class="title flex"> - <button open-type="contact" class="component-button-contact"> - {{categoryInfo.name||'-'}} - <image src="../../../static/common/icon-kf.png" class="icon-kf m-l-15 img100"></image> - </button> - </view> - <view class="desc"> - 规格:{{categoryInfo.unit || '暂无'}} - </view> - <view class="desc"> - 颜色:{{categoryInfo.color || '暂无'}} - </view> - <!-- <view class="desc"> - 包袋:棉袋 - </view> --> - </view> - <view class="info-price"> - <view class="title">当日均价</view> - <view class="price">{{categoryInfo.avePrice||'暂无'}}</view> - <view class="flex desc"> - <view class="m-l-a m-r-5"> - {{categoryInfo.avePriceDifference&&categoryInfo.avePriceDifference>=0?'+':''}}{{categoryInfo.avePriceDifference||0}} - </view> - <view class="m-r-a m-l-5"> - {{categoryInfo.avePriceDifferenceRate&&categoryInfo.avePriceDifferenceRate>=0?'+':''}}{{categoryInfo.avePriceDifferenceRate||0}}% - </view> - </view> - </view> - </view> - <view class="" style="min-height: calc(100vh - 260rpx);"> - <view> - <!-- 查询条件 --> - <view class="component-filter-container"> - <!-- order_show=true --> - <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" @click.stop="$refs.popup_level.open()"> - {{ 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" @click="showSelectParams" v-if="query.category"> - 筛选 - <image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image> - </view> - </view> - </view> - <no-data v-if="!list||list.length===0" style="width: 100%;"></no-data> - - <view class="component-shop-item flex" v-for="(item,index) of list" :key="index"> - <view class="img" @click.stop="toDetail(item)"> - <image class="img img100" :class="[!item.stock?'component-stock-zero':'']" :src="item.cover"> - </image> - <view class="level"> - {{item.levelStr||''}} - </view> - </view> - - <view class="m-l-12 info-container flex1"> - <view @click.stop="toDetail(item)"> - <view class="title"> - {{item.name||'-'}} +<template> + <!-- 列表页面 --> + <view class="trade-list"> + <view class="category-detail flex" v-if="query.category"> + <view class="flex1 info"> + <view class="title flex"> + <button open-type="contact" class="component-button-contact"> + {{categoryInfo.name||'-'}} + <image src="../../../static/common/icon-kf.png" class="icon-kf m-l-15 img100"></image> + </button> + </view> + <view class="desc"> + 规格:{{categoryInfo.unit || '暂无'}} + </view> + <view class="desc"> + 颜色:{{categoryInfo.color || '暂无'}} + </view> + <!-- <view class="desc"> + 包袋:棉袋 + </view> --> + </view> + <view class="info-price"> + <view class="title">当日均价</view> + <view class="price">{{categoryInfo.avePrice||'暂无'}}</view> + <view class="flex desc"> + <view class="m-l-a m-r-5"> + {{categoryInfo.avePriceDifference&&categoryInfo.avePriceDifference>=0?'+':''}}{{categoryInfo.avePriceDifference||0}} + </view> + <view class="m-r-a m-l-5"> + {{categoryInfo.avePriceDifferenceRate&&categoryInfo.avePriceDifferenceRate>=0?'+':''}}{{categoryInfo.avePriceDifferenceRate||0}}% + </view> + </view> + </view> + </view> + <view class="" style="min-height: calc(100vh - 260rpx);"> + <view> + <!-- 查询条件 --> + <view class="component-filter-container"> + <!-- order_show=true --> + <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" @click.stop="$refs.popup_level.open()"> + {{ 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" @click="showSelectParams" v-if="query.category"> + 筛选 + <image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image> + </view> + </view> + </view> + <no-data v-if="!list||list.length===0" style="width: 100%;"></no-data> + + <view class="component-shop-item flex" v-for="(item,index) of list" :key="index"> + <view class="img" @click.stop="toDetail(item)"> + <image class="img img100" :class="[!item.stock?'component-stock-zero':'']" :src="item.cover"> + </image> + <view class="level"> + {{item.levelStr||''}} + </view> + </view> + + <view class="m-l-12 info-container flex1"> + <view @click.stop="toDetail(item)"> + <view class="title"> + {{item.name||'-'}} - <!-- #ifdef PUB_CUSTOMER_DEV --> <view class="price component-price-new"> <span class="tip">会员价</span>¥<span class="p">{{item.priceMember||item.price}}</span>/扎 <view class="component-price-old"> ¥{{item.price}}/扎 </view> </view> - <!-- #endif --> - <!-- #ifndef PUB_CUSTOMER_DEV --> - <view class="price"> - ¥{{item.price||0}}元/扎 + + + </view> + <view class="tags" v-if="item.tags"> + <!-- <view class="tag red">限时抢购</view> + <view class="tag green">品质严选</view> --> + <view class="tag red" v-for="(tag,k) of item.tagArr" :class="[k===0?'red':'green']" + :key="tag">{{ + tag + }} </view> - <!-- #endif --> - - </view> - <view class="tags" v-if="item.tags"> - <!-- <view class="tag red">限时抢购</view> - <view class="tag green">品质严选</view> --> - <view class="tag red" v-for="(tag,k) of item.tagArr" :class="[k===0?'red':'green']" - :key="tag">{{ - tag - }} - </view> - </view> - <view class="shop-name"> - {{item.supplierName}} - </view> - <view class="other-info flex"> - <view class="m-r-15"> - 已售:{{ ((item.sales||0) +(item.realSales||0)) ||0}} - </view> - <view class="m-r-15"> - 剩余:{{item.stock||0}} - </view> - <view class="m-r-15"> - {{item.unit}} - </view> - </view> - </view> - <view class="bottom-buttons flex"> - - <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> - <uni-icons v-if="!item.shopnum||item.shopnum<=99" type="plus-filled" size="32" - @click.stop="addnum(item,1)"></uni-icons> - </view> - </view> - </view> - </view> - - - <view class="icon-shop" v-if="list&&list.length>0" @click="toShopping"> - <!-- 购物图标 --> - <!-- 如果有购买的东西,就要附带数字了 --> - <view v-if="shoptotal>0" class="number"> - {{ shoptotal }} - </view> - </view> - </view> - - <!-- 判断是否到底了,自动吧 --> - <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_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> - <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_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.indexOf(each)>=0?'cur':'']" v-for="(each, j) in item.values" :key="j"> - {{ each || '-' }} - </view> - </view> - </view> - <view class="button-space"></view> - <view> - <view class="button-green" - style="background-color: #fff;border: 2rpx solid #666; color: #666;min-width: 240rpx;left: 40rpx;right: unset;" - @click="closeParamPop"> - 关闭 - </view> - - <view class="button-green" style="min-width: 240rpx;right: 40rpx;left: unset;" - @click="closeParamPopAndQuery">查询 - </view> - </view> - </view> - </uni-popup> - - </view> -</template> - -<script> - import http from "../../../plugins/http"; - - export default { - data() { - return { - query: { - name: '', - category: '', - zoneId: '', - - - params: [], - supplierName: '', - columnStr: '', - column: '', - levelStr: '', - level: '', - supplierId: '', - }, - categoryInfo: {}, - params: [], - - shoptotal: 0, - list: [], - level_show: false, - level_columns: [ - [] - ], - - order_show: false, - order_columns: [ - [] - ] - } - }, - // #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/trade/list?categoryId=${this.query.category}&zoneId=${this.query.zoneId}&name=${this.query.name}&supplierName=${this.query.supplierName}&shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 - return { - title: "花满芫-商品列表", - 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/trade/list?categoryId=${this.query.category}&zoneId=${this.query.zoneId}&name=${this.query.name}&supplierName=${this.query.supplierName}&shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 - return { - title: "花满芫-商品列表", - path: url, - } - }, - // #endif - async onLoad(options) { - // this.list = [{},{}] - console.log('options', options) - this.query.category = options.categoryId || options.category || '' - this.query.zoneId = options.zoneId || '' - this.query.name = options.name || '' - this.query.supplierName = options.supplierName || '' - this.query.supplierId = options.supplierId || '' - - - if (this.query.name) { - uni.setNavigationBarTitle({ - title: '商品列表-' + this.query.name - }) - } - if (this.query.supplierName) { - uni.setNavigationBarTitle({ - title: '商品列表-' + this.query.supplierName - }) - } - this.listApi = '/api/customer/flower/list' - 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: '' - }) - }) - if (this.query.category) { - await this.getDetail() - } - this.refreshShopNum() - - // await this.getList('post') - // this. - }, - onReachBottom() { - this.getMore('post') - }, - async onPullDownRefresh() { - this.page.current = 1 - await this.getList('post') - uni.stopPullDownRefresh() - }, - async onShow() { - if (this.sign['shopnum']) { - await this.$store.dispatch('sign_clear', 'shopnum'); - //重新获取商品数目 - //只需要刷新列表的部分信息即可 - this.getList('post') - } - this.refreshShopNum() - }, + </view> + <view class="shop-name"> + {{item.supplierName}} + </view> + <view class="other-info flex"> + <view class="m-r-15"> + 已售:{{ ((item.sales||0) +(item.realSales||0)) ||0}} + </view> + <view class="m-r-15"> + 剩余:{{item.stock||0}} + </view> + <view class="m-r-15"> + {{item.unit}} + </view> + </view> + </view> + <view class="bottom-buttons flex"> + + <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> + <uni-icons v-if="!item.shopnum||item.shopnum<=99" type="plus-filled" size="32" + @click.stop="addnum(item,1)"></uni-icons> + </view> + </view> + </view> + </view> + + + <view class="icon-shop" v-if="list&&list.length>0" @click="toShopping"> + <!-- 购物图标 --> + <!-- 如果有购买的东西,就要附带数字了 --> + <view v-if="shoptotal>0" class="number"> + {{ shoptotal }} + </view> + </view> + </view> + + <!-- 判断是否到底了,自动吧 --> + <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_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> + <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_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.indexOf(each)>=0?'cur':'']" v-for="(each, j) in item.values" :key="j"> + {{ each || '-' }} + </view> + </view> + </view> + <view class="button-space"></view> + <view> + <view class="button-green" + style="background-color: #fff;border: 2rpx solid #666; color: #666;min-width: 240rpx;left: 40rpx;right: unset;" + @click="closeParamPop"> + 关闭 + </view> + + <view class="button-green" style="min-width: 240rpx;right: 40rpx;left: unset;" + @click="closeParamPopAndQuery">查询 + </view> + </view> + </view> + </uni-popup> + + </view> +</template> + +<script> + import http from "../../../plugins/http"; + + export default { + data() { + return { + query: { + name: '', + category: '', + zoneId: '', + + + params: [], + supplierName: '', + columnStr: '', + column: '', + levelStr: '', + level: '', + supplierId: '', + }, + categoryInfo: {}, + params: [], + + shoptotal: 0, + list: [], + level_show: false, + level_columns: [ + [] + ], + + order_show: false, + order_columns: [ + [] + ] + } + }, + // #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/trade/list?categoryId=${this.query.category}&zoneId=${this.query.zoneId}&name=${this.query.name}&supplierName=${this.query.supplierName}&shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫-商品列表", + 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/trade/list?categoryId=${this.query.category}&zoneId=${this.query.zoneId}&name=${this.query.name}&supplierName=${this.query.supplierName}&shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫-商品列表", + path: url, + } + }, + // #endif + async onLoad(options) { + // this.list = [{},{}] + console.log('options', options) + this.query.category = options.categoryId || options.category || '' + this.query.zoneId = options.zoneId || '' + this.query.name = options.name || '' + this.query.supplierName = options.supplierName || '' + this.query.supplierId = options.supplierId || '' + + + if (this.query.name) { + uni.setNavigationBarTitle({ + title: '商品列表-' + this.query.name + }) + } + if (this.query.supplierName) { + uni.setNavigationBarTitle({ + title: '商品列表-' + this.query.supplierName + }) + } + this.listApi = '/api/customer/flower/list' + 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: '' + }) + }) + if (this.query.category) { + await this.getDetail() + } + this.refreshShopNum() + + // await this.getList('post') + // this. + }, + onReachBottom() { + this.getMore('post') + }, + async onPullDownRefresh() { + this.page.current = 1 + await this.getList('post') + uni.stopPullDownRefresh() + }, + async onShow() { + if (this.sign['shopnum']) { + await this.$store.dispatch('sign_clear', 'shopnum'); + //重新获取商品数目 + //只需要刷新列表的部分信息即可 + this.getList('post') + } + this.refreshShopNum() + }, methods: { getList_after() { if (this.list) { @@ -366,177 +360,177 @@ } } } - }, - async refreshShopNum() { - this.shoptotal = await this.$store.dispatch('countShopping'); - }, - async getDetail() { - this.$message.showLoading() - //获取到分类的详情信息 - const { - code, - data - } = await this.$http.request('get', '/api/customer/flower/category/tree/view', { - params: { - id: this.query.category - } - }) - this.$message.hideLoading() - if (code == 0) { - this.categoryInfo = data || {} - } - }, - updateValue(item, value) { - // item.value = value - // this.$set(item, 'value', value) - if (item.name == '优点' || item.name === '缺点') { - if (item.value.indexOf(value) < 0) { - item.value.push(value) - } else { - item.value.splice(item.value.indexOf(value), 1) - } - } else { - //单选 - item.value = [value] - } - - this.$forceUpdate() - }, - closeParamPop() { - this.$refs.popup_param.close() - }, - closeParamPopAndQuery() { - this.$refs.popup_param.close() - //设置参数 - this.query.params = [] - for (var param of this.params) { - if (param.value && param.value.length > 0) { - this.query.params.push({ - id: param.id, - value: param.value.join(',') - }) - } - } - this.refreshList('post') - }, - async showSelectParams() { - //得有分类才有参数 - this.$message.showLoading() - const res = await this.$http.request('get', '/api/customer/flower/params', { - params: { - categoryId: this.query.category - } - }) - this.$message.hideLoading() - if (res.code === 0) { - // this.columns_params = res.data || [] - this.params = res.data || [] - for (var k of this.params) { - if (!k.value) { - k.value = [] - } else { - k.value = k.value.split(',') || [] - } - } - this.$refs.popup_param.open() - } - - }, - select_level(e) { - this.level_show = false - console.log('select_level', e) - 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') - - }, - toShopping() { - if (!this.currentInfo.id) { - // await this.$message.confirm('请前往登录') - uni.navigateTo({ - url: '/pages/login/supplier-login?source=jump' - }) - return - } - //直接强制购物车 - uni.reLaunch({ - url: '/sub_pages/customer/shopping/shopping' - }) - }, - toDetail(item) { - uni.navigateTo({ - url: `/sub_pages/customer/trade/detail?id=${item.id}` - }) - }, - // mulnum(item) { - // if (item.shopnum > 0) { - // item.shopnum -= 1 - // } - // this.shoptotal -= 1 - // this.$forceUpdate() - // - // }, - async addnum(item, addnum) { - if (!this.currentInfo.id) { - // await this.$message.confirm('请前往登录') - uni.navigateTo({ - url: '/pages/login/supplier-login?source=jump' - }) - return - } - if (!item.stock) { - item.stock = 0 - } - if (!item.shopnum) { - item.shopnum = 0 - } - if (addnum > 0 & item.shopnum + addnum > item.stock) { - this.$message.showToast('库存不足,无法修改') - return - } - - if (item.shopnum + addnum >= 0) { - - } else { - return - } - this.$message.showLoading() - const { - code - } = await this.$http.request('post', '/api/customer/flower/cart/change-num', { - data: { - id: item.id, - num: addnum - } - }) - this.$message.hideLoading() - if (code === 0) { - item.shopnum += addnum - this.$forceUpdate() - - this.refreshShopNum() - - } - }, - } - } -</script> - -<style lang="scss"> - .trade-list { - padding: 24rpx 30rpx; - - .tags { - margin-top: 12rpx; - display: flex; - + }, + async refreshShopNum() { + this.shoptotal = await this.$store.dispatch('countShopping'); + }, + async getDetail() { + this.$message.showLoading() + //获取到分类的详情信息 + const { + code, + data + } = await this.$http.request('get', '/api/customer/flower/category/tree/view', { + params: { + id: this.query.category + } + }) + this.$message.hideLoading() + if (code == 0) { + this.categoryInfo = data || {} + } + }, + updateValue(item, value) { + // item.value = value + // this.$set(item, 'value', value) + if (item.name == '优点' || item.name === '缺点') { + if (item.value.indexOf(value) < 0) { + item.value.push(value) + } else { + item.value.splice(item.value.indexOf(value), 1) + } + } else { + //单选 + item.value = [value] + } + + this.$forceUpdate() + }, + closeParamPop() { + this.$refs.popup_param.close() + }, + closeParamPopAndQuery() { + this.$refs.popup_param.close() + //设置参数 + this.query.params = [] + for (var param of this.params) { + if (param.value && param.value.length > 0) { + this.query.params.push({ + id: param.id, + value: param.value.join(',') + }) + } + } + this.refreshList('post') + }, + async showSelectParams() { + //得有分类才有参数 + this.$message.showLoading() + const res = await this.$http.request('get', '/api/customer/flower/params', { + params: { + categoryId: this.query.category + } + }) + this.$message.hideLoading() + if (res.code === 0) { + // this.columns_params = res.data || [] + this.params = res.data || [] + for (var k of this.params) { + if (!k.value) { + k.value = [] + } else { + k.value = k.value.split(',') || [] + } + } + this.$refs.popup_param.open() + } + + }, + select_level(e) { + this.level_show = false + console.log('select_level', e) + 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') + + }, + toShopping() { + if (!this.currentInfo.id) { + // await this.$message.confirm('请前往登录') + uni.navigateTo({ + url: '/pages/login/supplier-login?source=jump' + }) + return + } + //直接强制购物车 + uni.reLaunch({ + url: '/sub_pages/customer/shopping/shopping' + }) + }, + toDetail(item) { + uni.navigateTo({ + url: `/sub_pages/customer/trade/detail?id=${item.id}` + }) + }, + // mulnum(item) { + // if (item.shopnum > 0) { + // item.shopnum -= 1 + // } + // this.shoptotal -= 1 + // this.$forceUpdate() + // + // }, + async addnum(item, addnum) { + if (!this.currentInfo.id) { + // await this.$message.confirm('请前往登录') + uni.navigateTo({ + url: '/pages/login/supplier-login?source=jump' + }) + return + } + if (!item.stock) { + item.stock = 0 + } + if (!item.shopnum) { + item.shopnum = 0 + } + if (addnum > 0 & item.shopnum + addnum > item.stock) { + this.$message.showToast('库存不足,无法修改') + return + } + + if (item.shopnum + addnum >= 0) { + + } else { + return + } + this.$message.showLoading() + const { + code + } = await this.$http.request('post', '/api/customer/flower/cart/change-num', { + data: { + id: item.id, + num: addnum + } + }) + this.$message.hideLoading() + if (code === 0) { + item.shopnum += addnum + this.$forceUpdate() + + this.refreshShopNum() + + } + }, + } + } +</script> + +<style lang="scss"> + .trade-list { + padding: 24rpx 30rpx; + + .tags { + margin-top: 12rpx; + display: flex; + .tag { // min-width: 60rpx; padding-left: 10rpx; @@ -555,100 +549,100 @@ background: rgba(202, 229, 214, 1); border-radius: 10rpx; // opacity: 0.57; - } - } - - .category-detail { - padding: 22rpx 38rpx; - margin-bottom: 10rpx; - background-color: #E1F0E7; - border-radius: 8rpx; - - .info { - .title { - font-weight: 600; - font-size: 36rpx; - color: #000000; - line-height: 44rpx; - } - - .icon-kf { - width: 44rpx; - height: 44rpx; - } - - .desc { - font-weight: 400; - font-size: 24rpx; - color: #666666; - line-height: 34rpx; - margin-top: 8rpx; - } - } - - - - .info-price { - padding: 22rpx; - text-align: center; - background: #FFFFFF; - border-radius: 8rpx; - min-width: 260rpx; - - .title { - font-weight: 400; - font-size: 24rpx; - color: #000000; - line-height: 34rpx; - } - - .price { - font-weight: 600; - font-size: 32rpx; - color: #BF0000; - line-height: 44rpx; - margin-top: 12rpx; - } - - .desc { - font-weight: 400; - font-size: 24rpx; - color: #666666; - line-height: 34rpx; - margin-top: 12rpx; - } - } - } - - - .icon-shop { - position: absolute; - position: fixed; - - background-image: url('../../../static/images/customer/gwc.png'); - width: 140rpx; - height: 140rpx; - // box-shadow: 0rpx 4rpx 22rpx 0rpx rgba(0, 0, 0, 0.16); - border-radius: 50%; - right: 40rpx; - bottom: 300rpx; - background-size: 100% 100%; - - .number { - width: 30rpx; - height: 30rpx; - background: #F20000; - line-height: 30rpx; - text-align: center; - position: absolute; - right: 14rpx; - top: 14rpx; - color: #FFFFFF; - border-radius: 50%; - font-size: 24rpx; - } - - } - - } + } + } + + .category-detail { + padding: 22rpx 38rpx; + margin-bottom: 10rpx; + background-color: #E1F0E7; + border-radius: 8rpx; + + .info { + .title { + font-weight: 600; + font-size: 36rpx; + color: #000000; + line-height: 44rpx; + } + + .icon-kf { + width: 44rpx; + height: 44rpx; + } + + .desc { + font-weight: 400; + font-size: 24rpx; + color: #666666; + line-height: 34rpx; + margin-top: 8rpx; + } + } + + + + .info-price { + padding: 22rpx; + text-align: center; + background: #FFFFFF; + border-radius: 8rpx; + min-width: 260rpx; + + .title { + font-weight: 400; + font-size: 24rpx; + color: #000000; + line-height: 34rpx; + } + + .price { + font-weight: 600; + font-size: 32rpx; + color: #BF0000; + line-height: 44rpx; + margin-top: 12rpx; + } + + .desc { + font-weight: 400; + font-size: 24rpx; + color: #666666; + line-height: 34rpx; + margin-top: 12rpx; + } + } + } + + + .icon-shop { + position: absolute; + position: fixed; + + background-image: url('../../../static/images/customer/gwc.png'); + width: 140rpx; + height: 140rpx; + // box-shadow: 0rpx 4rpx 22rpx 0rpx rgba(0, 0, 0, 0.16); + border-radius: 50%; + right: 40rpx; + bottom: 300rpx; + background-size: 100% 100%; + + .number { + width: 30rpx; + height: 30rpx; + background: #F20000; + line-height: 30rpx; + text-align: center; + position: absolute; + right: 14rpx; + top: 14rpx; + color: #FFFFFF; + border-radius: 50%; + font-size: 24rpx; + } + + } + + } </style> \ No newline at end of file diff --git a/sub_pages/customer/trade/trade.vue b/sub_pages/customer/trade/trade.vue index 89e84d8..8d6275c 100644 --- a/sub_pages/customer/trade/trade.vue +++ b/sub_pages/customer/trade/trade.vue @@ -1,515 +1,495 @@ -<template> - <view class="container-trade" :style="{'min-height':hidefooter?'':'calc(100vh - 20rpx)'}"> - <view class="search-container m-t-12 flex" v-if="!hidefooter"> - <!-- <view class="flex m-r-20"> - <view class="m-r-10" style="line-height: 80rpx;" @click="changeSearchType"> - {{type=='category'?'按分类':'按店铺'}} - </view> - <u-icon name="arrow-down"></u-icon> - - </view> --> - <view class="flex m-r-20"> - <um-dropdown width="200rpx" style="line-height: 80rpx;" @change="fnChange" :defaultIndex="def" rangeKey="label" :optionList="typeList"></um-dropdown> - </view> - <view class="flex1 input"> - <u-input :placeholder="type==='category'?'请输入分类名称':'请输入店铺名称'" v-model="query.name" clearable - @confirm="buttonSearchFlow" @clear="()=>{ - $nextTick(()=>{buttonSearchFlow()}) - }"> - <template slot="suffix"> - <uni-icons color="#20613D" type="search" size="24" @click="buttonSearchFlow"></uni-icons> - </template> - </u-input> - </view> - </view> - <view class="canteen-items" :style="{'min-height':hidefooter?'':'calc(100vh - 340rpx)'}"> - <view v-if="(!list||list.length==0)&&true" style="width: 100%;min-height: 200rpx;"> - - </view> - <no-data v-if="(!list||list.length==0)&&true" style="width: 100%;margin-top: 220rpx;"></no-data> - <view class="" style="display: flex;flex-wrap: inherit;" v-else> - <view class="type-list"> - <view v-for="(item,index) of list" @click="changeType(item)" - :class="[query.categoryId===item.id?'current':'']" :key="index" class="p10 flex type-item"> - {{item.name || '-'}} - </view> - </view> - <view class="canteen-item-container"> - <!-- <view class="component-filter-container" style="padding-top: 12rpx;">--> - <!-- <view class="flex1" @click="openParamPop">--> - <!-- 筛选--> - <!-- </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>--> - <!-- <u-divider></u-divider>--> - <view class="flex"> - <view v-for="(item,index) of listFilter" :key="item.id" class="canteen-item list" - @click.stop="toDetailList(item)"> - <view class="m-r-10"> - <!-- @click.stop="previewImg(item.imageUrl)" --> - <image :src="item.imageUrl" :class="[!item.stock?'':'']" mode="scaleToFill" - class="cover" :lazy-load="true"> - </image> - </view> - <view class="cateen_infos list"> +<template> + <view class="container-trade" :style="{'min-height':hidefooter?'':'calc(100vh - 20rpx)'}"> + <view class="search-container m-t-12 flex" v-if="!hidefooter"> + <view class="flex m-r-20"> + <view class="m-r-10" style="line-height: 80rpx;" @click="changeSearchType"> + {{type=='category'?'按分类':'按店铺'}} + </view> + <u-icon name="arrow-down"></u-icon> + + </view> + <view class="flex1 input"> + <u-input :placeholder="type==='category'?'请输入分类名称':'请输入店铺名称'" v-model="query.name" clearable + @confirm="buttonSearchFlow" @clear="()=>{ + $nextTick(()=>{buttonSearchFlow()}) + }"> + <template slot="suffix"> + <uni-icons color="#20613D" type="search" size="24" @click="buttonSearchFlow"></uni-icons> + </template> + </u-input> + </view> + </view> + <view class="canteen-items" :style="{'min-height':hidefooter?'':'calc(100vh - 340rpx)'}"> + <view v-if="(!list||list.length==0)&&true" style="width: 100%;min-height: 200rpx;"> + + </view> + <no-data v-if="(!list||list.length==0)&&true" style="width: 100%;margin-top: 220rpx;"></no-data> + <view class="" style="display: flex;flex-wrap: inherit;" v-else> + <view class="type-list"> + <view v-for="(item,index) of list" @click="changeType(item)" + :class="[query.categoryId===item.id?'current':'']" :key="index" class="p10 flex type-item"> + {{item.name || '-'}} + </view> + </view> + <view class="canteen-item-container"> + <!-- <view class="component-filter-container" style="padding-top: 12rpx;">--> + <!-- <view class="flex1" @click="openParamPop">--> + <!-- 筛选--> + <!-- </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>--> + <!-- <u-divider></u-divider>--> + <view class="flex"> + <view v-for="(item,index) of listFilter" :key="item.id" class="canteen-item list" + @click.stop="toDetailList(item)"> + <view class="m-r-10"> + <!-- @click.stop="previewImg(item.imageUrl)" --> + <image :src="item.imageUrl" :class="[!item.stock?'':'']" mode="scaleToFill" + class="cover" :lazy-load="true"> + </image> + </view> + <view class="cateen_infos list"> <view class="title">{{item.name}}</view> - <!-- #ifdef PUB_CUSTOMER_DEV --> - + <view class="price"> <view>会员价</view> <view>¥{{item.priceLowMember || 0}}-{{item.priceHighMember||0}}</view> </view> <view class="price component-price-old">¥{{item.priceLow || 0}}-{{item.priceHigh||0}}</view> - <!-- #endif --> - <!-- #ifndef PUB_CUSTOMER_DEV --> - <view class="price">¥{{item.priceLow || 0}}-{{item.priceHigh||0}}</view> - <!-- #endif --> - <view class="desc">在售 {{item.stock||'0'}} 扎</view> - </view> - - </view> - <view style="padding-bottom:40rpx"> - </view> - </view> - <footer-msg v-if="!hidefooter" :more="page.total>0&&page.total>page.current*page.size"></footer-msg> - - </view> - </view> - - </view> - - - - <view style="min-height:100rpx" v-if="!hidefooter"> - </view> - <common-footer flg="1" v-if="!hidefooter">></common-footer> - - <uni-popup ref="popup_param" type="bottom"> - <view class="component-popup_input_all" v-if="currentCategory&¤tCategory.params"> - <view class="text-center m-b-40" style="font-size: 48rpx;font-weight: 600;">商品参数设置</view> - <!-- 输入框--> - <view v-for="(item,i) in currentCategory.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> - <view class="button-green button-white" @click="closeParamPop">关闭</view> - <view class="button-green" @click="updateParamsAndSearch">查询</view> - </view> - </view> - </uni-popup> - </view> -</template> - -<script> - import { - mapState - } from 'vuex' - export default { - props: { - hidefooter: false, - catgoryTree: [], - supplierId: '', - }, - data() { - return { - list: [], - showpop: false, - query: { - name: '', - categoryId: '', - }, - currentCategory: {}, - type: 'category', //supplier - def: 0, - typeList:[ - { - label: '按分类', - value: 'category', - }, - { - label: '按店铺', - value: 'supplier', - }, - ], - - } - }, - // #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 = - `/pages/home/home?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 - return { - title: "花满芫", - 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 = - `/pages/home/home?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 - return { - title: "花满芫", - path: url, - } - }, - // #endif - onPullDownRefresh() { - this.$http.request('get', '/api/customer/flower/category/tree', {}).then(res => { - var data = res.data - this.list = data || [] - if (this.list.length > 0) { - this.query.categoryId = this.list[0].id || '' - this.currentCategory = this.list[0] || {} - } - }).finally(() => { - uni.stopPullDownRefresh() - }) - }, - async onLoad(options) { - let selectId = options.categoryId || '' - //加载分类 - this.$message.showLoading() - this.$http.request('get', '/api/customer/flower/category/tree', {}).then(res => { - this.$message.hideLoading() - var data = res.data - this.list = data || [] - if (this.list.length > 0) { - if (selectId) { - for (var item of this.list) { - if (item.id == selectId) { - this.query.categoryId = item.id || '' - this.currentCategory = item - break - } - } - } else { - this.query.categoryId = this.list[0].id || '' - this.currentCategory = this.list[0] || {} - } - - } - }) - }, - methods: { - fnChange(e) { - this.type = e.value - }, - changeSearchType() { - if (this.type == 'category') { - this.type = 'supplier' - this.query.name = '' - } else { - this.type = 'category' - this.query.name = '' - } - }, - maxWeightPrice(item) { - var p = 0 - if (item.weightA && item.weightA > p) { - p = item.weightA - } - if (item.weightB && item.weightB > p) { - p = item.weightB - } - if (item.weightC && item.weightC > p) { - p = item.weightC - } - if (item.weightD && item.weightD > p) { - p = item.weightD - } - if (item.weightE && item.weightE > p) { - p = item.weightE - } - if (item.weightO && item.weightO > p) { - p = item.weightO - } - return p - }, - minWeightPrice(item) { - var p = -1 - if (item.weightA && item.weightA < p) { - p = item.weightA - } - if (item.weightB && item.weightB < p) { - p = item.weightB - } - if (item.weightC && item.weightC < p) { - p = item.weightC - } - if (item.weightD && item.weightD < p) { - p = item.weightD - } - if (item.weightE && item.weightE < p) { - p = item.weightE - } - if (item.weightO && item.weightO < p) { - p = item.weightO - } - if (p < 0) { - p = 0 - } - return p - }, - refInit(catgoryTree) { - this.list = catgoryTree || [] - if (this.list.length > 0) { - this.query.categoryId = this.list[0].id || '' - this.currentCategory = this.list[0] || {} - } - }, - async updateParamsAndSearch() { - //todo 设置参数并查询 - await this.refreshList() - this.$refs.popup_param.close() - }, - openParamPop() { - //todo 同时设置查询参数为空吧 - this.$refs.popup_param.open() - }, - closeParamPop() { - this.$refs.popup_param.close() - }, - buttonSearchFlow() { - - if (this.type == 'category') { - //根据分类名称查询 - this.$message.showLoading() - this.$http.request('get', '/api/customer/flower/category/tree', { - params: { - name: this.query.name || '' - } - }).then(res => { - var data = res.data - this.list = data || [] - if (this.list.length > 0) { - this.query.categoryId = this.list[0].id || '' - this.currentCategory = this.list[0] || {} - } else { - this.query.categoryId = '' - this.currentCategory = {} - } - }).finally(() => { - this.$message.hideLoading() - }) - } else { - uni.navigateTo({ - url: '/sub_pages/customer/trade/list?' + 'supplierName=' + this.query.name - }) - - } - }, - toDetailList(item) { + + <view class="desc">在售 {{item.stock||'0'}} 扎</view> + </view> + + </view> + <view style="padding-bottom:40rpx"> + </view> + </view> + <footer-msg v-if="!hidefooter" :more="page.total>0&&page.total>page.current*page.size"></footer-msg> + + </view> + </view> + + </view> + + + + <view style="min-height:100rpx" v-if="!hidefooter"> + </view> + <common-footer flg="1" v-if="!hidefooter">></common-footer> + + <uni-popup ref="popup_param" type="bottom"> + <view class="component-popup_input_all" v-if="currentCategory&¤tCategory.params"> + <view class="text-center m-b-40" style="font-size: 48rpx;font-weight: 600;">商品参数设置</view> + <!-- 输入框--> + <view v-for="(item,i) in currentCategory.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> + <view class="button-green button-white" @click="closeParamPop">关闭</view> + <view class="button-green" @click="updateParamsAndSearch">查询</view> + </view> + </view> + </uni-popup> + </view> +</template> + +<script> + import { + mapState + } from 'vuex' + export default { + props: { + hidefooter: false, + catgoryTree: [], + supplierId: '', + }, + data() { + return { + list: [], + showpop: false, + query: { + name: '', + categoryId: '', + }, + currentCategory: {}, + type: 'category', //supplier + + + } + }, + // #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 = + `/pages/home/home?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + 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 = + `/pages/home/home?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数 + return { + title: "花满芫", + path: url, + } + }, + // #endif + onPullDownRefresh() { + this.$http.request('get', '/api/customer/flower/category/tree', {}).then(res => { + var data = res.data + this.list = data || [] + if (this.list.length > 0) { + this.query.categoryId = this.list[0].id || '' + this.currentCategory = this.list[0] || {} + } + }).finally(() => { + uni.stopPullDownRefresh() + }) + }, + async onLoad(options) { + let selectId = options.categoryId || '' + //加载分类 + this.$message.showLoading() + this.$http.request('get', '/api/customer/flower/category/tree', {}).then(res => { + this.$message.hideLoading() + var data = res.data + this.list = data || [] + if (this.list.length > 0) { + if (selectId) { + for (var item of this.list) { + if (item.id == selectId) { + this.query.categoryId = item.id || '' + this.currentCategory = item + break + } + } + } else { + this.query.categoryId = this.list[0].id || '' + this.currentCategory = this.list[0] || {} + } + + } + }) + }, + methods: { + changeSearchType() { + if (this.type == 'category') { + this.type = 'supplier' + this.query.name = '' + } else { + this.type = 'category' + this.query.name = '' + } + }, + maxWeightPrice(item) { + var p = 0 + if (item.weightA && item.weightA > p) { + p = item.weightA + } + if (item.weightB && item.weightB > p) { + p = item.weightB + } + if (item.weightC && item.weightC > p) { + p = item.weightC + } + if (item.weightD && item.weightD > p) { + p = item.weightD + } + if (item.weightE && item.weightE > p) { + p = item.weightE + } + if (item.weightO && item.weightO > p) { + p = item.weightO + } + return p + }, + minWeightPrice(item) { + var p = -1 + if (item.weightA && item.weightA < p) { + p = item.weightA + } + if (item.weightB && item.weightB < p) { + p = item.weightB + } + if (item.weightC && item.weightC < p) { + p = item.weightC + } + if (item.weightD && item.weightD < p) { + p = item.weightD + } + if (item.weightE && item.weightE < p) { + p = item.weightE + } + if (item.weightO && item.weightO < p) { + p = item.weightO + } + if (p < 0) { + p = 0 + } + return p + }, + refInit(catgoryTree) { + this.list = catgoryTree || [] + if (this.list.length > 0) { + this.query.categoryId = this.list[0].id || '' + this.currentCategory = this.list[0] || {} + } + }, + async updateParamsAndSearch() { + //todo 设置参数并查询 + await this.refreshList() + this.$refs.popup_param.close() + }, + openParamPop() { + //todo 同时设置查询参数为空吧 + this.$refs.popup_param.open() + }, + closeParamPop() { + this.$refs.popup_param.close() + }, + buttonSearchFlow() { + + if (this.type == 'category') { + //根据分类名称查询 + this.$message.showLoading() + this.$http.request('get', '/api/customer/flower/category/tree', { + params: { + name: this.query.name || '' + } + }).then(res => { + var data = res.data + this.list = data || [] + if (this.list.length > 0) { + this.query.categoryId = this.list[0].id || '' + this.currentCategory = this.list[0] || {} + } else { + this.query.categoryId = '' + this.currentCategory = {} + } + }).finally(() => { + this.$message.hideLoading() + }) + } else { + uni.navigateTo({ + url: '/sub_pages/customer/trade/list?' + 'supplierName=' + this.query.name + }) + + } + }, + toDetailList(item) { //去商品列表页面 - console.log('toDetailList',this.supplierId) - uni.navigateTo({ - url: `/sub_pages/customer/trade/list?categoryId=${item.id}&supplierId=${this.supplierId||''}` - }) - }, - changeType(item) { - this.query.categoryId = item.id || '' - this.currentCategory = item - }, - - - async submitGood() { - var values = [] - for (var item of this.list) { - if (item.shopnum > 0) { - values.push({ - id: item.id, - num: item.shopnum - }) - } - } - } - }, - computed: { - ...mapState({ - address: state => { - return state.defaultaddress || {} - }, - }), - listFilter() { - if (this.query.categoryId) { - var arr = [] - if (this.list && this.list.length > 0) { - for (var item of this.list) { - if (item.id === this.query.categoryId || item.id === this.query.categoryId) { - // arr.push(item) - return item.children || [] - } - } - } - return arr - } else { - return [] - } - - }, - } - } -</script> - -<style lang="scss" scoped> - .container-trade { - background-color: #FFFFFF; - padding-top: 20rpx; - - .search-container { - margin: 0rpx 30rpx 20rpx 30rpx; - } - - - - .type-list { - max-width: 178rpx; - width: 178rpx; - min-width: 178rpx; - background: #EEF7F5; - border-radius: 8rpx; - min-height: calc(100vh - 270rpx); - max-height: calc(100vh - 270rpx); - overflow-y: scroll; - margin-right: 16rpx; - - .type-item { - text-align: center; - font-weight: 400; - font-size: 28rpx; - color: #000000; - line-height: 88rpx; - // padding-left: 30rpx; - // padding-right: 30rpx; - } - - .type-item.current { - font-weight: 600; - font-size: 28rpx; - color: #04BA97; - } - } - - .title-before-blue.green { - padding-left: 30rpx; - padding-bottom: 0rpx; - } - - .title-before-blue:before { - color: #04BA97; - font-weight: 600; - min-width: 14rpx; - background: #04BA97; - border-radius: 8rpx; - display: inline-block; - } - - - .canteen-items { - // margin-left: 30rpx; - - .canteen-item { - margin: 0 auto; - width: 164rpx; - // width: 690rpx; - // max-width: 690rpx; - min-height: 266rpx; - background: #FFFFFF; - margin-bottom: 44rpx; - max-width: 164rpx; - - .cover { - width: 164rpx; - height: 164rpx; - background-size: 100% 100%; - border-radius: 8rpx; - border: 2rpx solid #f8f8f8; - } - - .title { - font-weight: 500; - font-size: 28rpx; - color: #000000; - line-height: 40rpx; - min-height: 80rpx; - text-align: center; - } - - .desc { - margin-top: 8rpx; - font-weight: 400; - font-size: 24rpx; - color: #6E9F66; - line-height: 34rpx; - height: 34rpx; - background-color: rgba(202, 229, 214, 0.57); - border-radius: 4rpx; - text-align: center; - - } - - .price { - font-weight: 400; - font-size: 24rpx; - color: #CF0000; - line-height: 34rpx; - text-align: center; - } - - - - - - } - - .canteen-item-container { - width: 100%; - min-height: 300rpx; - max-height: calc(100vh - 270rpx); - overflow-y: scroll; - } - - .canteen-item:nth-child(3n+1) { - margin-left: 0rpx; - margin-right: 15rpx; - } - - .canteen-item:nth-child(3n+2) { - margin-left: 15rpx; - margin-right: 15rpx; - } - - .canteen-item:nth-child(3n+3) { - margin-left: 15rpx; - margin-right: 0rpx; - } - } - - .canteen-footer-shop { - position: absolute; - position: fixed; - left: 30rpx; - bottom: 30rpx; - } - - - - } + console.log('toDetailList',this.supplierId) + uni.navigateTo({ + url: `/sub_pages/customer/trade/list?categoryId=${item.id}&supplierId=${this.supplierId||''}` + }) + }, + changeType(item) { + this.query.categoryId = item.id || '' + this.currentCategory = item + }, + + + async submitGood() { + var values = [] + for (var item of this.list) { + if (item.shopnum > 0) { + values.push({ + id: item.id, + num: item.shopnum + }) + } + } + } + }, + computed: { + ...mapState({ + address: state => { + return state.defaultaddress || {} + }, + }), + listFilter() { + if (this.query.categoryId) { + var arr = [] + if (this.list && this.list.length > 0) { + for (var item of this.list) { + if (item.id === this.query.categoryId || item.id === this.query.categoryId) { + // arr.push(item) + return item.children || [] + } + } + } + return arr + } else { + return [] + } + + }, + } + } +</script> + +<style lang="scss" scoped> + .container-trade { + background-color: #FFFFFF; + padding-top: 20rpx; + + .search-container { + margin: 0rpx 30rpx 20rpx 30rpx; + } + + + + .type-list { + max-width: 178rpx; + width: 178rpx; + min-width: 178rpx; + background: #EEF7F5; + border-radius: 8rpx; + min-height: calc(100vh - 270rpx); + max-height: calc(100vh - 270rpx); + overflow-y: scroll; + margin-right: 16rpx; + + .type-item { + text-align: center; + font-weight: 400; + font-size: 28rpx; + color: #000000; + line-height: 88rpx; + // padding-left: 30rpx; + // padding-right: 30rpx; + } + + .type-item.current { + font-weight: 600; + font-size: 28rpx; + color: #04BA97; + } + } + + .title-before-blue.green { + padding-left: 30rpx; + padding-bottom: 0rpx; + } + + .title-before-blue:before { + color: #04BA97; + font-weight: 600; + min-width: 14rpx; + background: #04BA97; + border-radius: 8rpx; + display: inline-block; + } + + + .canteen-items { + // margin-left: 30rpx; + + .canteen-item { + margin: 0 auto; + width: 164rpx; + // width: 690rpx; + // max-width: 690rpx; + min-height: 266rpx; + background: #FFFFFF; + margin-bottom: 44rpx; + max-width: 164rpx; + + .cover { + width: 164rpx; + height: 164rpx; + background-size: 100% 100%; + border-radius: 8rpx; + border: 2rpx solid #f8f8f8; + } + + .title { + font-weight: 500; + font-size: 28rpx; + color: #000000; + line-height: 40rpx; + min-height: 80rpx; + text-align: center; + } + + .desc { + margin-top: 8rpx; + font-weight: 400; + font-size: 24rpx; + color: #6E9F66; + line-height: 34rpx; + height: 34rpx; + background-color: rgba(202, 229, 214, 0.57); + border-radius: 4rpx; + text-align: center; + + } + + .price { + font-weight: 400; + font-size: 24rpx; + color: #CF0000; + line-height: 34rpx; + text-align: center; + } + + + + + + } + + .canteen-item-container { + width: 100%; + min-height: 300rpx; + max-height: calc(100vh - 270rpx); + overflow-y: scroll; + } + + .canteen-item:nth-child(3n+1) { + margin-left: 0rpx; + margin-right: 15rpx; + } + + .canteen-item:nth-child(3n+2) { + margin-left: 15rpx; + margin-right: 15rpx; + } + + .canteen-item:nth-child(3n+3) { + margin-left: 15rpx; + margin-right: 0rpx; + } + } + + .canteen-footer-shop { + position: absolute; + position: fixed; + left: 30rpx; + bottom: 30rpx; + } + + + + } </style> \ No newline at end of file -- Gitblit v1.9.3