From e998d551df1c96572838bbf661be938aa79d1be8 Mon Sep 17 00:00:00 2001 From: xuxueyang <xuxy@fengyuntec.com> Date: 星期四, 25 七月 2024 15:01:16 +0800 Subject: [PATCH] fix bug --- sub_pages/customer/trade/list.vue | 97 +++++++--- environments/index.js | 3 pages/home/components/home-price.vue | 6 pages/home/home.vue | 6 sub_pages/customer/shopping/shopping.vue | 178 ++++++++++--------- sub_pages/customer/self/follow.vue | 2 manifest.json | 17 - pages/home/components/home-zones.vue | 8 sub_pages/customer/trade/trade.vue | 44 ++-- pages/home/components/home-category.vue | 136 ++++++++------ pages/user/supplier-user.vue | 12 11 files changed, 284 insertions(+), 225 deletions(-) diff --git a/environments/index.js b/environments/index.js index def5df2..fe5ed5a 100644 --- a/environments/index.js +++ b/environments/index.js @@ -1,7 +1,8 @@ export default { - httpBaseUri: 'https://www.hmyxianhua.com/flower', + // httpBaseUri: 'https://www.hmyxianhua.com/flower', // httpBaseUri: 'http://47.99.58.211/flower', + httpBaseUri: 'http://localhost:8080/flower', clientId: '', secret: '', diff --git a/manifest.json b/manifest.json index 9ab5b86..651a10c 100644 --- a/manifest.json +++ b/manifest.json @@ -49,22 +49,19 @@ "quickapp" : {}, /* 快应用特有相关 */ "mp-weixin" : { - "appid" : "wx6d0ecc4e18710458", + "appid" : "wx1441324401626290", "setting" : { "urlCheck" : false, "es6" : true, "minified" : true }, "usingComponents" : true, - "permission" : { - - }, - "plugins" : { - "chooseLocation" : { - "version" : "1.0.10", - "provider" : "wx76a9a06e5b4e693e" - } - } + "permission" : {}, + "plugins" : {} }, + // "chooseLocation" : { + // "version" : "1.0.10", + // "provider" : "wx76a9a06e5b4e693e" + // } "vueVersion" : "2" } diff --git a/pages/home/components/home-category.vue b/pages/home/components/home-category.vue index 1768fea..c16284c 100644 --- a/pages/home/components/home-category.vue +++ b/pages/home/components/home-category.vue @@ -1,69 +1,89 @@ <template> - <view class="home-category"> - <view class="flex"> - <view class="t1">06-03(今日)第一场交易中</view> - <view class="t2">当前在售123435扎</view> - </view> - <view class="m-t-12 flex"> - <view class="item" v-for="(item,index) of list" :key="index"> - <image class="icon img100" :src="item.url"></image> - <view>{{item.name || '-'}}</view> - </view> - </view> - </view> + <view class="home-category"> + <view class="flex"> + <view class="t1">06-03(今日)第一场交易中</view> + <view class="t2">当前在售123435扎</view> + </view> + <view class="m-t-12 flex"> + <view class="item" v-for="(item,index) of list" :key="index" @click.stop="toList(item)"> + <image class="icon img100" :src="item.url"></image> + <view>{{ item.name || '-' }}</view> + </view> + </view> + </view> </template> <script> - export default { - beforeMount() { - for (var i = 0; i < 10; i++) { - this.list.push({ - 'url': 'https://hmy-flower.oss-cn-shanghai.aliyuncs.com/e2/e2ee2fa7cdef458ba748261305edc57435549b9113807b6fbbfd4bfa456334d.png', - 'name': '玫瑰' - }) - } - }, - data() { - return { - list: [], +export default { + beforeMount() { + // for (var i = 0; i < 10; i++) { + // this.list.push({ + // 'url': 'https://hmy-flower.oss-cn-shanghai.aliyuncs.com/e2/e2ee2fa7cdef458ba748261305edc57435549b9113807b6fbbfd4bfa456334d.png', + // 'name': '玫瑰' + // }) + // } + this.$http.request('get', '/api/customer/flower/category/tree', {}).then(res => { + var data = res.data + this.list = [] + var arr = data || [] + for (let i = 0; i < arr.length && i < 10; i++) { + this.list.push({ + id: arr[i].id, + name: arr[i].name, + url: arr[i].imageUrl + }) + } + }) + }, + methods: { + toList(item){ + uni.navigateTo({ + url:'//sub_pages/customer/trade/list?categoryId='+item.id + }) + } + }, + data() { + return { + list: [], - }; - } - } + }; + } +} </script> <style lang="scss"> - .home-category { - .item { - text-align: center; - font-weight: 400; - font-size: 28rpx; - color: #000000; - line-height: 40rpx; - min-width: 20%; - margin-bottom: 28rpx; - .icon { - width: 94rpx; - height: 94rpx; - border-radius: 50%; - } - } +.home-category { + .item { + text-align: center; + font-weight: 400; + font-size: 28rpx; + color: #000000; + line-height: 40rpx; + min-width: 20%; + margin-bottom: 28rpx; - .t1 { - font-size: 28rpx; - color: #333333; - line-height: 50rpx; - font-weight: 600; - } + .icon { + width: 94rpx; + height: 94rpx; + border-radius: 50%; + } + } - .t2 { - margin-left: auto; - padding: 8rpx; - font-size: 24rpx; - color: #5B8C71; - line-height: 34rpx; - background: #E1F0E7; - border-radius: 4rpx; - } - } + .t1 { + font-size: 28rpx; + color: #333333; + line-height: 50rpx; + font-weight: 600; + } + + .t2 { + margin-left: auto; + padding: 8rpx; + font-size: 24rpx; + color: #5B8C71; + line-height: 34rpx; + background: #E1F0E7; + border-radius: 4rpx; + } +} </style> \ No newline at end of file diff --git a/pages/home/components/home-price.vue b/pages/home/components/home-price.vue index b96ad7d..779db45 100644 --- a/pages/home/components/home-price.vue +++ b/pages/home/components/home-price.vue @@ -2,7 +2,7 @@ <view class="home-price"> <view class="flex t1"> <view>2024-06-03 09:20:19 花满芫成交均价</view> - <uni-icons class="m-l-a m-r-0" type="right"></uni-icons> +<!-- <uni-icons class="m-l-a m-r-0" type="right"></uni-icons>--> </view> <view class="items" style="border-top: 2rpx solid #EEEEEE;"> <view class="flex" style="border-bottom: 2rpx solid #EEEEEE;padding-top: 24rpx;"> @@ -87,11 +87,11 @@ list2: [], }; }, - mounted() { + async mounted() { const { data - } = await this.$http.request('get', '/api/pub/customer/home', { + } = await this.$http.request('get', '/api/pub/customer/home/category/price/ave', { size: 6, }) var list = data && data.records || [] diff --git a/pages/home/components/home-zones.vue b/pages/home/components/home-zones.vue index 30b2c15..f7bb51b 100644 --- a/pages/home/components/home-zones.vue +++ b/pages/home/components/home-zones.vue @@ -1,7 +1,7 @@ <template> <view class="home-zones"> <view class="c" v-for="(item,index) of list"> - <image class="p1 img100 m-t-12" :lazy-load="true" mode="aspectFit" + <image class="p1 img100 m-t-12" :lazy-load="true" mode="aspectFill" :src="item.bgUrl"> </image> <view class="c-txt-1"> @@ -79,11 +79,15 @@ }) }, }, - onLoad() { + mounted() { + console.log('init hone zones') this.$http.request('get', '/api/flower/zone/list', {}).then(res => { this.list = res.data || [] }) }, + onLoad() { + + }, } </script> diff --git a/pages/home/home.vue b/pages/home/home.vue index 1059f80..7d94fbe 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -176,14 +176,14 @@ // if (res.code == 0) { // this.schools = res.data || [] // } - // }) + // }) // uni.navigateTo({ // url: '/sub_pages/customer/trade/detail' // }) //获取banner图 - this.$http.request('get', '/api/ua/banner/list', { + this.$http.request('get', '/api/pub/banner/list', { }).then(res => { if (res.code == 0) { @@ -201,7 +201,7 @@ //公告 - this.$http.request('get', '/api/ua/announcement/list', { + this.$http.request('get', '/api/announcement/page', { params: { size: 5, status: 'A' diff --git a/pages/user/supplier-user.vue b/pages/user/supplier-user.vue index bcd715d..855d5bb 100644 --- a/pages/user/supplier-user.vue +++ b/pages/user/supplier-user.vue @@ -64,29 +64,29 @@ <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')">全部订单 + <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" @click="goto('/pages/order/order?status=PENDING')"> + <view class="order-icons" @click="goto('/pages/order/order?status=PENDING',true)"> <image src="../../static/images/customer/order/order-type-1.png" class="order-icon dfk"></image> <view>待付款</view> </view> - <view class="order-icons"> + <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"></image> <view>待发货</view> </view> - <view class="order-icons"> + <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"></image> <view>待收货</view> </view> - <view class="order-icons"> + <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"></image> <view>待评价</view> </view> - <view class="order-icons"> + <view class="order-icons" @click="goto('/pages/order/order?status=COMPLETED',true)"> <image src="../../static/images/customer/order/order-type-5.png" class="order-icon sh"></image> <view>售后</view> </view> diff --git a/sub_pages/customer/self/follow.vue b/sub_pages/customer/self/follow.vue index dd70359..3624dbf 100644 --- a/sub_pages/customer/self/follow.vue +++ b/sub_pages/customer/self/follow.vue @@ -110,7 +110,7 @@ .button-2 { border-radius: 34rpx; - border: 2rpx solid #20613D + border: 2rpx solid #20613D; color: #20613D; } } diff --git a/sub_pages/customer/shopping/shopping.vue b/sub_pages/customer/shopping/shopping.vue index 54ca191..96f93dd 100644 --- a/sub_pages/customer/shopping/shopping.vue +++ b/sub_pages/customer/shopping/shopping.vue @@ -1,14 +1,14 @@ <template> <view class="shopping-container"> - <view class="top-title"> 苏州市一价全含,市区内包邮派送到店 + <view class="top-title"><span class="t-red">*</span> 苏州市一价全含,市区内包邮派送到店 </view> <view class="top-desc"> 全程鲜花冷链专线,时效快,损耗小 </view> - <view class="flex"> - <image class="icon-clock m-r-6" src="../../../static/common/icon-call.png"></image> + <view class="flex top-kf"> + <image class="icon-clock m-r-6" src="../../../static/common/icon-kf.png"></image> <view class="name"> - 客服电话 : <span class="topic-gray">{{ tel }}</span> + 15974805814 </view> </view> <view class=""> @@ -54,14 +54,14 @@ <view style="min-height:200rpx"> </view> <view class="bottom-price flex"> - <view> - <radio :checked="checkall" @change="selectAll"></radio> + <view class="m-t-12"> + <radio :checked="checkall" @click="selectAll"></radio> 全选 </view> - <view> - 合计:¥ {{ totalprice }} 元 + <view class="m-t-12 m-l-a m-r-20 text-center"> + 合计:<span class="t-red">¥ {{ totalprice || 0 }}</span> 元 </view> - <view class="button-green-1"> + <view class="button-green-1 m-l-a m-r-0" style="min-width: 240rpx"> 提交订单 </view> </view> @@ -97,8 +97,8 @@ totalprice() { let totalprice = 0 - this.list.forEach(dto => { - dto.flowerList.forEach(item => { + this.list && this.list.forEach(dto => { + dto.flowerList && dto.flowerList.forEach(item => { if (this.ids.indexOf(item.id) >= 0) { totalprice += item.price * item.num } @@ -176,87 +176,91 @@ } } } - } - }, - selectAll() { - if (this.checkall) { - this.ids = [] - this.checkall = false - } else { - list.for(dto => { + }, + + selectAll() { + console.log('selectAll', this.checkall) + if (this.checkall) { + this.ids = [] + this.checkall = false + // this.$forceUpdate() + } else { + this.list.forEach(dto => { + if (this.ids.indexOf(dto.id) < 0) { + this.ids.push(dto.id) + } + dto.flowerList.forEach(item => { + if (this.ids.indexOf(item.id) < 0) { + this.ids.push(item.id) + } + }) + }) + this.checkall = true + } + }, + changeItem(dto, type) { + if (type === 'supplier') { + //全选上 if (this.ids.indexOf(dto.id) < 0) { this.ids.push(dto.id) + dto.flowerList.forEach(item => { + if (this.ids.indexOf(item.id) < 0) { + this.ids.push(item.id) + } + }) + } else { + this.checkall = false + this.ids.splice(this.ids.indexOf(dto.id), 1) + dto.flowerList.forEach(item => { + this.ids.splice(this.ids.indexOf(item.id), 1) + }) } - dto.flowerList.forEach(item => { - if (this.ids.indexOf(item.id) < 0) { - this.ids.push(item.id) - } - }) - }) - } - }, - changeItem(dto, type) { - if (type === 'supplier') { - //全选上 - if (this.ids.indexOf(dto.id) < 0) { - this.ids.push(dto.id) - dto.flowerList.forEach(item => { - if (this.ids.indexOf(item.id) < 0) { - this.ids.push(item.id) - } - }) + } else { - this.checkall = false - this.ids.splice(this.ids.indexOf(dto.id), 1) - dto.flowerList.forEach(item => { - this.ids.splice(this.ids.indexOf(item.id), 1) - }) - } + //更换个人的 + if (this.ids.indexOf(dto.id) < 0) { + this.ids.push(dto.id) + } else { + this.checkall = false - } else { - //更换个人的 - if (this.ids.indexOf(dto.id) < 0) { - this.ids.push(dto.id) - } else { - this.checkall = false - - if (this.ids.indexOf(dto.supplierId) >= 0) { - this.ids.splice(this.ids.indexOf(dto.supplierId), 1) - } - } - - } - }, - async addnum(dto, addnum) { - if (dto.num + addnum >= 0) { - - } else { - return - } - this.$message.showLoading() - const {code} = await http.request('post', '/api/api/customer/flower/cart/change-num', { - data: { - id: dto.id, - num: addnum + if (this.ids.indexOf(dto.supplierId) >= 0) { + this.ids.splice(this.ids.indexOf(dto.supplierId), 1) } } - ) - this.$message.hideLoading() - if (code === 0) { - dto.num += addnum + + } + }, + async addnum(dto, addnum) { + if (dto.num + addnum >= 0) { + + } else { + return + } + this.$message.showLoading() + const {code} = await http.request('post', '/api/api/customer/flower/cart/change-num', { + data: { + id: dto.id, + num: addnum + } + } + ) + this.$message.hideLoading() + if (code === 0) { + dto.num += addnum + } + }, + async init() { + this.$message.showLoading() + await this.$store.dispatch('sign_clear', 'shopping'); + const {code, data} = await this.$http.request('get', '/api/customer/flower/cart/list', {}) + this.$message.hideLoading() + this.list = [] + if (code === 0) { + this.list = data.list || [] + + } } }, - async init() { - this.$message.showLoading() - await this.$store.dispatch('sign_clear', 'shopping'); - const {code, data} = await this.$http.request('get', '/api/customer/flower/cart/list', {}) - this.$message.hideLoading() - this.list = [] - if (code === 0) { - this.list = data.list || [] - - } - } } } </script> @@ -268,6 +272,7 @@ .bottom-price { position: fixed; + background-color: #ffffff; left: 0rpx; padding: 20rpx; right: 0rpx; @@ -323,15 +328,15 @@ } .top-title { - font-size: 28rpx; + font-size: 32rpx; color: #000000; line-height: 40rpx; } .top-desc { - font-size: 24rpx; + font-size: 28rpx; color: #666666; - line-height: 34rpx; + line-height: 40rpx; } .top-kf { @@ -339,6 +344,7 @@ border-radius: 8rpx; font-weight: 400; font-size: 24rpx; + margin-top: 10rpx; color: #20613D; line-height: 52rpx; height: 52rpx; diff --git a/sub_pages/customer/trade/list.vue b/sub_pages/customer/trade/list.vue index 3f7e9f7..1af11b2 100644 --- a/sub_pages/customer/trade/list.vue +++ b/sub_pages/customer/trade/list.vue @@ -58,8 +58,8 @@ </view> <view class="component-shop-item flex" v-for="(item,index) of list" :key="index" - @click="toDetail(item)"> - <view class="img"> + > + <view class="img" @click.stop="toDetail(item)"> <image class="img img100" src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/ff/fff3027bd0a146478fd1f0aae816a028%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20240710224139.png"> </image> @@ -69,41 +69,43 @@ </view> <view class="m-l-12 info-container flex1"> - <view class="title"> - 橙色芭比 - <view class="price"> - ¥6.60/扎 + <view @click.stop="toDetail(item)"> + <view class="title"> + 橙色芭比 + <view class="price"> + ¥6.60/扎 + </view> </view> - </view> - <view class="shop-name"> - 牛油果泡泡·白色 - </view> - <view class="other-info flex"> - <view class="m-r-15"> - 已售:7 + <view class="shop-name"> + 牛油果泡泡·白色 </view> - <view class="m-r-15"> - 剩余:13 - </view> - <view class="m-r-15"> - 1支/扎 + <view class="other-info flex"> + <view class="m-r-15"> + 已售:7 + </view> + <view class="m-r-15"> + 剩余:13 + </view> + <view class="m-r-15"> + 1支/扎 + </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="mulnum(item)"></uni-icons> + @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)"></uni-icons> + @click.stop="addnum(item,1)"></uni-icons> </view> </view> </view> </view> - <view class="icon-shop" v-if="list&&list.length>0"> + <view class="icon-shop" v-if="list&&list.length>0" @click="goto('/sub_pages/customer/shopping/shopping',true)"> <!-- 购物图标 --> <!-- 如果有购买的东西,就要附带数字了 --> <view v-if="shoptotal>0" class="number"> @@ -149,6 +151,8 @@ </template> <script> +import http from "../../../plugins/http"; + export default { data() { return { @@ -178,7 +182,7 @@ this.query.category = options.categoryId || '' this.query.zoneId = options.zoneId || '' this.listApi = '/api/customer/flower/list' - this.getList() + this.getList('post') this.$http.request('get', '/api/code/value', { params: { type: 'FLOWER_LEVEL' @@ -274,21 +278,48 @@ url: `/sub_pages/customer/trade/detail?id=${item.id}` }) }, - mulnum(item) { - if (item.shopnum > 0) { - item.shopnum -= 1 + // 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/user/supplier-user' + }) + return } - this.shoptotal -= 1 - this.$forceUpdate() + if (!item.shopnum) { + item.shopnum = 0 + } + if (item.shopnum + addnum >= 0) { - }, - addnum(item) { - if (item.shopnum) { - item.shopnum += 1 } else { - item.shopnum = 1 + return } - this.shoptotal += 1 + this.$message.showLoading() + const {code} = await http.request('post', '/api/api/customer/flower/cart/change-num', { + data: { + id: item.id, + num: addnum + } + } + ) + this.$message.hideLoading() + if (code === 0) { + item.shopnum += addnum + } + // if (item.shopnum) { + // item.shopnum += 1 + // } else { + // item.shopnum = 1 + // } + // this.shoptotal += 1 this.$forceUpdate() }, } diff --git a/sub_pages/customer/trade/trade.vue b/sub_pages/customer/trade/trade.vue index c232d78..493cd48 100644 --- a/sub_pages/customer/trade/trade.vue +++ b/sub_pages/customer/trade/trade.vue @@ -17,23 +17,23 @@ <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"> + :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="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)"> @@ -86,10 +86,10 @@ </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 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> @@ -140,11 +140,11 @@ } }) }, - methods: { - async updateParamsAndSearch(){ - //todo 设置参数并查询 - await this.refreshList() - this.$refs.popup_param.close() + methods: { + async updateParamsAndSearch(){ + //todo 设置参数并查询 + await this.refreshList() + this.$refs.popup_param.close() }, openParamPop() { //todo 同时设置查询参数为空吧 -- Gitblit v1.9.3