新增优惠券
This commit is contained in:
@@ -4,19 +4,19 @@
|
||||
<view class="item">
|
||||
<view class="lable">商品兑换券名称</view>
|
||||
<view class="value">
|
||||
<up-input placeholder="填写名称" border="none" clearable ></up-input>
|
||||
<up-input v-model="formData.title" placeholder="填写名称" border="none" clearable ></up-input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="lable">使用门槛</view>
|
||||
<view class="value">
|
||||
<view>满</view><input placeholder="填写金额" border="none"></input><view>元,可用</view>
|
||||
<view>满</view><input v-model="formData.fullAmount" placeholder="填写金额" border="none"></input><view>元,可用</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="lable">总发放数量</view>
|
||||
<view class="value">
|
||||
<up-input v-model="saveData.num" placeholder="填写数量" border="none" clearable ></up-input>
|
||||
<up-input v-model="formData.number" placeholder="填写数量" border="none" clearable ></up-input>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -28,7 +28,12 @@
|
||||
<view class="selectGoods" @tap="selectGoodsOpen">
|
||||
<view>
|
||||
<view class="title">选择商品</view>
|
||||
<view class="goodsName">选择指定商品</view>
|
||||
<view class="goodsName" v-if='formData.products.length <= 0'>选择指定商品</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>
|
||||
</view>
|
||||
</view>
|
||||
<up-icon name="arrow-right" color="#9F9F9F" size="22"></up-icon>
|
||||
</view>
|
||||
@@ -46,23 +51,31 @@
|
||||
</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 {
|
||||
reactive,
|
||||
ref,
|
||||
toRef,
|
||||
watch
|
||||
} from 'vue';
|
||||
import { getTbShopCouponInfo, addTbShopCoupon } from '@/http/yskApi/coupon.js'
|
||||
import { reactive, ref } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
const pageData = reactive({
|
||||
|
||||
id: null,
|
||||
goodsData: null,
|
||||
title: "",
|
||||
show: false,
|
||||
})
|
||||
const saveData = reactive({
|
||||
type: '1',
|
||||
timeType: '1',
|
||||
num: '',
|
||||
let formData = reactive({
|
||||
title: "",
|
||||
type: '2',
|
||||
fullAmount: null,
|
||||
number: null,
|
||||
products: []
|
||||
})
|
||||
|
||||
onLoad((options) => {
|
||||
if ( options.type == 'info' ) {
|
||||
pageData.id = options.id;
|
||||
getConponInfo();
|
||||
}
|
||||
})
|
||||
|
||||
let goods = ref(null)
|
||||
@@ -70,12 +83,38 @@
|
||||
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
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
let save = () => {
|
||||
console.log(saveData.type)
|
||||
console.log(saveData.timeType)
|
||||
let params = {
|
||||
...formData
|
||||
}
|
||||
addTbShopCoupon(params).then((res) => {
|
||||
go.back(1)
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -129,6 +168,13 @@
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
}
|
||||
.goodsItem{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.productName{
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user