From 4250e140336ac40e10ab4c3b650030f82098ca92 Mon Sep 17 00:00:00 2001 From: xuxy <1059738716@qq.com> Date: 星期六, 27 七月 2024 21:37:07 +0800 Subject: [PATCH] update bug和样式 --- pages/home/home.vue | 531 +++++++++++++++++--------------- sub_pages/customer/shopping/shopping.vue | 2 sub_pages/customer/self/collect.vue | 199 ++++++++--- sub_pages/customer/shop/shop.vue | 124 +++++- sub_pages/customer/trade/trade.vue | 14 App.vue | 17 pages/user/supplier-user.vue | 7 sub_pages/customer/trade/detail.vue | 43 + 8 files changed, 577 insertions(+), 360 deletions(-) diff --git a/App.vue b/App.vue index d028cdd..b46206b 100644 --- a/App.vue +++ b/App.vue @@ -234,12 +234,19 @@ padding-top: 40rpx; padding-bottom: 40rpx; font-size: var(--title_font_size2); + color: #20613D; + font-weight: 600; } .title-before-blue:before { - content: "|"; - color: #3140A2; + content: "||"; + margin-right: 20rpx; + color: #20613D; + margin-right: 20rpx; + min-width: 20rpx; + background-color: #20613D; + border-radius: 6rpx; } .blue { @@ -1085,7 +1092,7 @@ margin-right: 20rpx; border: 2rpx solid #FFFFFF; background-size: 100% 100%; - background-color: #fff; + background-color: #fff; } .store-name { @@ -1095,6 +1102,7 @@ line-height: 40rpx; margin-top: 20rpx; } + .store-name.t1 { color: #666; } @@ -1106,6 +1114,7 @@ line-height: 34rpx; margin-top: 8rpx; } + .store-address.t1 { color: #666; } @@ -1120,6 +1129,7 @@ color: #5B8C71; line-height: 52rpx; text-align: center; + margin-top: 30rpx; } .store-sc { @@ -1132,6 +1142,7 @@ color: #FFFFFF; line-height: 64rpx; display: flex; + margin-top: 20rpx; .icon-view { // margin-top: 8rpx; diff --git a/pages/home/home.vue b/pages/home/home.vue index 9fc91ee..25f867a 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -1,280 +1,319 @@ <template> - <view class="main-container user-home"> - <view class="bg-top-green"></view> - <!-- 顶部,可能 --> - <view class="school" :style="{'padding-top':(StatusBar)+'px' + <view class="main-container user-home"> + <view class="bg-top-green"></view> + <!-- 顶部,可能 --> + <view class="school" :style="{'padding-top':(StatusBar)+'px' ,height:CustomBar+'rpx','line-height':CustomBar+'rpx' }"> - <picker @change="PickerChangeSchool" :value="areaIndex" :range="schools" range-key="name"> + <!-- <picker @change="PickerChangeSchool" :value="areaIndex" :range="schools" range-key="name"> <view class="picker flex"> <uni-icons type="location" class="m-r-5" size="18"></uni-icons> <view> {{ areaIndex >= 0 && schools[areaIndex].name ? schools[areaIndex].name : '选择位置' }} </view> </view> - </picker> - </view> - <view class="search-container m-t-12 flex"> - <view class="flex1 input"> - <u-input placeholder="请输入花名" v-model="search_flow"> - <template slot="suffix"> - <uni-icons color="#20613D" type="search" size="24" @tap="buttonSearchFlow"></uni-icons> - </template> - </u-input> - </view> - </view> + </picker> --> + <view class="picker flex" @click.stop="goToAddress"> + <uni-icons type="location" class="m-r-5" size="18"></uni-icons> + <view> + {{ address&&address.id?address.address: '选择地址' }} + </view> + </view> + </view> + <view class="search-container m-t-12 flex"> + <view class="flex1 input"> + <u-input placeholder="请输入花名" v-model="search_flow"> + <template slot="suffix"> + <uni-icons color="#20613D" type="search" size="24" @tap="buttonSearchFlow"></uni-icons> + </template> + </u-input> + </view> + </view> - <!-- banner --> - <uni-swiper-dot class="uni-swiper-dot-box" @clickItem=clickItem :info="info" :current="currentBanner" - :mode="'dot'" :dots-styles="dotsStyles[0]" field="content"> - <swiper class="swiper-box" @change="changeBanner" :interval="10000" :circular="true" :current="0" - v-if="banners&&banners.length>0" :autoplay="true"> - <swiper-item v-for="(item, index) in banners" :key="index"> - <view class="swiper-item" :class="'swiper-item' + index"> - <image @click="previewImg(item.imageSmall||item.image)" class="home-banner-image" - mode="aspectFit" :src="item.imageSmall||item.image"> - </image> - </view> - </swiper-item> - </swiper> - <swiper class="swiper-box" @change="changeBanner" :current="0" v-if="!banners||banners.length==0"> - <swiper-item v-for="(item, index) in 1" :key="index"> - <view class="swiper-item" :class="'swiper-item' + index"> - <image class="home-banner-image" mode="scaleToFill" - src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/62/62ddac6297104e369aba646be704064dbanner@2x.png"> - </image> - </view> - </swiper-item> - </swiper> - </uni-swiper-dot> - <!-- tip --> - <view class="m-t-12" @click="getNoticeMore"> - <uni-notice-bar class="notice-bar" color="#333" background-color="#fff" show-get-more show-icon - :scrollable="scrollable" :text="currentNotice.title||'暂无公告'" :key="currentNotice.id"/> - <span v-if="!currentNotice||!currentNotice.id"> </span> - </view> - <!-- 当前分类 --> - <home-category></home-category> - <!-- 特别的几个公告图片 --> - <home-banner-imgs></home-banner-imgs> - <!-- 均价情况 --> - <home-price></home-price> - <!-- 几个专区 --> - <home-zones></home-zones> - <!-- 置顶的花列表 --> - <home-top-flow></home-top-flow> + <!-- banner --> + <uni-swiper-dot class="uni-swiper-dot-box" @clickItem=clickItem :info="info" :current="currentBanner" + :mode="'dot'" :dots-styles="dotsStyles[0]" field="content"> + <swiper class="swiper-box" @change="changeBanner" :interval="10000" :circular="true" :current="0" + v-if="banners&&banners.length>0" :autoplay="true"> + <swiper-item v-for="(item, index) in banners" :key="index"> + <view class="swiper-item" :class="'swiper-item' + index"> + <image @click="previewImg(item.imageSmall||item.image)" class="home-banner-image" + mode="aspectFit" :src="item.imageSmall||item.image"> + </image> + </view> + </swiper-item> + </swiper> + <swiper class="swiper-box" @change="changeBanner" :current="0" v-if="!banners||banners.length==0"> + <swiper-item v-for="(item, index) in 1" :key="index"> + <view class="swiper-item" :class="'swiper-item' + index"> + <image class="home-banner-image" mode="scaleToFill" + src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/62/62ddac6297104e369aba646be704064dbanner@2x.png"> + </image> + </view> + </swiper-item> + </swiper> + </uni-swiper-dot> + <!-- tip --> + <view class="m-t-12" @click="getNoticeMore"> + <uni-notice-bar class="notice-bar" color="#333" background-color="#fff" show-get-more show-icon + :scrollable="scrollable" :text="currentNotice.title||'暂无公告'" :key="currentNotice.id" /> + <span v-if="!currentNotice||!currentNotice.id"> </span> + </view> + <!-- 当前分类 --> + <home-category></home-category> + <!-- 特别的几个公告图片 --> + <home-banner-imgs></home-banner-imgs> + <!-- 均价情况 --> + <home-price></home-price> + <!-- 几个专区 --> + <home-zones></home-zones> + <!-- 置顶的花列表 --> + <home-top-flow></home-top-flow> - <view style="min-height:200rpx"> - </view> - <common-footer flg="0"></common-footer> + <view style="min-height:200rpx"> + </view> + <common-footer flg="0"></common-footer> - </view> + </view> </template> <script> -import homePrice from './components/home-price.vue' -import homeBannerImgs from './components/home-banner-imgs.vue' -import homeZones from './components/home-zones.vue' -import homeTopFlow from './components/home-top-flow.vue' -import homeCategory from './components/home-category.vue' + import { + mapState + } from 'vuex' + import homePrice from './components/home-price.vue' + import homeBannerImgs from './components/home-banner-imgs.vue' + import homeZones from './components/home-zones.vue' + import homeTopFlow from './components/home-top-flow.vue' + import homeCategory from './components/home-category.vue' -export default { - components: { - homeCategory, - homePrice, - homeBannerImgs, - homeZones, - homeTopFlow - }, + export default { + computed: { + ...mapState({ + address: state => { + return state.defaultaddress || {} + }, + currentInfo: state => { + return state.currentInfo || {} + }, + }), + }, + components: { + homeCategory, + homePrice, + homeBannerImgs, + homeZones, + homeTopFlow + }, - data() { - return { - search_flow: '', - CustomBar: uni.getStorageSync('CustomBar'), - StatusBar: uni.getStorageSync('StatusBar'), - // StatusBar:0, - color: '#fff', - schools: [], - areaIndex: -1, - scrollable: false, + data() { + return { + search_flow: '', + CustomBar: uni.getStorageSync('CustomBar'), + StatusBar: uni.getStorageSync('StatusBar'), + // StatusBar:0, + color: '#fff', + schools: [], + areaIndex: -1, + scrollable: false, - info: [{ - colorClass: 'uni-bg-red', - url: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/shuijiao.jpg', - content: '内容 A' - }, - { - colorClass: 'uni-bg-green', - url: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/shuijiao.jpg', - content: '内容 B' - }, - { - colorClass: 'uni-bg-blue', - url: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/shuijiao.jpg', - content: '内容 C' - } - ], - dotStyle: [{ - backgroundColor: 'rgba(0, 0, 0, .3)', - border: '1px rgba(0, 0, 0, .3) solid', - color: '#fff', - selectedBackgroundColor: 'rgba(0, 0, 0, .9)', - selectedBorder: '1px rgba(0, 0, 0, .9) solid' - }, - { - backgroundColor: 'rgba(255, 90, 95,0.3)', - border: '1px rgba(255, 90, 95,0.3) solid', - color: '#fff', - selectedBackgroundColor: 'rgba(255, 90, 95,0.9)', - selectedBorder: '1px rgba(255, 90, 95,0.9) solid' - }, - { - backgroundColor: 'rgba(83, 200, 249,0.3)', - border: '1px rgba(83, 200, 249,0.3) solid', - color: '#fff', - selectedBackgroundColor: 'rgba(83, 200, 249,0.9)', - selectedBorder: '1px rgba(83, 200, 249,0.9) solid' - } - ], - currentBanner: 0, - banners: [], - tripList: [], - tuangouList: [], - hide_footer: false, - noticeList: [], - currentNoticeIndex: 0, - currentNotice: {} - }; - }, - // onShareAppMessage() { - // let that = this; - // var url = - // `/pages/home/home?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${this.currentInfo&&this.currentInfo.nickName||''}`; //你的转发页面路径拼接参数 - // return { - // title: "校购GO小狗狗", - // path: url, - // } - // }, - // onShareTimeline() { - // let that = this; - // var url = "/pages/home/home" //你的分享页面路径 - // return { - // title: '校购GO小狗狗', - // path: url, - // query: `shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${this.currentInfo&&this.currentInfo.nickName||''}`, //你的参数拼接,注意:不需要加? - // // imageUrl: 'https://cdn.uviewui.com/uview/swiper/1.jpg' //你分享的封面 - // }; - // }, + info: [{ + colorClass: 'uni-bg-red', + url: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/shuijiao.jpg', + content: '内容 A' + }, + { + colorClass: 'uni-bg-green', + url: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/shuijiao.jpg', + content: '内容 B' + }, + { + colorClass: 'uni-bg-blue', + url: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/shuijiao.jpg', + content: '内容 C' + } + ], + dotStyle: [{ + backgroundColor: 'rgba(0, 0, 0, .3)', + border: '1px rgba(0, 0, 0, .3) solid', + color: '#fff', + selectedBackgroundColor: 'rgba(0, 0, 0, .9)', + selectedBorder: '1px rgba(0, 0, 0, .9) solid' + }, + { + backgroundColor: 'rgba(255, 90, 95,0.3)', + border: '1px rgba(255, 90, 95,0.3) solid', + color: '#fff', + selectedBackgroundColor: 'rgba(255, 90, 95,0.9)', + selectedBorder: '1px rgba(255, 90, 95,0.9) solid' + }, + { + backgroundColor: 'rgba(83, 200, 249,0.3)', + border: '1px rgba(83, 200, 249,0.3) solid', + color: '#fff', + selectedBackgroundColor: 'rgba(83, 200, 249,0.9)', + selectedBorder: '1px rgba(83, 200, 249,0.9) solid' + } + ], + currentBanner: 0, + banners: [], + tripList: [], + tuangouList: [], + hide_footer: false, + noticeList: [], + currentNoticeIndex: 0, + currentNotice: {} + }; + }, + // onShareAppMessage() { + // let that = this; + // var url = + // `/pages/home/home?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${this.currentInfo&&this.currentInfo.nickName||''}`; //你的转发页面路径拼接参数 + // return { + // title: "校购GO小狗狗", + // path: url, + // } + // }, + // onShareTimeline() { + // let that = this; + // var url = "/pages/home/home" //你的分享页面路径 + // return { + // title: '校购GO小狗狗', + // path: url, + // query: `shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${this.currentInfo&&this.currentInfo.nickName||''}`, //你的参数拼接,注意:不需要加? + // // imageUrl: 'https://cdn.uviewui.com/uview/swiper/1.jpg' //你分享的封面 + // }; + // }, - onLoad() { - // console.log('home created') - //这里进行一次初始化即可 - // this.$http.request('get', '/api/school/area/list', { + onLoad() { + // console.log('home created') + //这里进行一次初始化即可 + // this.$http.request('get', '/api/school/area/list', { - // }).then(res => { - // if (res.code == 0) { - // this.schools = res.data || [] - // } - // }) + // }).then(res => { + // if (res.code == 0) { + // this.schools = res.data || [] + // } + // }) - // uni.navigateTo({ - // url: '/sub_pages/customer/trade/detail' - // }) + // uni.navigateTo({ + // url: '/sub_pages/customer/trade/detail' + // }) - //获取banner图 - this.$http.request('get', '/api/pub/banner/list', {}).then(res => { - if (res.code == 0) { - this.banners = res.data.records || [] - } - }) + //获取banner图 + this.$http.request('get', '/api/pub/banner/list', {}).then(res => { + if (res.code == 0) { + this.banners = res.data.records || [] + } + }) - var areaIndex = uni.getStorageSync('areaIndex') - if (!areaIndex && areaIndex !== 0) { + var areaIndex = uni.getStorageSync('areaIndex') + if (!areaIndex && areaIndex !== 0) { - } else { - this.areaIndex = areaIndex - } + } else { + this.areaIndex = areaIndex + } + //如果已经登录,加载一下默认地址 + let that = this + setTimeout(()=>{ + if(that.currentInfo.id&&!that.address.id){ + that.$http.request('get', '/api/address/default/detail').then(res=>{ + if(res.data){ + that.$store.commit('setDefaultAddress', {...res.data}) + + } + }) + } + + },2000) + //公告 + this.$http.request('get', '/api/announcement/page', { + params: { + size: 5, + status: 'A' + } + }).then(res => { + if (res.code === 0) { + this.noticeList = (res.data && res.data.records || []) + console.log('this.noticeList', this.noticeList) + if (this.noticeList.length > 0) { + this.currentNotice = this.noticeList[0] + if (this.currentNotice.title && this.currentNotice.title.length >= 30) { + this.scrollable = true + } else { + this.scrollable = false + } + let that = this + if (this.noticeList.length >= 1) { + setInterval(() => { + console.log('interval,1') + that.currentNoticeIndex += 1 + that.currentNoticeIndex %= that.noticeList.length + that.currentNotice = that.noticeList[that.currentNoticeIndex] + that.scrollable = false + that.$nextTick(() => { + if (that.currentNotice.title && that.currentNotice.title + .length >= 30) { + that.scrollable = true + } else { + that.scrollable = false + } + }) + + }, 8000) + } + + } + } + }) - //公告 - this.$http.request('get', '/api/announcement/page', { - params: { - size: 5, - status: 'A' - } - }).then(res => { - if (res.code === 0) { - this.noticeList = (res.data && res.data.records || []) - console.log('this.noticeList', this.noticeList) - if (this.noticeList.length > 0) { - this.currentNotice = this.noticeList[0] - if (this.currentNotice.title && this.currentNotice.title.length >= 30) { - this.scrollable = true - } else { - this.scrollable = false - } - let that = this - if (this.noticeList.length >= 1) { - setInterval(() => { - console.log('interval,1') - that.currentNoticeIndex += 1 - that.currentNoticeIndex %= that.noticeList.length - that.currentNotice = that.noticeList[that.currentNoticeIndex] - that.scrollable = false - that.$nextTick(() => { - if (that.currentNotice.title && that.currentNotice.title - .length >= 30) { - that.scrollable = true - } else { - that.scrollable = false - } - }) + }, + methods: { + goToAddress() { + if (!this.currentInfo.id) { + this.$message.showToast('请先前往登录') + return + } + uni.navigateTo({ + url: '/pages/user/address/address?source=select' + }) + }, + buttonSearchFlow() { + console.log('buttonSearchFlow') + uni.navigateTo({ + url: '/sub_pages/trade/list?name=' + this.search_flow + }) + }, + pop(status) { + this.hide_footer = !!status + }, + changeBanner(e) { + this.currentBanner = e.detail.current + }, - }, 8000) - } - - } - } - }) + getNoticeMore() { + uni.navigateTo({ + url: '/pages/notice/list?id=' + this.currentNotice.id + }) + }, + PickerChangeSchool(e) { + if (e.detail.value == '-1') { + this.$message.showToast('未选择位置') + return + } + console.log(' this.schools', this.schools, parseInt(e.detail.value), e); - }, - methods: { - buttonSearchFlow() { - console.log('buttonSearchFlow') - uni.navigateTo({ - url: '/sub_pages/trade/list?name=' + this.search_flow - }) - }, - pop(status) { - this.hide_footer = !!status - }, - changeBanner(e) { - this.currentBanner = e.detail.current - }, + this.areaIndex = parseInt(e.detail.value) + uni.setStorageSync('areaId', this.schools[parseInt(e.detail.value)].id); + uni.setStorageSync('areaIndex', parseInt(e.detail.value)); - getNoticeMore() { - uni.navigateTo({ - url: '/pages/notice/list?id=' + this.currentNotice.id - }) - }, - PickerChangeSchool(e) { - if (e.detail.value == '-1') { - this.$message.showToast('未选择位置') - return - } - console.log(' this.schools', this.schools, parseInt(e.detail.value), e); + }, - - this.areaIndex = parseInt(e.detail.value) - uni.setStorageSync('areaId', this.schools[parseInt(e.detail.value)].id); - uni.setStorageSync('areaIndex', parseInt(e.detail.value)); - - }, - - } -} + } + } </script> <style lang="scss" scoped> -@import "./home.scss"; + @import "./home.scss"; </style> \ No newline at end of file diff --git a/pages/user/supplier-user.vue b/pages/user/supplier-user.vue index bd6f55a..cc5e22b 100644 --- a/pages/user/supplier-user.vue +++ b/pages/user/supplier-user.vue @@ -130,11 +130,14 @@ </image> <view>新手帮助</view> </view> - <view class="service-icons" @click.stop="$meesage.showToast('敬请期待')"> + <!-- <view class="service-icons" @click.stop="$meesage.showToast('敬请期待')"> <image src="../../static/images/customer/service/service-icon-6.png" class="t2 service-icon "> </image> <view>运费详查</view> - </view> + </view> --> + + <view class="service-icons"></view> + <view class="service-icons"></view> <view class="service-icons"></view> </view> diff --git a/sub_pages/customer/self/collect.vue b/sub_pages/customer/self/collect.vue index 3611207..3a6706f 100644 --- a/sub_pages/customer/self/collect.vue +++ b/sub_pages/customer/self/collect.vue @@ -1,64 +1,3 @@ -<template> - <view class="page-collect p20"> - <view class="search-container bg-white flex"> - <view class="flex1 input"> - <u-input placeholder="请输入花名" v-model="query.name"> - <template slot="suffix"> - <uni-icons color="#20613D" type="search" size="24" @tap="refreshList"></uni-icons> - </template> - </u-input> - </view> - </view> - <view class="component-filter-container p10 bg-white"> - <view class="flex1" @click.stop="order_show=true"> - {{ this.query.columnStr || '排序' }} - <image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image> - </view> - <view class="flex1" @click.stop="level_show=true"> - {{ this.query.levelStr || '级别' }} - <image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image> - </view> - </view> - <no-data v-if="!list||list.length===0" style="width: 100%;"></no-data> - - - <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> - - <view class="trade-list-container"> - <view class="trade-info-container" v-for="(dto,index) of list" :key="index"> - <view class="title"> - <view class="level m-r-15">{{ dto.levelStr || '-' }}级</view> - <view class=""> - {{ dto.name || '-' }} - </view> - </view> - <view class="desc m-t-12"> - <view class="m-r-15">已售:{{ dto.sales || 0 }}</view> - <view class="m-r-15">剩余:{{ dto.stock || 0 }}</view> - <view class=" ">{{ dto.unit || '-' }}支/扎</view> - </view> - <view class="flex m-t-12"> - <view class="price m-r-a"> - <span class="num">{{ dto.price || '-' }}</span> - 元/扎 - </view> - <view class="m-l-a m-r-15"> - <image src="../../../static/common/icon-kf.png" class="icon-kf m-l-15 img100"></image> - - </view> - <view class="m-r-0 gwc" @click="submitShopping(dto)"> - + 购物车 - </view> - </view> - </view> - - </view> - </view> -</template> - <script> export default { async onPullDownRefresh() { @@ -116,6 +55,11 @@ }) }, methods: { + toDetail(item) { + uni.navigateTo({ + url: `/sub_pages/customer/trade/detail?id=${item.id}` + }) + }, async submitShopping(dto) { //提交到购物车中 this.$message.showLoading() @@ -140,6 +84,73 @@ } </script> +<template> + <view class="page-collect " style="background: #E1F0E7;"> + <view style="padding-bottom: 0rpx;" class="p20"> + <view class="search-container flex"> + <view class="flex1 input"> + <u-input placeholder="请输入花名" v-model="query.name"> + <template slot="suffix"> + <uni-icons color="#20613D" type="search" size="24" @tap="refreshList"></uni-icons> + </template> + </u-input> + </view> + </view> + <view class="component-filter-container p10"> + <view class="flex1" @click.stop="order_show=true"> + {{ this.query.columnStr || '排序' }} + <image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image> + </view> + <view class="flex1" @click.stop="level_show=true"> + {{ this.query.levelStr || '级别' }} + <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> + + + <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> + + <view class="trade-list-container"> + <view class="trade-info-container flex" v-for="(dto,index) of list" :key="index" @click.stop="toDetail(dto)"> + <image class="img img100 br-4 m-r-10" :src="dto.url||dto.cover"></image> + <view class="flex1"> + <view class="flex"> + <view class="title"> + <span class="m-r-5" style="display: inline-block;" + v-if="item.categoryStr">{{item.categoryStr||''}}</span> + <span v-if="item.levelStr" class="m-r-5" + style="display: inline-block;">{{ item.levelStr || '' }}</span> + {{ dto.name || '-' }} + </view> + <view class="price m-l-a m-r-0"> + ¥{{ dto.price || '-' }}/扎 + </view> + </view> + <view class="flex"> + <view class="desc m-t-12 flex"> + <view class="m-r-15">剩余:{{ dto.stock || 0 }}</view> + <view class="m-r-15">颜色:{{ dto.color || '-' }}</view> + </view> + <view class="button-icons flex m-l-a m-r-0 m-t-20"> + <view class="m-r-0 gwc" @click.stop="submitShopping(dto)"> + + 购物车 + </view> + </view> + </view> + </view> + + </view> + + </view> + </view> +</template> + <style lang="scss" scoped> .page-collect { .search-container { @@ -162,5 +173,71 @@ line-height: 70rpx !important; } } + + .trade-info-container { + background-color: #fff; + border-top-right-radius: 40rpx; + border-top-left-radius: 40rpx; + padding: 30rpx; + overflow: hidden; + min-height: calc(100vh - 300rpx); + overflow-y: scroll; + + .img { + width: 124rpx; + height: 124rpx; + } + + .title { + font-weight: 600; + font-size: 28rpx; + + color: #000000; + line-height: 40rpx; + + .level { + color: #20613D; + } + } + + .price { + font-weight: 400; + font-size: 28rpx; + color: #CF0000; + line-height: 40rpx; + } + + .desc { + font-weight: 400; + font-size: 24rpx; + color: #666666; + line-height: 34rpx; + } + + + .button-icons { + //position: absolute; + //z-index: 10; + line-height: 40rpx; + + .curnums { + margin-left: 10rpx; + margin-right: 10rpx; + } + } + + .gwc { + width: 168rpx; + height: 48rpx; + border-radius: 30rpx; + border: 2rpx solid #20613D; + font-size: 24rpx; + color: #20613D; + line-height: 48rpx; + text-align: center; + } + + } + } </style> \ No newline at end of file diff --git a/sub_pages/customer/shop/shop.vue b/sub_pages/customer/shop/shop.vue index 4899b93..166571f 100644 --- a/sub_pages/customer/shop/shop.vue +++ b/sub_pages/customer/shop/shop.vue @@ -83,36 +83,40 @@ @click.stop="toDetail(item)"> <view class="img"> <image class="img img100" - src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/ff/fff3027bd0a146478fd1f0aae816a028%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20240710224139.png"> + :src="item.cover" lazy-load> </image> <view class="level"> - A级 + {{item.levelStr||''}} </view> </view> <view class="m-l-12 info-container flex1"> <view class="title"> - 橙色芭比 + {{item.name}} <view class="price"> - ¥6.60/扎 + ¥{{item.price}}/扎 </view> </view> <view class="shop-name"> - 牛油果泡泡·白色 + {{item.categoryStr}} </view> <view class="other-info flex"> <view class="m-r-15"> - 已售:7 + 已售:{{item.sales || 0}} </view> <view class="m-r-15"> - 剩余:13 + 剩余:{{item.stock || 0}} </view> <view class="m-r-15"> - 1支/扎 + {{item.unit}} </view> </view> <view class="bottom-buttons flex"> - + <view class="m-l-0 m-r-a"> + <view class="m-r-15"> + 颜色:{{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> @@ -127,7 +131,10 @@ </view> <view v-if="flg==='1'" class="brand-info-1"> - <trade :hidefooter="true"></trade> + <trade :hidefooter="true" :catgoryTree="catgoryTree" v-if="catgoryTree" ref="trade"></trade> + <!-- // 构建一个分类树 --> + <!-- catgoryTree --> + </view> <view v-if="flg==='2'" class="brand-info-3"> <view class="title"> @@ -182,32 +189,63 @@ }, ], dto: {}, - list: [{}, {}], + list: [], id: '', + catgoryTree:undefined, } }, onLoad(options) { this.id = options.id || '' + // this.page.size = if (this.id) { this.getDetail() + } + this.listApi = `/api/customer/flower/list` + this.query.supplierId = this.id + this.getList('post') + }, + onReachBottom(){ + if(this.flg==='0'){ + this.getMore('post') } }, methods: { async getDetail() { - this.$message.showLoading() - const { - code, - data - } = await this.$http.request('get', `/api/pub/supplier/detail/${this.id}`, { - params: {} - }) - if (code === 0) { - this.dto = { - ...data, + { + this.$message.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.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 关注 @@ -232,10 +270,35 @@ }, - changeTab(flg) { + async changeTab(flg) { console.log('changeTab', flg) - this.flg = ''+flg + if('1'===(''+flg)){ + if(!this.catgoryTree){ + this.$message.showLoading() + const { + code,data + } = await this.$http.request('get', `/api/customer/flower/category/tree`, { + data: { + supplierId: this.dto.supplierId || this.dto.id + }, + params: { + supplierId: this.dto.supplierId || this.dto.id + } + }) + if (code === 0) { + // data 分类树 + this.catgoryTree = data || [] + let tmp = this + this.$nextTick(()=>{ + tmp.$refs.trade.refInit(tmp.catgoryTree) + }) + } + this.$message.hideLoading() + } + } + this.flg = '' + flg //如果没有加载数据,需要加载一下 + }, buttonSearchFlow() { @@ -304,9 +367,13 @@ padding-left: 20rpx; } } - + .brand-info-1{ + // padding: 40rpx 30rpx; + + } .brand-info-3 { padding: 40rpx 30rpx; + .title { font-weight: 600; font-size: 32rpx; @@ -318,22 +385,21 @@ .form-input { display: flex; border-bottom: 2rpx solid #EEEEEE; + line-height: 80rpx; .label { font-weight: 600; font-size: 28rpx; color: #000000; - line-height: 40rpx; } .value { font-weight: 400; font-size: 28rpx; color: #666666; - line-height: 40rpx; margin-left: auto; margin-right: 0; - + text-align: right; .check { diff --git a/sub_pages/customer/shopping/shopping.vue b/sub_pages/customer/shopping/shopping.vue index 30d8998..20252e0 100644 --- a/sub_pages/customer/shopping/shopping.vue +++ b/sub_pages/customer/shopping/shopping.vue @@ -27,7 +27,7 @@ <u-swipe-action-item :options="options1" @click="(e)=>{clickSwipeButton(dto)}"> <view class="item-each flex"> <radio :checked="ids.indexOf(dto.id)>=0" @click="changeItem(dto,'flower')"></radio> - <image class="img img100 m-r-6" :src="dto.url||dto.cover"></image> + <image class="img img100 m-r-6 br-4" :src="dto.url||dto.cover"></image> <view class="flex1"> <view class="title"><span class="m-r-5" style="display: inline-block;">{{item.categoryStr||''}}</span><span diff --git a/sub_pages/customer/trade/detail.vue b/sub_pages/customer/trade/detail.vue index af290b5..12e11ce 100644 --- a/sub_pages/customer/trade/detail.vue +++ b/sub_pages/customer/trade/detail.vue @@ -3,7 +3,12 @@ <view class="top-img-container"> <image :src="dto.cover" class="top-img" mode="aspectFill"></image> <view class="icon-container"> - <image src="../../../static/common/icon-sc.png" @click="collectItem(dto)" class="icon-sc"></image> + <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.png" @click="collectItem(dto)" + class="icon-sc"></image> + + <!-- <view class="num">12</view>--> </view> <view class="icon-container"> @@ -14,7 +19,7 @@ </view> <view class="trade-info-container"> <view class="title flex"> - <view class="level m-r-15">{{ dto.levelStr || '-' }}级</view> + <view class="level m-r-15">{{ dto.levelStr || '-' }}</view> <view class=""> {{ dto.name || '-' }} </view> @@ -133,21 +138,27 @@ } }, methods: { - async collectItem(dto){ - await this.$message.confirm('是否添加到收藏') + async collectItem(dto) { + await this.$message.confirm(`是否${dto.collection?'移除':'添加到'}收藏`) this.$message.showLoading() const { code, data - } = await this.$http.request('post', '/api/collect/add', { - data: { - flowerId: dto.id - } - }) + } = await this.$http.request(dto.collection ? "get" : 'post', dto.collection ? '/api/collect/delete' : + '/api/collect/add', { + data: { + flowerId: dto.id + }, + params: { + id: dto.id + } + }) if (code === 0) { - this.$message.showToast('收藏成功') + this.$message.showToast('操作成功') + dto.collection = !dto.collection + this.$forceUpdate() } - + this.$message.hideLoading() }, async submitShopping(dto) { @@ -353,10 +364,12 @@ position: absolute; top: 20rpx; width: 80rpx; - left: 40rpx; + right: 140rpx; height: 80rpx; - background: rgba(0, 0, 0, 0); - + background: rgba(0, 0, 0, 0.42); + border-radius: 50%; + display:flex; + .icon-sc { width: 54rpx; height: 54rpx; @@ -386,7 +399,7 @@ } .icon-container:last-child { - left: 100rpx; + right: 20rpx; } // .icon-container:first-child { diff --git a/sub_pages/customer/trade/trade.vue b/sub_pages/customer/trade/trade.vue index cf1a60b..c4b6347 100644 --- a/sub_pages/customer/trade/trade.vue +++ b/sub_pages/customer/trade/trade.vue @@ -1,5 +1,5 @@ <template> - <view class="container-trade" style="min-height: calc(100vh - 20rpx );"> + <view class="container-trade" :style="{'min-height':hidefooter?'':'calc(100vh - 20rpx)'}"> <view class="search-container m-t-12 flex" v-if="!(!list||list.length==0)&&true&&!hidefooter"> <view class="flex1 input"> <u-input placeholder="请输入分类名称" v-model="query.name"> @@ -9,7 +9,7 @@ </u-input> </view> </view> - <view class="canteen-items" style="min-height: calc(100vh - 160rpx);"> + <view class="canteen-items" :style="{'min-height':hidefooter?'':'calc(100vh - 160rpx)'}"> <view v-if="(!list||list.length==0)&&true" style="width: 100%;min-height: 200rpx;"> </view> @@ -59,7 +59,7 @@ </view> </view> - <footer-msg + <footer-msg v-if="!hidefooter" :more="page.total>0&&page.total>page.current*page.size"></footer-msg> </view> @@ -103,6 +103,7 @@ export default { props: { hidefooter: false, + catgoryTree:[], }, data() { return { @@ -143,6 +144,13 @@ }) }, methods: { + 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() -- Gitblit v1.9.3