活动按钮状态流转

This commit is contained in:
2026-03-25 15:53:37 +08:00
commit 37346e790f
2762 changed files with 240282 additions and 0 deletions

View File

@@ -0,0 +1,238 @@
<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者助力商协会发展
+----------------------------------------------------------------------
| Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
+----------------------------------------------------------------------
| 沃德商协会系统并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
+----------------------------------------------------------------------
| 组件-购物车信息 开发者: 麦沃德科技-半夏
+---------------------------------------------------------------------- -->
<template>
<view class="component-mall-cart" :style="{ '--theme-color': themeColor }">
<view class="cart-item" v-for="(item, index) in showData" :key="index">
<view class="item-radio" @click="changeSelect(index)">
<view class="radio-input" :class="{active: item.selected}">
<image src="/static/tick.png" mode="aspectFit" v-if="item.selected"></image>
</view>
</view>
<view class="item-goods" @click="toDetails(item.id)">
<view class="goods-left">
<image class="left-image" :src="item.image" mode="aspectFill"></image>
<view class="left-disabled" v-if="item.goods_status == 2">
<view class="box">
<text>商品</text>
<text>已下架</text>
</view>
</view>
</view>
<view class="goods-info">
<view class="info-top text-ellipsis-more">{{item.name}}</view>
<view class="info-bottom">
<view class="bottom-price"><text></text>{{item.price}}</view>
<view class="bottom-tips" v-if="item.goods_status == 2">商品已下架</view>
<view class="bottom-select" @click.stop v-else>
<view class="select-btn" :class="{disabled: parseInt(item.number) <= 1}" @click.stop="changeNumber(index, 1)">
<image class="icon" src="/static/mall/subtraction.png" mode="aspectFit"></image>
</view>
<view class="select-text text-ellipsis" @click.stop="changeNumber(index, 3)">{{item.number}}</view>
<view class="select-btn" @click.stop="changeNumber(index, 2)">
<image class="icon" src="/static/mall/addition.png" mode="aspectFit"></image>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { mapState } from "vuex"
export default {
name: "componentMallCart",
props: ["showData"],
computed: {
...mapState({
themeColor: state => state.app.themeColor,
})
},
methods: {
// 跳转商品详情
toDetails(id) {
this.$util.toPage({
mode: 1,
path: "/pagesMall/goods/details?id=" + id
})
},
// 选择商品
changeSelect(index) {
this.$emit("changeSelect", index)
},
// 更改数量
changeNumber(index, type) {
this.$emit("changeNumber", index, type)
},
},
}
</script>
<style lang="scss">
.component-mall-cart {
.cart-item {
border-radius: 20rpx;
background: #FFF;
margin-top: 32rpx;
display: flex;
overflow: hidden;
&:first-child {
margin-top: 0;
}
.item-radio {
display: flex;
flex-direction: column;
justify-content: center;
padding: 32rpx 24rpx 32rpx 32rpx;
height: 160rpx;
box-sizing: content-box;
.radio-input {
width: 32rpx;
height: 32rpx;
border-radius: 50%;
background: #D6DBDE;
&.active {
background: var(--theme-color);
}
}
}
.item-goods {
padding: 32rpx 32rpx 32rpx 0;
flex: 1;
display: flex;
align-items: center;
overflow: hidden;
.goods-left {
width: 150rpx;
min-width: 150rpx;
height: 150rpx;
border-radius: 20rpx;
overflow: hidden;
position: relative;
.left-image {
width: 100%;
height: 100%;
}
.left-disabled {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
border-radius: 20rpx;
background: rgba(0, 0, 0, 0.60);
padding: 28rpx;
.box {
width: 100%;
height: 100%;
color: #FFF;
font-size: 20rpx;
line-height: 32rpx;
border-radius: 50%;
background: rgba(0, 0, 0, 0.50);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
}
}
.goods-info {
flex: 1;
height: 160rpx;
margin-left: 24rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
overflow: hidden;
.info-top {
color: #5A5B6E;
font-size: 28rpx;
line-height: 40rpx;
}
.info-bottom {
display: flex;
align-items: center;
.bottom-price {
color: #E60012;
font-size: 32rpx;
font-weight: 600;
line-height: 40rpx;
text {
font-size: 24rpx;
}
}
.bottom-select {
flex: 1;
margin-left: 16rpx;
display: flex;
justify-content: flex-end;
align-items: center;
overflow: hidden;
.select-btn {
width: 32rpx;
min-width: 32rpx;
height: 32rpx;
border-radius: 50%;
background: var(--theme-color);
&.disabled {
opacity: .5;
}
.icon {
width: 100%;
height: 100%;
}
}
.select-text {
color: #000;
font-size: 28rpx;
line-height: 32rpx;
height: 32rpx;
margin: 0 16rpx;
text-align: center;
}
}
.bottom-tips {
flex: 1;
text-align: right;
color: #FF626E;
font-size: 24rpx;
line-height: 32rpx;
}
}
}
}
}
}
</style>

View File

@@ -0,0 +1,146 @@
<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者助力商协会发展
+----------------------------------------------------------------------
| Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
+----------------------------------------------------------------------
| 沃德商协会系统并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
+----------------------------------------------------------------------
| 组件-商品列表 开发者: 麦沃德科技-半夏
+---------------------------------------------------------------------- -->
<template>
<view class="component-mall-goods" v-if="list.length">
<uv-waterfall ref="waterfall" v-model="list" style="overflow: hidden;" :add-time="10" :column-gap="12" @changeList="changeList">
<!-- 第一列数据 -->
<template v-slot:list1>
<view class="goods-list-box">
<view v-for="item in list1" :key="item.id" class="box-item" @click="toDetails(item.id)">
<view class="item-image">
<image :src="item.image" mode="aspectFill"></image>
</view>
<view class="item-name">{{item.name}}</view>
<view class="item-price" :style="{ color: themeColor }">{{item.price}}</view>
</view>
</view>
</template>
<!-- 第二列数据 -->
<template v-slot:list2>
<view class="goods-list-box">
<view v-for="item in list2" :key="item.id" class="box-item" @click="toDetails(item.id)">
<view class="item-image">
<image :src="item.image" mode="aspectFill"></image>
</view>
<view class="item-name">{{item.name}}</view>
<view class="item-price" :style="{ color: themeColor }">{{item.price}}</view>
</view>
</view>
</template>
</uv-waterfall>
</view>
</template>
<script>
import { mapState } from "vuex"
export default {
name: "componentMallGoods",
data() {
return {
// 数据列表
list: [],
// 瀑布流第一列数据
list1: [],
// 瀑布流第二列数据
list2: [],
};
},
computed: {
...mapState({
themeColor: state => state.app.themeColor,
}),
},
methods: {
// 获取列表数据
getList(list) {
this.list = list
},
// 渲染列表
changeList(e) {
this[e.name].push(e.value);
},
// 跳转详情
toDetails(id) {
this.$util.toPage({
mode: 1,
path: "/pagesMall/goods/details?id=" + id
})
},
// 清除列表
clearList() {
this.list = [];
this.$refs.waterfall.clear();
this.list1 = [];
this.list2 = [];
},
},
}
</script>
<style lang="scss">
.component-mall-goods {
.goods-list-box {
.box-item {
width: 100%;
border-radius: 20rpx;
overflow: hidden;
background: #FFFFFF;
box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.02);
border-radius: 20rpx;
margin-top: 24rpx;
padding-bottom: 16rpx;
&:first-child {
margin-top: 0;
}
.item-image {
width: 100%;
height: 0;
padding-top: 100%;
position: relative;
image {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
.item-name {
font-weight: 600;
font-size: 28rpx;
line-height: 40rpx;
color: #5A5B6E;
margin-top: 16rpx;
padding: 0 16rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
-webkit-line-clamp: 2;
word-break: break-all;
}
.item-price {
margin-top: 16rpx;
font-weight: 600;
font-size: 28rpx;
line-height: 40rpx;
padding: 0 16rpx;
}
}
}
}
</style>

View File

@@ -0,0 +1,381 @@
<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者助力商协会发展
+----------------------------------------------------------------------
| Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
+----------------------------------------------------------------------
| 沃德商协会系统并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
+----------------------------------------------------------------------
| 组件-订单列表 开发者: 麦沃德科技-半夏
+---------------------------------------------------------------------- -->
<template>
<view class="component-mall-order">
<view class="order-item" v-for="(item, index) in showData" :key="index" @click="toDetails(item.id)">
<view class="item-top flex align-items-center">
<view class="top-number flex-item">订单编号{{item.order_no}}</view>
<view class="top-status">
<text style="color: #FF626E;" v-if="item.state == 1">待付款</text>
<text style="color: #FF9100;" v-else-if="item.state == 2">
<text v-if="item.delivery_method == 2">待自提</text>
<text v-else>待发货</text>
</text>
<text :style="{color: themeColor}" v-else-if="item.state == 3">待收货</text>
<text style="color: #979797;" v-else-if="item.state == 4">已完成</text>
</view>
</view>
<view class="item-center">
<!-- 单商品 -->
<view class="center-single flex" v-if="item.goods.length == 1">
<image class="single-image" :src="item.goods[0].image" mode="aspectFill"></image>
<view class="single-info flex-item">
<view class="info-name text-ellipsis-more">{{item.goods[0].name}}</view>
<view class="info-box flex align-items-center">
<view class="price flex-item" :style="{color: themeColor}">{{item.pay_price}}</view>
<view class="number">×{{item.number}}</view>
</view>
</view>
</view>
<!-- 多商品 -->
<view class="center-multiple" v-else>
<scroll-view scroll-x class="multiple-list">
<view class="list-goods">
<view class="goods-box" v-for="goods in item.goods" :key="goods.id">
<image class="image" :src="goods.image" mode="aspectFill"></image>
<view class="name text-ellipsis">{{goods.name}}</view>
</view>
</view>
</scroll-view>
<view class="multiple-total flex-direction-column flex-center">
<view class="number">×{{item.number}}</view>
<view class="price"><text></text>{{item.pay_price}}</view>
</view>
</view>
</view>
<view class="item-bottom" v-if="item.state != 4">
<view class="bottom-btn" :style="{background: themeColor}" @click.stop="handlePayment(item.id, item.pay_price)" v-if="item.state == 1">去支付</view>
<view class="bottom-btn" style="background: #FF626E" @click.stop="handleCancel(item.id)" v-if="item.state == 1">取消订单</view>
<view class="bottom-btn" style="background: #FF626E" @click.stop="handleRefund(item.id)" v-if="item.state == 2 || item.state == 3">申请退款</view>
<view class="bottom-btn" :style="{background: themeColor}" @click.stop="handleConfirm(item.id, item.trade_no)" v-if="item.state == 3">确认收货</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { mapState } from "vuex"
export default {
name: "componentMallOrder",
props: ["showData"],
computed: {
...mapState({
themeColor: state => state.app.themeColor,
deliveryManagement: state => state.app.deliveryManagement,
})
},
methods: {
// 跳转详情
toDetails(id) {
this.$util.toPage({
mode: 1,
path: `/pagesMall/order/details?order_id=` + id
})
},
// 去付款
handlePayment(id, money) {
this.$util.toPage({
mode: 1,
path: `/pagesMall/order/payment?money=${money}&id=${id}`
})
},
// 取消订单
handleCancel(id) {
uni.showModal({
title: '提示',
content: '确认取消该订单吗?',
confirmText: '确认取消',
confirmColor: this.themeColor,
cancelText: '我再想想',
cancelColor: '#999999',
success: (res) => {
if (res.confirm) {
uni.showLoading({
title: "加载中",
mask: true
})
this.$util.request("mall.delOrder", {
order_id: id,
}).then(res => {
uni.hideLoading()
if (res.code == 1) {
uni.showToast({
title: "取消成功",
duration: 1000
})
this.$emit("getOrderList")
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
uni.hideLoading()
console.error('取消订单', error)
})
}
}
})
},
// 申请退款
handleRefund(id) {
this.$util.toPage({
mode: 1,
path: "/pagesMall/refund/apply?id=" + id
})
},
// 确认收货
handleConfirm(id, trade_no) {
if (this.deliveryManagement == 1) {
if (wx.openBusinessView) {
wx.openBusinessView({
businessType: 'weappOrderConfirm',
extraData: { transaction_id: trade_no },
success: e => {
if (e.extraData.status === 'success') {
uni.showLoading({
title: "加载中",
mask: true
})
this.$util.request("mall.orderCollect", {
id: id,
}).then(res => {
uni.hideLoading()
if (res.code == 1) {
uni.showToast({
title: "签收成功",
icon: "success",
duration: 1500
})
this.$emit("getOrderList")
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
uni.hideLoading()
console.error('确认收货', error)
})
} else {
console.error("调用微信收货", e)
}
},
fail: (err) => {
console.error("调用微信收货", err)
},
});
} else {
uni.showToast({
title: "您的微信版本过低,请升级微信版本后重试",
duration: 2000,
icon: "none",
});
}
} else {
uni.showModal({
title: '提示',
content: '确认此商品已收货,\n点击确认收货后订单完成?',
confirmText: '确认收货',
confirmColor: this.themeColor,
cancelText: '我再想想',
cancelColor: '#999999',
success: (res) => {
if (res.confirm) {
uni.showLoading({
title: "加载中",
mask: true
})
this.$util.request("mall.orderCollect", {
id: id,
}).then(res => {
uni.hideLoading()
if (res.code == 1) {
uni.showToast({
title: "签收成功",
duration: 1500
})
this.$emit("getOrderList")
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
uni.hideLoading()
console.error('确认收货', error)
})
}
}
})
}
},
},
}
</script>
<style lang="scss">
.component-mall-order {
.order-item {
margin-top: 32rpx;
background: #FFF;
border-radius: 16rpx;
&:first-child {
margin-top: 0;
}
.item-top {
padding: 32rpx;
.top-number {
color: #999;
font-size: 28rpx;
line-height: 40rpx;
}
.top-status {
font-size: 28rpx;
line-height: 40rpx;
}
}
.item-center {
border-top: 1px solid rgba(0, 0, 0, 0.10);
.center-single {
padding: 32rpx;
.single-image {
width: 160rpx;
height: 160rpx;
border-radius: 20rpx;
}
.single-info {
display: flex;
flex-direction: column;
justify-content: space-between;
margin-left: 24rpx;
height: 160rpx;
.info-name {
font-size: 28rpx;
font-weight: 600;
line-height: 40rpx;
color: #5A5B6E;
}
.info-box {
.price {
font-size: 32rpx;
font-weight: 600;
line-height: 40rpx;
word-break: break-all;
}
.number {
color: #5A5B6E;
font-size: 28rpx;
line-height: 32rpx;
margin-left: 16rpx;
}
}
}
}
.center-multiple {
position: relative;
padding: 32rpx 0;
overflow: hidden;
.multiple-list {
.list-goods {
display: inline-flex;
padding: 0 32rpx;
column-gap: 32rpx;
.goods-box {
.image {
width: 160rpx;
height: 160rpx;
border-radius: 20rpx;
}
.name {
margin-top: 12rpx;
width: 160rpx;
color: #5A5B6E;
font-size: 24rpx;
font-weight: 600;
line-height: 34rpx;
text-align: center;
}
}
}
}
.multiple-total {
position: absolute;
top: 0;
right: -4rpx;
bottom: 24rpx;
z-index: 9;
padding: 0 32rpx 0 28rpx;
background: rgba(255, 255, 255, 0.70);
.number {
color: #5A5B6E;
font-size: 32rpx;
line-height: 40rpx;
}
.price {
margin-top: 40rpx;
color: #E60012;
font-size: 40rpx;
font-weight: 600;
line-height: 40rpx;
text {
font-size: 24rpx;
}
}
}
}
}
.item-bottom {
padding: 0 32rpx 32rpx;
display: flex;
justify-content: flex-end;
align-items: center;
gap: 24rpx;
.bottom-btn {
color: #FFF;
font-size: 28rpx;
line-height: 40rpx;
padding: 16rpx 32rpx;
min-width: 144rpx;
text-align: center;
border-radius: 8rpx;
}
}
}
}
</style>

View File

@@ -0,0 +1,279 @@
<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者助力商协会发展
+----------------------------------------------------------------------
| Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
+----------------------------------------------------------------------
| 沃德商协会系统并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
+----------------------------------------------------------------------
| 组件-退款订单列表 开发者: 麦沃德科技-半夏
+---------------------------------------------------------------------- -->
<template>
<view class="component-mall-refund">
<view class="refund-item" v-for="(item, index) in showData" :key="index" @click="toDetails(item.id)">
<view class="item-top flex align-items-center">
<view class="top-number flex-item">订单编号{{item.order_no}}</view>
<view class="top-status">
<text style="color: #FF626E;" v-if="item.refund_status == 2">申请中</text>
<text style="color: #FF9100;" v-if="item.refund_status == 3">待退货</text>
<text :style="{color: themeColor}" v-if="item.refund_status == 4">退款中</text>
<text style="color: #979797;" v-if="item.refund_status == 5">已退款</text>
</view>
</view>
<view class="item-center">
<!-- 单商品 -->
<view class="center-single flex" v-if="item.goods.length == 1">
<image class="single-image" :src="item.goods[0].image" mode="aspectFill"></image>
<view class="single-info flex-item">
<view class="info-name text-ellipsis-more">{{item.goods[0].name}}</view>
<view class="info-box flex align-items-center">
<view class="price flex-item" :style="{color: themeColor}">{{item.pay_price}}</view>
<view class="number">×{{item.number}}</view>
</view>
</view>
</view>
<!-- 多商品 -->
<view class="center-multiple" v-else>
<scroll-view scroll-x class="multiple-list">
<view class="list-goods">
<view class="goods-box" v-for="goods in item.goods" :key="goods.id">
<image class="image" :src="goods.image" mode="aspectFill"></image>
<view class="name text-ellipsis">{{goods.name}}</view>
</view>
</view>
</scroll-view>
<view class="multiple-total flex-direction-column flex-center">
<view class="number">×{{item.number}}</view>
<view class="price"><text></text>{{item.pay_price}}</view>
</view>
</view>
</view>
<view class="item-bottom" v-if="item.refund_status == 2 || item.refund_status == 3">
<view class="bottom-btn" style="background: #FF626E" @click.stop="handleCancel(item.id)" v-if="item.refund_status == 2">取消退款</view>
<view class="bottom-btn" :style="{background: themeColor}" @click.stop="handleWrite(item.id)" v-if="item.refund_status == 3">填写信息</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { mapState } from "vuex"
export default {
name: "componentMallRefund",
props: ["showData"],
computed: {
...mapState({
themeColor: state => state.app.themeColor,
})
},
methods: {
// 跳转详情
toDetails(id) {
this.$util.toPage({
mode: 1,
path: `/pagesMall/refund/details?id=` + id
})
},
// 取消退款
handleCancel(id) {
uni.showModal({
title: "提示",
content: "确定取消退款申请? \n 点击取消退款后取消申请",
confirmText: '取消退款',
confirmColor: this.themeColor,
cancelText: '我再想想',
cancelColor: '#999999',
success: (res) => {
if (res.confirm) {
uni.showLoading({
title: "加载中",
mask: true
})
this.$util.request("mall.cancelRefund", { id: id }).then(res => {
uni.hideLoading()
if (res.code == 1) {
uni.showToast({
title: "取消成功",
icon: "success",
duration: 2000
})
this.$emit("getOrderList")
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
uni.hideLoading()
console.error('取消退款', error)
})
}
}
})
},
// 跳转填写信息
handleWrite(id) {
this.$util.toPage({
mode: 1,
path: `/pagesMall/refund/goods?id=` + id
})
},
},
}
</script>
<style lang="scss">
.component-mall-refund {
.refund-item {
margin-top: 32rpx;
background: #FFF;
border-radius: 16rpx;
&:first-child {
margin-top: 0;
}
.item-top {
padding: 32rpx;
.top-number {
color: #999;
font-size: 28rpx;
line-height: 40rpx;
}
.top-status {
font-size: 28rpx;
line-height: 40rpx;
}
}
.item-center {
border-top: 1px solid rgba(0, 0, 0, 0.10);
.center-single {
padding: 32rpx;
.single-image {
width: 160rpx;
height: 160rpx;
border-radius: 20rpx;
}
.single-info {
display: flex;
flex-direction: column;
justify-content: space-between;
margin-left: 24rpx;
height: 160rpx;
.info-name {
font-size: 28rpx;
font-weight: 600;
line-height: 40rpx;
color: #5A5B6E;
}
.info-box {
.price {
font-size: 32rpx;
font-weight: 600;
line-height: 40rpx;
word-break: break-all;
}
.number {
color: #5A5B6E;
font-size: 28rpx;
line-height: 32rpx;
margin-left: 16rpx;
}
}
}
}
.center-multiple {
position: relative;
padding: 32rpx 0;
overflow: hidden;
.multiple-list {
.list-goods {
display: inline-flex;
padding: 0 32rpx;
column-gap: 32rpx;
.goods-box {
.image {
width: 160rpx;
height: 160rpx;
border-radius: 20rpx;
}
.name {
margin-top: 12rpx;
width: 160rpx;
color: #5A5B6E;
font-size: 24rpx;
font-weight: 600;
line-height: 34rpx;
text-align: center;
}
}
}
}
.multiple-total {
position: absolute;
top: 0;
right: -4rpx;
bottom: 24rpx;
z-index: 9;
padding: 0 32rpx 0 28rpx;
background: rgba(255, 255, 255, 0.70);
.number {
color: #5A5B6E;
font-size: 32rpx;
line-height: 40rpx;
}
.price {
margin-top: 40rpx;
color: #E60012;
font-size: 40rpx;
font-weight: 600;
line-height: 40rpx;
text {
font-size: 24rpx;
}
}
}
}
}
.item-bottom {
padding: 0 32rpx 32rpx;
display: flex;
justify-content: flex-end;
align-items: center;
gap: 24rpx;
.bottom-btn {
color: #FFF;
font-size: 28rpx;
line-height: 40rpx;
padding: 16rpx 32rpx;
min-width: 144rpx;
text-align: center;
border-radius: 8rpx;
}
}
}
}
</style>

View File

@@ -0,0 +1,146 @@
<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者助力商协会发展
+----------------------------------------------------------------------
| Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
+----------------------------------------------------------------------
| 沃德商协会系统并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
+----------------------------------------------------------------------
| 组件-商品信息 开发者: 麦沃德科技-半夏
+---------------------------------------------------------------------- -->
<template>
<view class="component-mall-store flex" :style="{ '--theme-color': themeColor }">
<image class="store-image" :src="showData.image" mode="aspectFill"></image>
<view class="store-info">
<view class="info-top text-ellipsis-more">{{showData.name}}</view>
<view class="info-bottom">
<view class="bottom-price"><text></text>{{showData.price || showData.goods_price}}</view>
<view class="bottom-select" v-if="showNumber">
<view class="select-btn" :class="{disabled: parseInt(showNumber) <= 1}" @click="changeNumber(1)">
<image class="icon" src="/static/mall/subtraction.png" mode="aspectFit"></image>
</view>
<view class="select-text text-ellipsis" @click="changeNumber(3)">{{showNumber}}</view>
<view class="select-btn" @click="changeNumber(2)">
<image class="icon" src="/static/mall/addition.png" mode="aspectFit"></image>
</view>
</view>
<view class="bottom-number text-ellipsis" v-else>×{{showData.number || showData.goods_num}}</view>
</view>
</view>
</view>
</template>
<script>
import { mapState } from "vuex"
export default {
name: "componentMallStore",
props: ["showData", "showNumber"],
computed: {
...mapState({
themeColor: state => state.app.themeColor,
})
},
methods: {
// 更改数量
changeNumber(type) {
this.$emit("changeNumber", type)
},
},
}
</script>
<style lang="scss">
.component-mall-store {
border-radius: 20rpx;
background: #FFF;
padding: 32rpx;
display: flex;
align-items: center;
overflow: hidden;
.store-image {
width: 160rpx;
min-width: 160rpx;
height: 160rpx;
border-radius: 20rpx;
}
.store-info {
flex: 1;
height: 160rpx;
margin-left: 32rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
overflow: hidden;
.info-top {
color: #5A5B6E;
font-size: 28rpx;
line-height: 40rpx;
}
.info-bottom {
display: flex;
align-items: center;
.bottom-price {
color: #E60012;
font-size: 36rpx;
font-weight: 600;
line-height: 40rpx;
text {
font-size: 24rpx;
}
}
.bottom-select {
flex: 1;
margin-left: 16rpx;
display: flex;
justify-content: flex-end;
align-items: center;
overflow: hidden;
.select-btn {
width: 32rpx;
min-width: 32rpx;
height: 32rpx;
border-radius: 50%;
background: var(--theme-color);
&.disabled {
opacity: .5;
}
.icon {
width: 100%;
height: 100%;
}
}
.select-text {
color: #000;
font-size: 28rpx;
line-height: 32rpx;
height: 32rpx;
margin: 0 16rpx;
text-align: center;
}
}
.bottom-number {
flex: 1;
margin-left: 16rpx;
text-align: right;
color: #5A5B6E;
font-size: 28rpx;
line-height: 32rpx;
}
}
}
}
</style>

View File

@@ -0,0 +1,253 @@
<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者助力商协会发展
+----------------------------------------------------------------------
| Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
+----------------------------------------------------------------------
| 沃德商协会系统并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
+----------------------------------------------------------------------
| 地址选择弹窗 开发者: 麦沃德科技-半夏
+---------------------------------------------------------------------- -->
<template>
<view class="component-modal-address" @click.stop>
<uni-popup ref="popupModal" type="bottom" :safe-area="false" @change="onChange">
<view class="modal-box" :style="{'--theme-color': themeColor}">
<view class="modal-head">
<view class="title">选择地址</view>
<image class="close" src="/static/close.png" mode="aspectFit" @click="onClose"></image>
</view>
<view class="modal-content">
<scroll-view scroll-y class="content-scroll">
<empty top="0" title="请登录后查看," btn-text="前往登录" @callback="toLogin()" v-if="!isToken"></empty>
<view class="scroll-list" v-else-if="addressList.length">
<view class="list-item flex align-items-center" @click="onConfirm(item)" v-for="item in addressList" :key="item.id">
<view class="item-radio" :class="{select: item.id == selectId}">
<view class="point" v-if="item.id == selectId"></view>
</view>
<view class="item-info flex-item">
<view class="info-address text-ellipsis-more">{{item.address}}</view>
<view class="info-tag flex">
<text>{{item.name}}</text>
<text style="margin-left: 16rpx;">{{item.tel}}</text>
</view>
</view>
<view class="item-edit" :style="{'background-image': 'url('+ iconEdit +')'}" v-if="iconEdit" @click="editAddress(item)"></view>
</view>
</view>
<empty top="0" title="暂无相关地址~" @callback="addAddress()" v-else></empty>
</scroll-view>
</view>
<view class="modal-btn" @click="addAddress()">添加地址</view>
</view>
</uni-popup>
</view>
</template>
<script>
import { mapState } from "vuex"
import svgData from "@/common/svg.js"
export default {
name: "componentModalAddress",
data() {
return {
// 选中地址id
selectId: null,
// 地址列表
addressList: [],
// 是否登录
isToken: false,
};
},
computed: {
...mapState({
themeColor: state => state.app.themeColor,
iconEdit: state => {
return svgData.svgToUrl("edit", state.app.themeColor)
},
})
},
methods: {
// 打开模态框
open(value) {
if (value) this.selectId = value
else this.selectId = null
if (uni.getStorageSync("token")) {
this.isToken = true
this.getAddress(() => {
this.$refs.popupModal.open()
})
} else {
this.isToken = false
this.$refs.popupModal.open()
}
},
// 关闭弹窗
onClose() {
this.$refs.popupModal.close()
},
// 改变事件
onChange(e) {
this.$emit("onChange", e.show)
},
// 获取地址列表
getAddress(fn) {
this.$util.request("mall.address.list").then(res => {
if (fn) fn()
if (res.code == 1) {
this.addressList = res.data || []
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
}).catch(error => {
if (fn) fn()
console.error('获取地址列表 ', error)
})
},
// 跳转登录
toLogin() {
uni.navigateTo({
url: "/pages/login/index",
success: () => {
this.onClose()
}
})
},
// 跳转添加地址
addAddress() {
this.$util.toPage({
mode: 1,
path: "/pagesMall/address/index"
})
this.onClose()
},
// 跳转编辑地址
editAddress(item) {
this.$util.toPage({
mode: 1,
path: "/pagesMall/address/add?addressData=" + JSON.stringify(item)
})
this.onClose()
},
// 选择事件
onConfirm(item) {
this.onClose()
this.$emit("confirm", item)
},
},
}
</script>
<style lang="scss" scoped>
.component-modal-address {
position: relative;
z-index: 999;
.modal-box {
background: #FFFFFF;
border-radius: 20rpx 20rpx 0 0;
width: 100vw;
padding-top: 32rpx;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
.modal-head {
display: flex;
align-items: center;
padding: 0 32rpx 0 64rpx;
.title {
color: #333;
text-align: center;
font-size: 32rpx;
font-weight: 600;
line-height: 44rpx;
flex: 1;
}
.close {
width: 32rpx;
height: 32rpx;
}
}
.modal-content {
padding: 16rpx 32rpx 0;
.content-scroll {
min-height: 25vh;
max-height: 45vh;
.scroll-list {
margin-top: 32rpx;
.list-item {
margin-top: 32rpx;
padding-bottom: 20rpx;
border-bottom: 1rpx solid #F6F7FB;
&:first-child {
margin-top: 0;
}
.item-radio {
width: 32rpx;
height: 32rpx;
background: #FFFFFF;
border-radius: 50%;
border: 1rpx solid #979797;
padding: 6rpx;
margin-right: 24rpx;
&.select {
border-color: var(--theme-color);
}
.point {
width: 100%;
height: 100%;
background: var(--theme-color);
border-radius: 50%;
}
}
.item-info {
.info-address {
color: #5A5B6E;
font-size: 28rpx;
line-height: 40rpx;
}
.info-tag {
color: #979797;
font-size: 24rpx;
line-height: 34rpx;
margin-top: 8rpx;
}
}
.item-edit {
width: 48rpx;
height: 48rpx;
background-size: 48rpx;
margin-left: 24rpx;
}
}
}
}
}
.modal-btn {
color: var(--theme-color);
text-align: center;
font-size: 32rpx;
line-height: 44rpx;
padding: 32rpx;
}
}
}
</style>

View File

@@ -0,0 +1,167 @@
<!-- +----------------------------------------------------------------------
| 麦沃德科技赋能开发者助力商协会发展
+----------------------------------------------------------------------
| Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
+----------------------------------------------------------------------
| 沃德商协会系统并不是自由软件不加密并不代表开源未经许可不可自由转售和商用
+----------------------------------------------------------------------
| Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
+----------------------------------------------------------------------
| 数量选择弹窗 开发者: 麦沃德科技-半夏
+---------------------------------------------------------------------- -->
<template>
<view class="component-modal-quantity" @click.stop>
<uni-popup ref="popupModal" type="bottom" :safe-area="false" @change="onChange">
<view class="modal-box" :style="{'--theme-color': themeColor}">
<view class="modal-content flex align-items-center">
<view class="content-title">选择商品数量</view>
<view class="content-select flex-item flex justify-content-end align-items-center">
<view class="select-btn" :class="{disabled: parseInt(selectQuantity) <= 1}" @click="handleSubtraction()">
<image class="icon" src="@/static/mall/subtraction.png" mode="aspectFit"></image>
</view>
<input class="select-number" v-model="selectQuantity" type="number" @blur="handleBlur()" />
<view class="select-btn" @click="handleAddition()">
<image class="icon" src="@/static/mall/addition.png" mode="aspectFit"></image>
</view>
</view>
</view>
<view class="modal-footer">
<view class="footer-btn" @click="onConfirm()">确认</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import { mapState } from "vuex"
export default {
name: "componentModalQuantity",
data() {
return {
// 选择数量
selectQuantity: 1,
// 参数
parameter: null,
};
},
computed: {
...mapState({
themeColor: state => state.app.themeColor,
})
},
methods: {
// 打开模态框
open(value, parameter) {
this.selectQuantity = parseInt(value)
this.parameter = parameter
this.$refs.popupModal.open()
},
// 关闭弹窗
onClose() {
this.$refs.popupModal.close()
},
// 改变事件
onChange(e) {
this.$emit("onChange", e.show)
},
// 选择事件
onConfirm() {
this.onClose()
this.$emit("confirm", this.selectQuantity, this.parameter)
},
// 减少数量
handleSubtraction() {
if (this.selectQuantity > 1) this.selectQuantity--
this.$forceUpdate()
},
// 增加数量
handleAddition() {
this.selectQuantity++
this.$forceUpdate()
},
// 数量判断
handleBlur() {
this.selectQuantity = parseInt(this.selectQuantity) || 1
if (this.selectQuantity < 1) this.selectQuantity = 1
this.$forceUpdate()
},
},
}
</script>
<style lang="scss" scoped>
.component-modal-quantity {
position: relative;
z-index: 999;
.modal-box {
background: #FFFFFF;
border-radius: 20rpx 20rpx 0 0;
width: 100vw;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
.modal-content {
padding: 64rpx 48rpx;
.content-title {
color: #000;
font-size: 32rpx;
line-height: 44rpx;
}
.content-select {
margin-left: 24rpx;
.select-btn {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
background: var(--theme-color);
overflow: hidden;
&.disabled {
opacity: .5;
}
.icon {
width: 100%;
height: 100%;
}
}
.select-number {
color: #000;
font-size: 28rpx;
line-height: 48rpx;
height: 48rpx;
border-radius: 10rpx;
background: #F2F2F2;
padding: 0 16rpx;
text-align: center;
width: 120rpx;
box-sizing: border-box;
margin: 0 20rpx;
}
}
}
.modal-footer {
padding: 16rpx 24rpx;
border-top: 1px solid #ccc;
.footer-btn {
color: #FFF;
text-align: center;
font-size: 28rpx;
line-height: 40rpx;
padding: 20rpx 32rpx;
border-radius: 40rpx;
background: var(--theme-color);
}
}
}
}
</style>