| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <template>
- <view>
- <!--mine/page/page.wxml-->
- <view class="title" v-if="title&&!isHetong">{{ title }}</view>
- <view class="" style="padding: 30rpx 30rpx 50rpx;" v-if="isHetong">
- <rich-text :nodes="params"></rich-text>
- </view>
- <view class="content" v-else>
- <rich-text :nodes="params"></rich-text>
- </view>
- </view>
- </template>
- <script>
- // mine/page/page.js
- const app = getApp();
- const req = require('../../utils/request.js');
- const util = require('../../utils/util')
- export default {
- data() {
- return {
- title: '',
- isXieyi: false, //用户协议
- isYinsi: false, //隐私政策
- isHetong: false, //合同
- params: '',
- hetongId: null
- };
- },
- components: {},
- props: {},
- onLoad: function(options) {
- this.id = options.id;
- if (options.isXieyi) {
- this.isXieyi = true;
- }
- if (options.isYinsi) {
- this.isYinsi = true;
- }
- if (options.isHetong) {
- this.isHetong = true;
- }
- this.title = options.title;
- if (options.hetongId) this.hetongId = options.hetongId
- // if (this.title) {
- // uni.setNavigationBarTitle({
- // title: this.title
- // });
- // }
- this.getData();
- },
- methods: {
- getData() {
- var that = this;
- let url = false;
- let form = {};
- if (that.isXieyi) {
- req.getRequest('/api/other/config', {}, function(res) {
- that.params = res.SERVICE_AGREEMENT;
- });
- } else if (that.isYinsi) {
- req.getRequest('/api/other/config', {}, function(res) {
- that.params = res.PRIVACY_AGREEMENT;
- });
- } else if (that.isHetong) {
- req.getRequest('/admin/v2/contract/' + this.hetongId, {}, (data)=> {
- data.content = data.content.replace(/{partyb}/, data.partyb);
- data.content = data.content.replace(/{card_no}/, data.partybCardNo);
- data.content = data.content.replace(/{partyb_mobile}/, data.partybPhone);
- data.leaseStart = data.leaseStart.split('-');
- data.content = data.content.replace(/{hire_begin}/, data.leaseStart[0] + '年' + data
- .leaseStart[1] + '月' + data.leaseStart[2]);
- if (data.leaseEnd) {
- data.leaseEnd = data.leaseEnd.split('-');
- }
- data.content = data.content.replace(/{hire_end}/, data.leaseEnd ? data.leaseEnd[0] + '年' +
- data.leaseEnd[1] + '月' + data.leaseEnd[2] : '____');
- if (data.leaseTime) {
- data.leaseTime = this.getTime(data.leaseTime);
- }
- let time = '';
- if (data.leaseTime[0] == 0 && data.leaseTime[1] == 0) time = '01分钟';
- if (data.leaseTime[0] > 0) {
- time += data.leaseTime[0] + '小时';
- }
- if (data.leaseTime[1] >= 0) {
- time += data.leaseTime[1] + '分钟';
- }
- data.content = data.content.replace(/{hire_duration}/, time ? time : '____');
- data.content = data.content.replace(/{battery_model}/, data.batteryModel);
- data.content = data.content.replace(/{battery_num}/, data.batteryNum);
- data.content = data.content.replace(/{deposit}/, data.deposit);
- data.content = data.content.replace(/{hire_price}/, data.leaseMoney);
- data.content = data.content.replace(/{order_sign}/, '');
- that.params = data.content;
- });
- }
- },
- getTime(time) {
- return util.countDown(time);
- },
- }
- };
- </script>
- <style>
- @import './page.css';
- </style>
|