123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <template>
- <view class="liet">
- <view class="title">
- <u-icon name="close" @click="close()"></u-icon>
- <view class="font-thirty-two font-color3" style="margin: 0 auto; font-weight: 600;">
- 调整折扣
- </view>
- </view>
- <view class="border">
- <view style="text-align: center; height: 130rpx; padding-top: 30rpx;" class="font-color5 font-twenty;" v-if="flag">*此价格是在最终的基础上进行整体折扣调整</view>
- <view v-else style="padding-top: 100rpx;"></view>
- <!-- <view class="font-twenty font-color3" style="margin: 20rpx 0 50rpx;">
- 商品折扣
- </view> -->
- <!-- <u-input v-model="value" :type="type" :border="border" /> -->
- <!-- <input type="number" v-model="value" placeholder="请输入数字" /> -->
- <input v-model="value" class="input" border="true" height="100" placeholder="请输入折扣" />
- </view>
- <view class="footer11">
- <button type="default" class="btn" @click="submit">确认</button>
- <button type="default" class="btnClose" @click="close">返回</button>
- </view>
- <u-toast ref="uToast" />
- </view>
-
- </template>
- <script>
- export default{
- data(){
- return{
- value:'',
- type: 'number',
- money: null,
- index: null,
- goodsRatePrice: null,
- num: null,
- flag: false,
- }
- },
- methods:{
- close(){
- this.$emit('close')
- },
- shows(money,goodsRatePrice,num, index){
- this.flag = false;
- this.money = money;
- this.index = index;
- this.num = num;
- this.goodsRatePrice = goodsRatePrice;
- },
- show(){
- this.flag = true;
- },
- submit(){
- if(this.$u.test.range(this.value, [0, 1])){
- if(this.flag){
- this.$emit('total', this.value);
- this.close();
- }else{
- if(this.value.charAt(0) === '.'){
- this.value = '0'+ this.value
- }
- if(this.value < this.money){
- console.log('***', this.value.charAt(0))
- this.$emit('add', this.value,this.goodsRatePrice,this.num, this.index);
- this.close();
- }else{
- this.$refs.uToast.show({
- title: '必须小于当前优惠,请重新输入!',
- type: 'default',
- })
- }
- }
- }else{
- this.$refs.uToast.show({
- title: '必须是小数,请重新输入!',
- type: 'default',
- })
- }
- // const num = /^[0-9]*$/;
- // if (num.test(this.value)) {
- // this.$emit('add', this.value);
- // this.close()
- // }else{
- // this.$refs.uToast.show({
- // title: '必须是数字,请重新输入!',
- // type: 'default',
- // })
- // }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .input{
- width: calc(100% - 30rpx);
- height: 100rpx;
- border: 2rpx solid #333333;
- border-radius: 24rpx;
- padding-left: 30rpx;
- }
- .liet{
- padding: 30rpx;
- background: #fff;
- min-height: 100vh;
- }
- .title {
- display: flex;
- align-items: center;
- text-align: center;
- .close {
- width: 50rpx;
- height: 50rpx;
- }
- }
-
- .border {
- border: 2rpx #E0E0E0 solid;
- border-left: none;
- border-right: none;
- margin: 30rpx 0;
-
- .area {
- height: 250rpx;
- }
- }
- .footer11{
- display: flex;
- justify-content: space-between;
- }
- .btnClose{
- width: 330rpx;
- margin: 50rpx auto;
- color: #2E4F1C;
- background: #fff;
- border-radius: 48rpx;
- border: 2rpx #2E4F1C solid;
- }
- .btn {
- width: 330rpx;
- margin: 50rpx auto;
- color: #ffffff;
- background: #2E4F1C;
- border-radius: 48rpx;
- }
- </style>
|