123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- <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">
- 合计:{{num*price}}元
- </view>
- <view class="button">
- <button type="primary" @click="buy()" class="button2">
- <p class="p">购买</p>
- </button>
- </view>
- <font class="font1">{{title}}</font>
- <view class="" style="margin: auto;">
- <!-- <font class="font1">{{title}}</font> -->
- <image class="" :src=img mode=""></image>
- </view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapActions,
- mapMutations
- } from 'vuex'
- export default {
- data() {
- return {
- price: '',
- num: '10',
- title: '',
- img: null
- }
- },
- onLoad() {},
- onShow() {
- this.findPrice();
- },
- methods: {
- ...mapActions('chart', ['getPrice', 'pay']),
- findPrice() {
- var name = "dayPay";
- this.getPrice(name)
- .then(data => {
- this.price = data;
- }, _ => void uni.stopPullDownRefresh());
- },
- buy() {
- var p = this.price;
- var n = this.num;
- var pri = p * n;
- if (pri == 0) {
- uni.showModal({
- content: '请选择数量',
- showCancel: false
- });
- return null;
- }
- const param = {};
- param['price'] = pri;
- param['type'] = "0";
- param['equipmentId'] = uni.getStorageSync("nowEquipmentId");
- param['adminId'] = uni.getStorageSync("globalUser").id;
- this.pay(param).then(data => {
- this.title = "请用微信扫码支付";
- this.img = data;
- }, _ => void uni.stopPullDownRefresh());
- },
- },
- }
- </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: 600upx;
- weight: 600upx;
- margin: auto;
- }
- </style>
|