From fe80801123abe5096dae9c5ad1c443c10124d435 Mon Sep 17 00:00:00 2001
From: 陶杰 <1378534974@qq.com>
Date: 星期一, 14 十月 2024 16:34:26 +0800
Subject: [PATCH] 1.商品限购,只有有数据的才展示 2.花店-设置布局重写 3.花店-广告功能
---
pages/home/components/home-banner-imgs.vue | 17 +
sub_pages/customer/trade/list.vue | 2
sub_pages/customer/shopping/shopping.vue | 2
pages.json | 14 +
pages/advertising/advertising.vue | 271 ++++++++++++++++++++++++
sub_pages/supplier/flower-manage/flower-manage.vue | 2
sub_pages/customer/setup/setup.vue | 303 +++++++++++++++++++++++++++
pages/user/supplier-user.vue | 5
8 files changed, 606 insertions(+), 10 deletions(-)
diff --git a/pages.json b/pages.json
index 99ba70c..30737c8 100644
--- a/pages.json
+++ b/pages.json
@@ -73,6 +73,13 @@
}
},
{
+ "path": "pages/advertising/advertising",
+ "style": {
+ "navigationBarTitleText": "广告",
+ "enablePullDownRefresh": true
+ }
+ },
+ {
"path": "pages/user/user-pwd/user-pwd",
"style": {
"navigationBarTitleText": "修改密码",
@@ -370,6 +377,13 @@
"pages": [
// #ifdef PUB_CUSTOMER
{
+ "path": "setup/setup",
+ "style": {
+ "navigationBarTitleText": "设置",
+ "enablePullDownRefresh": false
+ }
+ },
+ {
"path": "customer-info/customer-info",
"style": {
"navigationBarTitleText": "信息维护",
diff --git a/pages/advertising/advertising.vue b/pages/advertising/advertising.vue
new file mode 100644
index 0000000..c83d4ba
--- /dev/null
+++ b/pages/advertising/advertising.vue
@@ -0,0 +1,271 @@
+<template>
+ <view class="travel-detail">
+ <view v-if="dto.id">
+ <!-- 标题、价格、时间、地点 -->
+ <view class="infos">
+ <view class="name">{{dto.name||dto.title||'暂无标题'}}</view>
+ </view>
+ <view style="background: #F5F5F5;height: 24rpx;">
+
+ </view>
+ <view class="bg-white p10">
+ <image :src="dto.cover" v-if="dto.cover" mode="aspectFit" class="m-t-8"
+ style="display: block;margin: 0 auto;" @click="previewImg(dto.cover)"></image>
+
+ </view>
+ <!-- <uni-swiper-dot class="uni-swiper-dot-box" :mode="'dot'" field="content" v-if="dto.url&&dto.url.length>0">
+ <swiper class="swiper-box" :interval="10000" :circular="true" :current="0" :autoplay="true">
+ <swiper-item v-for="(url, index) in dto.url" :key="index">
+ <view class="swiper-item" :class="'swiper-item' + index">
+
+ <image class="home-banner-image" mode="scaleToFill" @click="previewImg(url)" :src="url">
+ </image>
+ </view>
+ </swiper-item>
+ </swiper>
+ </uni-swiper-dot> -->
+
+ <view style="background: #F5F5F5;height: 24rpx;">
+
+ </view>
+
+ <!-- 活动描述 -->
+ <view class="info-desc">
+ <view class="title">广告描述</view>
+ <view v-html="dto.content||'暂无'" class="rich" style="overflow: scroll;">
+
+ </view>
+ </view>
+
+ </view>
+ </view>
+</template>
+
+<script>
+ export default {
+ data() {
+ return {
+ dto: {
+ // url: [],
+ },
+ peoples: [],
+ id: ''
+ };
+ },
+ async onLoad(options) {
+ this.id = options.id || ''
+ await this.init()
+
+ },
+ async onPullDownRefresh() {
+ await this.init()
+ uni.stopPullDownRefresh()
+ },
+ methods: {
+ async init() {
+ this.$message.showLoading()
+ const {
+ data
+ } = await this.$http.request('get', '/api/advertisement/page/view?id=' + this.id, {
+
+ })
+
+ this.$message.hideLoading()
+ // if (data && data.url) {
+ // data.url = JSON.parse(data.url) || []
+ // }
+ this.dto = {
+ ...data
+ }
+ this.dto.content = this.$util.formatRichText(this.dto.content || '')
+ //处理url的问题
+ // console.log('dto',this.dto)
+
+
+ },
+ },
+ 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
+ // }
+ // ?partnerUserId=${partnerUserId}&id=${this.id}&shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}
+ var url =`/pages/advertising/advertising?id=${this.id}`; //你的转发页面路径拼接参数
+ return {
+ title: this.dto.name || this.dto.title || '花满芫广告',
+ 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,
+ // }
+ var url =
+ `/pages/advertising/advertising?id=${this.id}`; //你的转发页面路径拼接参数
+ return {
+ title: this.dto.name || this.dto.title || '花满芫广告',
+ path: url,
+ }
+ },
+ }
+</script>
+
+<style lang="scss" scoped>
+ .popup-form {
+ padding-bottom: 68rpx;
+
+ .bottom-img {
+ width: 118rpx;
+ height: 70rpx;
+ display: block;
+ margin: 0 auto;
+ }
+
+ .bottom-info {
+ font-weight: 400;
+ font-size: 28rpx;
+ color: #666666;
+ line-height: 40rpx;
+ text-align: center;
+ }
+
+ .title {
+ font-size: 32rpx;
+ color: #000000;
+ margin-bottom: 32rpx;
+ }
+
+ .people-name {
+ font-weight: 600;
+ font-size: 32rpx;
+ color: #000000;
+ line-height: 102rpx;
+ margin-left: 28rpx;
+ }
+
+ .people-img {
+ width: 102rpx;
+ height: 102rpx;
+ border: 2rpx solid #FFFFFF;
+ }
+ }
+
+ .travel-detail {
+ .info-peoples {
+ padding: 24rpx 30rpx;
+ background: #fff;
+
+ .title {
+ font-size: 32rpx;
+ color: #000000;
+ font-weight: 600;
+
+ }
+
+ .show-more-peoples {
+ font-size: 24rpx;
+ color: #26C3A5;
+ }
+ }
+
+ .info-desc {
+ padding: 24rpx 30rpx;
+ background: #fff;
+
+ .title {
+ margin-bottom: 20rpx;
+ font-weight: 600;
+ font-size: 32rpx;
+ color: #000000;
+ }
+
+ /deep/ img {
+ max-width: 600rpx;
+
+ }
+ }
+
+ .info-cover {
+ width: 750rpx;
+ height: 474rpx;
+ }
+
+ .infos {
+ padding: 24rpx 30rpx;
+ background: #fff;
+
+ .name {
+ font-weight: 600;
+ font-size: 40rpx;
+ color: #000000;
+ }
+
+
+ .price {
+ font-weight: 600;
+ line-height: 72rpx;
+ font-size: 50rpx;
+ color: #000000;
+
+ .dot {
+ font-size: 40rpx;
+ line-height: 56rpx;
+ }
+ }
+
+ .status {
+ width: 132rpx;
+ height: 50rpx;
+ border-radius: 26rpx;
+ border: 2rpx solid #999999;
+ color: #999999;
+ line-height: 50rpx;
+ font-size: 24rpx;
+
+ text-align: center;
+ margin-left: 16rpx;
+ }
+
+ .status.A,
+ .status.J {
+ border: 2rpx solid #04BA97;
+ color: #04BA97;
+ }
+
+ .icon-loc {
+ width: 24rpx;
+ height: 30rpx;
+ background-size: 100% 100%;
+
+ }
+
+ .icon-clock {
+ width: 24rpx;
+ height: 26rpx;
+ background-size: 100% 100%;
+
+ }
+ }
+ }
+</style>
\ No newline at end of file
diff --git a/pages/home/components/home-banner-imgs.vue b/pages/home/components/home-banner-imgs.vue
index 433408f..10ace2f 100644
--- a/pages/home/components/home-banner-imgs.vue
+++ b/pages/home/components/home-banner-imgs.vue
@@ -2,29 +2,29 @@
<view class=" home-banner-imgs">
<view class="flex" v-if="list&&list.length>=3">
<view class="flex1 m-r-5">
- <image class="p1 img100" :src="list[0].url" mode="scaleToFill" @click="previewImg(list[0].url)">
+ <image class="p1 img100" :src="list[0].url" mode="scaleToFill" @click="toDetail(list[0])">
</image>
</view>
<view class="flex1 m-l-5">
- <image class="p2 img100" :src="list[1].url" mode="scaleToFill" @click="previewImg(list[1].url)">
+ <image class="p2 img100" :src="list[1].url" mode="scaleToFill" @click="toDetail(list[1])">
</image>
- <image class="p3 img100" :src="list[2].url" mode="scaleToFill" @click="previewImg(list[2].url)">
+ <image class="p3 img100" :src="list[2].url" mode="scaleToFill" @click="toDetail(list[2])">
</image>
</view>
</view>
<view class="flex l-2" v-else-if="list&&list.length>=2" mode="scaleToFill">
<view class="flex1 m-r-5">
- <image class="p1 img100" :src="list[0].url" mode="scaleToFill" @click="previewImg(list[0].url)">
+ <image class="p1 img100" :src="list[0].url" mode="scaleToFill" @click="toDetail(list[0])">
</image>
</view>
<view class="flex1 m-l-5">
- <image class="p1 img100" :src="list[1].url" mode="scaleToFill" @click="previewImg(list[1].url)">
+ <image class="p1 img100" :src="list[1].url" mode="scaleToFill" @click="toDetail(list[1])">
</image>
</view>
</view>
<view class="flex l-1" v-else-if="list&&list.length>=1" mode="scaleToFill">
<view class="flex1 m-r-5">
- <image class="p1 img100" :src="list[0].url" mode="scaleToFill" @click="previewImg(list[0].url)">
+ <image class="p1 img100" :src="list[0].url" mode="scaleToFill" @click="toDetail(list[0])">
</image>
</view>
</view>
@@ -67,6 +67,11 @@
}
console.log(this.list)
}
+ },
+ toDetail(item) {
+ uni.navigateTo({
+ url: `/pages/advertising/advertising?id=${item.id}`
+ })
}
},
async mounted() {
diff --git a/pages/user/supplier-user.vue b/pages/user/supplier-user.vue
index 889aac1..9abb8a9 100644
--- a/pages/user/supplier-user.vue
+++ b/pages/user/supplier-user.vue
@@ -643,7 +643,10 @@
var url = ''
if (this.currentInfo.id) {
// #ifdef PUB_CUSTOMER
- url = '/sub_pages/customer/customer-info/customer-info'
+ // url = '/sub_pages/customer/customer-info/customer-info'
+
+ url = '/sub_pages/customer/setup/setup'
+
// #endif
// #ifdef PUB_PARTNER
url = '/sub_pages/partner/partner-info/partner-info'
diff --git a/sub_pages/customer/setup/setup.vue b/sub_pages/customer/setup/setup.vue
new file mode 100644
index 0000000..bcc62f1
--- /dev/null
+++ b/sub_pages/customer/setup/setup.vue
@@ -0,0 +1,303 @@
+<template>
+ <view class="main-container user-container">
+
+ <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==='customer'"
+ @click="goto('/pages/help/content?id=隐私政策',false)" >
+ <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==='customer'"
+ @click="goto('/pages/help/content?id=用户协议',false)" >
+ <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==='customer'"
+ @click="goto('/pages/help/content?id=关于花满芫',false)" >
+ <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="clearlogout">
+ <view class="title">退出登录</view>
+ <view class="right-icon">
+ <uni-icons type="right"></uni-icons>
+ </view>
+ </view>
+
+
+
+ </view>
+
+ </view>
+</template>
+
+<script>
+ export default {
+ computed: {
+ },
+ data() {
+ return {
+ CustomBar: uni.getStorageSync('CustomBar'),
+ StatusBar: uni.getStorageSync('StatusBar'),
+ tcode: '',
+ inviterName: '',
+ // StatusBar:0,
+ tel: '15974805814',
+ tj: {},
+ tj_order: {},
+ cacheUserId: '',
+ signToday: false
+ // 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)
+ }
+ })
+ //判断有没有签到
+ let that = this
+ this.$http.request('get', '/api/customer/point/sign/sign/today', {}).then(res => {
+ if (res.data) {
+ that.signToday = true
+ }
+ })
+
+ // #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 "@/pages/user/user.scss";
+</style>
+<!-- #ifdef PUB_CUSTOMER -->
+<style lang="scss" scoped>
+ @import "@/pages/user/user-customer.scss";
+</style>
\ No newline at end of file
diff --git a/sub_pages/customer/shopping/shopping.vue b/sub_pages/customer/shopping/shopping.vue
index 5956672..af0e54c 100644
--- a/sub_pages/customer/shopping/shopping.vue
+++ b/sub_pages/customer/shopping/shopping.vue
@@ -46,7 +46,7 @@
<view class="desc flex p-t-5" @click.stop="toDetail(dto)">
<view class="m-r-15">剩余:{{ dto.stock || 0 }}</view>
<view class="m-r-15">颜色:{{ dto.color || '-' }}</view>
- <view class="m-r-15">限购数量:{{ dto.limited || '-' }}</view>
+ <view class="m-r-15" v-if="dto.limited && dto.limited>0" >限购数量:{{ dto.limited || '-' }}</view>
</view>
<view class="button-icons flex m-l-a m-r-0 m-t-8">
<uni-icons v-if="dto.num&&dto.num>=1" type="minus" size="32"
diff --git a/sub_pages/customer/trade/list.vue b/sub_pages/customer/trade/list.vue
index ed7114d..6d5f97e 100644
--- a/sub_pages/customer/trade/list.vue
+++ b/sub_pages/customer/trade/list.vue
@@ -105,7 +105,7 @@
<view class="m-r-15">
{{item.unit}}
</view>
- <view class="m-r-15">
+ <view class="m-r-15" v-if="item.limited && item.limited>0">
限购数量:{{item.limited||'-'}}
</view>
</view>
diff --git a/sub_pages/supplier/flower-manage/flower-manage.vue b/sub_pages/supplier/flower-manage/flower-manage.vue
index 0d6624a..354a114 100644
--- a/sub_pages/supplier/flower-manage/flower-manage.vue
+++ b/sub_pages/supplier/flower-manage/flower-manage.vue
@@ -75,7 +75,7 @@
<view class="label">价格</view>
<view class="value">{{item.price||'-'}}</view>
</view>
- <view class="each-item">
+ <view class="each-item" v-if="item.limited && item.limited>0">
<view class="label">限购数量</view>
<view class="value">{{item.limited||'-'}}</view>
</view>
--
Gitblit v1.9.3