代码更新

This commit is contained in:
GaoHao
2025-02-26 19:46:20 +08:00
parent 7519ffced3
commit b4a0393d2d
413 changed files with 7483 additions and 60762 deletions

View File

@@ -28,10 +28,11 @@
<view class="selectGoods" @tap="selectGoodsOpen">
<view>
<view class="title">选择商品</view>
<view class="goodsName" v-if='formData.products.length <= 0'>选择指定商品</view>
<view class="goodsName" v-if='!formData.proId'>选择指定商品</view>
<view class="goodsName" v-else>
<view class="goodsItem" v-for="(item,index) in formData.products" :key="index">
<view class="productName">{{item.name}}</view><up-input @tap.stop="stop" style="border-bottom: 1rpx solid #666;" v-model="item.num" placeholder="填写数量" border="none" ></up-input>
<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>
@@ -51,15 +52,13 @@
</view>
</template>
<script setup>
import go from '@/commons/utils/go.js'
import myActionSheet from '@/components/my-components/my-action-sheet';
import selectGoods from './components/select-goods';
import { getTbShopCouponInfo, addTbShopCoupon } from '@/http/yskApi/coupon.js'
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 '@/api/coupon.js'
const pageData = reactive({
id: null,
goodsData: null,
title: "",
show: false,
})
@@ -68,13 +67,18 @@
type: '2',
fullAmount: null,
number: null,
proId: null,
proName: null,
products: []
})
onLoad((options) => {
if ( options.type == 'info' ) {
pageData.id = options.id;
getConponInfo();
let itemData = JSON.parse(options.item);
for (let item in itemData) {
formData[item] = itemData[item]
}
formData.userDays = formData.userDays.split(",");
}
})
@@ -82,39 +86,43 @@
let selectGoodsOpen = () => {
goods.value.open();
}
let getConponInfo = () => {
getTbShopCouponInfo(pageData.id).then((res) => {
// formData = res;
for (let item in res) {
formData[item] = res[item]
}
console.log(formData)
})
}
let stop = () => { }
let affirm = (item) => {
pageData.goodsData = item;
formData.products = [];
formData.products.push({
productId: item.id,
name: item.name,
num: null
})
formData.proId = item.id
formData.proName = item.name
}
/**
* 保存
*/
let save = () => {
if( !formData.title ){
uni.showToast({ title: '请输入商品名称' })
return false;
}
if( !formData.fullAmount ){
uni.showToast({ title: '请输入使用门槛' })
return false;
}
if( !formData.number ){
uni.showToast({ title: '请输入发放数量' })
return false;
}
let params = {
...formData
}
addTbShopCoupon(params).then((res) => {
go.back(1)
})
if(formData.id){
updateCoupon(params).then((res) => {
go.back(1)
})
} else{
addCoupon(params).then((res) => {
go.back(1)
})
}
}
</script>