tapd相关修改更新

This commit is contained in:
GaoHao
2025-03-19 18:19:34 +08:00
parent 994cf8bf2b
commit f01bc839f7
53 changed files with 1084 additions and 1032 deletions

View File

@@ -9,11 +9,11 @@
<view class="category">
<view class="category_item" @tap="itemClick(item,index)" :class="{active:index===category.active}" v-for="(item,index) in category.list" :key="index">{{item.name}}</view>
</view>
<view style="flex-shrink: 0;">
<view style="flex-shrink: 0;flex: 1;">
<up-radio-group v-model="goodsValue" @change="groupChange" style="width: 100%;display: initial;">
<view class="goodsList">
<view class="goodsItem" @tap="goodsClick(item,index)" v-for="(item,index) in category.goodsList" :key="index">
<view>{{item.name}}</view>
<view class="up-line-1" style="width: 260rpx;">{{item.name}}</view>
<up-radio
:key="item.id"
:name="item.id"
@@ -132,6 +132,7 @@
}
.content{
display: flex;
width: 100%;
height: 672rpx;
.category{
min-width: 316rpx;
@@ -153,6 +154,7 @@
overflow-y: auto;
display: flex;
flex-direction: column;
flex: 1;
.goodsItem{
width: 100%;
padding: 22rpx 24rpx;

View File

@@ -10,7 +10,11 @@
<view class="item">
<view class="lable">使用门槛</view>
<view class="value">
<view></view><input v-model="formData.fullAmount" type="number" placeholder="填写金额" border="none"></input><view>元</view><view>减</view><input v-model="formData.discountAmount" type="number" placeholder="填写金额" border="none"></input><view></view>
<view></view>
<input v-model="formData.fullAmount" @change="formData.fullAmount = $utils.isPrice(formData.fullAmount)" type="digit" placeholder="填写金额" border="none"></input>
<view></view>
<view v-if="formData.type == 1" style="display: flex;align-items: center;justify-content: flex-start;"> <view>减</view> <input v-model="formData.discountAmount" @change="formData.discountAmount = $utils.isPrice(formData.discountAmount)" type="digit" placeholder="填写金额" border="none"></input> <view></view> </view>
</view>
</view>
</view>
@@ -35,7 +39,7 @@
<view class="item">
<view class="lable">有效期</view>
<view class="value">
<up-input v-model="formData.validDays" type="number" placeholder="填写天数" border="none"></up-input>
<input style="width: 100%;text-align: left;padding-left: 20rpx;" v-model="formData.validDays" @input="formData.validDays = $utils.isNumber(formData.validDays)" type="number" placeholder="填写天数" border="none"></input>
</view>
</view>
<view class="item">
@@ -43,13 +47,13 @@
<!-- <up-icon @click="modalShow(1)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon> -->
</view>
<view class="value">
<view></view><input v-model="formData.daysToTakeEffect" type="number" placeholder="填写天数" border="none" ></input><view>天生效</view>
<view></view><input v-model="formData.daysToTakeEffect" @change="formData.daysToTakeEffect = $utils.isNumber(formData.daysToTakeEffect)" type="number" placeholder="填写天数" border="none" ></input><view>天生效</view>
</view>
</view>
<view class="item">
<view class="lable">可用日期</view>
<view class="value">
<up-checkbox-group v-model="formData.userDays" placement="row" @change="checkboxChange" >
<up-checkbox-group v-model="formData.userDays" placement="row">
<up-checkbox
:customStyle="{marginBottom: '8px',marginRight: '15px'}"
v-for="(item, index) in pageData.value"
@@ -71,7 +75,6 @@
</up-radio-group>
</view>
<view class="time" v-if="formData.useTimeType=='custom'">
<!-- {{formData.useStartTime +''+ formData.useEndTime}} -->
<view @click="useTimeChange('useStartTime')">{{ formData.useStartTime || '开始时间'}}</view>--
<view @click="useTimeChange('useEndTime')">{{ formData.useEndTime || '结束时间'}}</view>
</view>
@@ -81,13 +84,34 @@
<view class="card">
<view class="item">
<view class="lable">总发放数量
<!-- <up-icon @click="modalShow(2)" name="question-circle" color="#999" size="20" style="margin-left: 10rpx;"></up-icon> -->
</view>
<view class="value">
<up-input v-model="formData.number" placeholder="填写数量" border="none" clearable ></up-input>
<input style="width: 100%;text-align: left;padding-left: 20rpx;" v-model="formData.number" @change="formData.number = $utils.isNumber(formData.number)" placeholder="填写数量" border="none" clearable ></input>
</view>
</view>
</view>
<view class="card product" v-if="formData.type == 2">
<view class="item">
<view class="lable">指定抵扣商品</view>
<view class="value">
<view class="selectGoods" @tap="selectGoodsOpen">
<view>
<view class="title">选择商品</view>
<view class="goodsName" v-if='!formData.proId'>选择指定商品</view>
<view class="goodsName" v-else>
<view class="goodsItem" >
<view class="productName">{{formData.proName}}</view>
<!-- <up-input @tap.stop="stop" style="border-bottom: 1rpx solid #666;" v-model="item.num" placeholder="填写数量" border="none" ></up-input> -->
</view>
</view>
</view>
<up-icon name="arrow-right" color="#9F9F9F" size="22"></up-icon>
</view>
</view>
</view>
</view>
<view class="bottomPop">
<button @click="save">保存</button>
</view>
@@ -100,12 +124,17 @@
></up-datetime-picker>
<my-date-pickerview @confirm="datePickerConfirm" :mode="pageData.mode" ref="datePicker"></my-date-pickerview>
<up-modal :show="pageData.show" :title="pageData.title" @confirm="pageData.show = false" ></up-modal>
<select-goods ref="goods" @affirm="affirm"></select-goods>
</view>
</template>
<script setup>
import { reactive, ref } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import go from '@/commons/utils/go.js'
import selectGoods from './components/select-goods';
import { addCoupon, updateCoupon } from '@/http/api/coupon.js'
const pageData = reactive({
value: [
@@ -137,11 +166,23 @@
useTimeType: 'all',
useStartTime: '',
useEndTime: '',
validDays: null,
validDays: '',
daysToTakeEffect: null,
number: null,
proId: null,
proName: null,
})
let datePicker = ref(null)
let refTime = ref(null)
let goods = ref(null)
onLoad((options) => {
if ( options.isType ) {
formData.type = options.isType;
}
if ( options.type == 'info' ) {
let itemData = JSON.parse(options.item);
for (let item in itemData) {
@@ -150,8 +191,18 @@
formData.userDays = formData.userDays.split(",");
}
})
let datePicker = ref(null)
let refTime = ref(null)
/**
* 选择商品
*/
let selectGoodsOpen = () => {
goods.value.open();
}
let affirm = (item) => {
formData.proId = item.id
formData.proName = item.name
}
/**
* 查看生效时间/发放数量提示
@@ -215,33 +266,39 @@
*/
let save = () => {
if( !formData.title ){
uni.showToast({ title: '请输入优惠券名称' })
uni.$utils.showToast("请输入优惠券名称")
return false;
}
if( !formData.fullAmount || !formData.discountAmount ){
uni.showToast({ title: '请输入使用门槛' })
if( !formData.fullAmount || (formData.type == 1&&!formData.discountAmount) ){
uni.$utils.showToast("请输入使用门槛")
return false;
}
if( !formData.daysToTakeEffect ){
uni.showToast({ title: '请输入生效天数' })
uni.$utils.showToast("请输入生效天数")
return false;
}
if( !formData.number ){
uni.showToast({ title: '请输入发放数量' })
uni.$utils.showToast("请输入发放数量")
return false;
}
formData.userDays = formData.userDays.toString();
let userDays = formData.userDays.toString();
let params = {
...formData
...formData,
userDays
}
if(formData.id){
updateCoupon(params).then((res) => {
go.back(1)
uni.$utils.showToast("操作成功",1000)
setTimeout(()=>{
go.back(1)
},1000)
})
} else{
addCoupon(params).then((res) => {
go.back(1)
uni.$utils.showToast("操作成功",1000)
setTimeout(()=>{
go.back(1)
},1000)
})
}
@@ -312,6 +369,65 @@
margin-bottom: 0;
}
}
.card.product{
padding: 32rpx 24rpx;
background-color: #fff;
margin-bottom: 32rpx;
.item{
padding-bottom: 24rpx;
border-bottom: 2rpx solid #E5E5E5;
margin-bottom: 24rpx;
.lable{
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-bottom: 16rpx;
display: flex;
align-items: center;
}
.value{
display: flex;
justify-content: flex-start;
align-items: center;
input{
width: 150rpx;
text-align: center;
}
.selectGoods{
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding: 32rpx 16rpx;
background: #F9F9F9;
border-radius: 12rpx 12rpx 12rpx 12rpx;
.title{
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-bottom: 16rpx;
}
.goodsName{
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
.goodsItem{
display: flex;
align-items: center;
.productName{
margin-right: 20rpx;
}
}
}
}
}
.item:last-child{
border-bottom: none;
margin-bottom: 0;
}
}
.bottomPop{
position: fixed;
bottom: 0;

View File

@@ -10,13 +10,13 @@
<view class="item">
<view class="lable">使用门槛</view>
<view class="value">
<view></view><input v-model="formData.fullAmount" type="number" placeholder="填写金额" border="none"></input><view>可用</view>
<view></view><input v-model="formData.fullAmount" @change="formData.fullAmount = $utils.isPrice(formData.fullAmount)" type="digit" placeholder="填写金额" border="none"></input><view>可用</view>
</view>
</view>
<view class="item">
<view class="lable">总发放数量</view>
<view class="value">
<up-input v-model="formData.number" type="number" placeholder="填写数量" border="none" clearable ></up-input>
<up-input v-model="formData.number" @change="formData.number = $utils.isNumber(formData.number)" type="number" placeholder="填写数量" border="none" clearable ></up-input>
</view>
</view>
</view>
@@ -92,7 +92,6 @@
let affirm = (item) => {
formData.proId = item.id
formData.proName = item.name
}
/**
@@ -100,15 +99,15 @@
*/
let save = () => {
if( !formData.title ){
uni.showToast({ title: '请输入商品名称' })
uni.$utils.showToast("请输入商品名称")
return false;
}
if( !formData.fullAmount ){
uni.showToast({ title: '请输入使用门槛' })
uni.$utils.showToast("请输入使用门槛")
return false;
}
if( !formData.number ){
uni.showToast({ title: '请输入发放数量' })
uni.$utils.showToast("请输入发放数量")
return false;
}
let params = {
@@ -116,11 +115,17 @@
}
if(formData.id){
updateCoupon(params).then((res) => {
go.back(1)
uni.$utils.showToast("操作成功",1000)
setTimeout(()=>{
go.back(1)
},1000)
})
} else{
addCoupon(params).then((res) => {
go.back(1)
uni.$utils.showToast("操作成功",1000)
setTimeout(()=>{
go.back(1)
},1000)
})
}
}

View File

@@ -26,7 +26,7 @@
<view> 领取方式 </view>
<view> 用户不可自行领取 </view>
</view> -->
<view v-if="item.type == 1">
<view>
<view> 有效期 </view>
<view> 领券后{{ item.validDays }}天过期 </view>
</view>
@@ -113,7 +113,6 @@
let getCoupon = () => {
let params = pageData.query;
getCouponList(params).then((res) => {
console.log(res)
pageData.couponList = res;
})
}
@@ -124,9 +123,9 @@
*/
let addCoupon = ()=>{
if ( pageData.query.type == 1 ) {
go.to('PAGES_COUPON_DISCOUNTCOUPONS')
go.to('PAGES_COUPON_DISCOUNTCOUPONS',{ isType: 1})
} else {
go.to('PAGES_COUPON_CERTIFICATE')
go.to('PAGES_COUPON_DISCOUNTCOUPONS',{ isType: 2})
}
}
@@ -135,11 +134,11 @@
* 修改
*/
let editCoupon = (item)=>{
console.log(item.id)
if ( item.type == 1 ) {
go.to('PAGES_COUPON_DISCOUNTCOUPONS',{type: 'info', item: JSON.stringify(item)})
go.to('PAGES_COUPON_DISCOUNTCOUPONS',{type: 'info', isType: 1, item: JSON.stringify(item)})
} else {
go.to('PAGES_COUPON_CERTIFICATE',{type: 'info', item: JSON.stringify(item)})
go.to('PAGES_COUPON_DISCOUNTCOUPONS',{type: 'info', isType: 2, item: JSON.stringify(item)})
// go.to('PAGES_COUPON_CERTIFICATE',{type: 'info', item: JSON.stringify(item)})
}
}