123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <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 class="" style="margin: auto;">
- <font class="font1">{{title}}</font>
- <image class="img" :src=img mode=""></image>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- price:null,
- num:'10',
- day:'30',
- title:'',
- img:null
- }
- },
- 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;
- }
- var p = this.price;
- var n = this.num;
- var pri = p*n;
- if(pri==0){
- uni.showModal({
- content: '价格为0',
- showCancel: false
- });
- return null;
- }
- var globalUser = uni.getStorageSync("globalUser");
- var id = globalUser.id;
- uni.request({
- url: this.serverurl + '/TPromoCode/buy?pri='+pri+'&adminId='+id+'&day='+this.day,
- method: "GET",
- success: (res) => {
- var img = res.data.data;
- this.title = "请用微信扫码支付";
- this.img = img;
- }
- })
- console.log(pri)
- }
- },
- }
- </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";
- }
- .font1{
- color: #F4AE1B;
- padding-left: 300upx;
- padding-top: 100upx;
- font-size: 25upx;
- font-family: "PingFang-SC-Bold";
- }
- .img{
- height: 650upx;
- weight:650upx;
- margin: auto;
- }
- </style>
|