123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <template>
- <view class=" ">
- <view class="font header">
- 优惠码价格:{{price}}元/个
- </view>
- <view class="font header">
- <view class="font">
- 你要购买的数量:
- </view>
- <view class="input-two">
- <input type="text" class="input" v-model="num" />
- </view>
- <view class="font3">
- 个
- </view>
- </view>
- <view class="font2 header">
- <view class="font">
- 有效期:
- </view>
- <view class="input-two">
- <input type="text" class="input" v-model="day" />
- </view>
- <view class="font3">
- 天.(最长90天)
- </view>
- </view>
- <view class="font2 header">
- 合计:{{num*price}}元
- </view>
- <view class="button">
- <button type="primary" @click="buy()" class="button2">
- <p class="p">购买</p>
- </button>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- price:null,
- num:'10',
- day:'30'
- }
- },
- onLoad() {
- },
- onShow() {
- this.findPrice();
- },
- methods: {
- findPrice(){
- uni.request({
- url: this.serverurl + '/TPromoCode/findPrice',
- method: "GET",
- success: (res) => {
-
- this.price = res.data.data;
- }
- })
- },
- buy(){
- if(this.day>90){
- uni.showModal({
- content: '有效期不能超过90天',
- showCancel: false
- });
- return null;
- }
- console.log(this.num+this.day)
- }
- },
- }
- </script>
- <style>
- .header {
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- padding-left: 20upx;
- }
- .font{
- padding-top: 20upx;
- height: 70upx;
- color: #363D44;
- font-size: 36upx;
- font-family: "PingFang-SC-Bold";
- }
- .font2{
- padding-top: 40upx;
- padding-bottom: 30upx;
- height: 70upx;
- color: #363D44;
- font-size: 36upx;
- font-family: "PingFang-SC-Bold";
- }
- .font3{
- padding-left: 30upx;
- padding-top: 23upx;
- height: 70upx;
- color: #363D44;
- font-size: 36upx;
- font-family: "PingFang-SC-Bold";
- }
- .input-two {
- width: 80upx;
- height: 30upx;
- padding-top: 23upx;
- padding-left: 30upx;
- }
- .input {
- padding-left: 20upx;
-
- background-color: #FFFFFF;
- width: 80upx;
- height: 30upx;
- box-shadow: 0upx 0upx 20upx #D3D3D3;
- border-radius: 5upx;
- }
- .button{
- padding-top: 70upx;
- margin: auto;
- width: 80%;
- height: 100upx;
- }
- .button2{
- margin: auto;
- width: 80%;
- height: 100upx;
- }
- .p{
- padding-top: 2upx;
- margin: 0 auto;
- font-size: 45upx;
- font-family: "PingFang-SC-Bold";
- }
- </style>
|