226 lines
4.1 KiB
Vue
226 lines
4.1 KiB
Vue
<template>
|
|
<view class="partner">
|
|
<!-- 表单组件 -->
|
|
<view class="form-wrapper" v-if="setting">
|
|
<u-form :model="form" ref="uForm" label-width="240rpx">
|
|
<view class="brand-poster">
|
|
<image :src="setting.background" mode="widthFix" class="banner"></image>
|
|
<view class="brand-name" v-html="setting.content"></view>
|
|
</view>
|
|
<view class="buy-info">
|
|
<u-radio-group v-model="agree" placement="column">
|
|
<u-radio name="购买协议" @change="radioChange">同意<text class="show-agreement">《购买协议》</text></u-radio>
|
|
</u-radio-group>
|
|
<text class="price">¥{{ setting.money }}</text>
|
|
</view>
|
|
<!-- 操作按钮 -->
|
|
<view class="footer">
|
|
<view class="btn">
|
|
<u-button :disabled="!agree" type="primary" shape="circle" @click="handleSubmit()">立即购买</u-button>
|
|
</view>
|
|
</view>
|
|
</u-form>
|
|
</view>
|
|
<u-modal v-model="show" ref="uModal" title="购买协议" @confirm="confirm">
|
|
<view v-html="setting.agreement" class="agreement-content"></view>
|
|
</u-modal>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
// 表单字段元素
|
|
const form = {
|
|
name: '',
|
|
phone: '',
|
|
sex: '',
|
|
money: '',
|
|
region: [],
|
|
weixin: '',
|
|
comments: '',
|
|
}
|
|
|
|
const sex = [{
|
|
name: '男',
|
|
value: 1,
|
|
disabled: false
|
|
},
|
|
{
|
|
name: '女',
|
|
value: 2,
|
|
disabled: false
|
|
}
|
|
]
|
|
|
|
import * as Api from '@/api/solution/index.js'
|
|
import * as ApplyApi from '@/api/solution/apply.js'
|
|
import * as SettingApi from '@/api/solution/setting.js'
|
|
import SelectRegion from '@/components/select-region/select-region'
|
|
export default {
|
|
components: {
|
|
SelectRegion
|
|
},
|
|
data() {
|
|
return {
|
|
form,
|
|
disabled: false,
|
|
detail: {},
|
|
solutionId: 0,
|
|
sex,
|
|
setting: {
|
|
money: 0
|
|
},
|
|
agree: 0,
|
|
// 是否显示协议内容
|
|
show: false
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.init()
|
|
},
|
|
methods: {
|
|
// 获取当前用户信息
|
|
init() {
|
|
const app = this
|
|
SettingApi.data().then(result => {
|
|
app.setting = result.data.setting
|
|
// 设置当前页面标题
|
|
app.setPageTitle()
|
|
})
|
|
},
|
|
|
|
// 设置当前页面标题
|
|
setPageTitle() {
|
|
uni.setNavigationBarTitle({
|
|
title: this.setting.title
|
|
})
|
|
},
|
|
|
|
radioChange() {
|
|
this.show = true
|
|
},
|
|
|
|
groupChange(e) {
|
|
this.form.sex = e
|
|
},
|
|
|
|
confirm(e){
|
|
let app = this
|
|
},
|
|
|
|
// 表单提交
|
|
handleSubmit() {
|
|
const app = this
|
|
const {
|
|
form
|
|
} = this
|
|
app.onSubmit()
|
|
},
|
|
|
|
// 提交到后端
|
|
onSubmit() {
|
|
const app = this
|
|
return this.$navTo('package/solution/cashier/index')
|
|
// const {
|
|
// form
|
|
// } = this
|
|
// let req;
|
|
// if (form.apply_status == 30) {
|
|
// req = ApplyApi.edit(form.apply_id, form)
|
|
// } else {
|
|
// console.log('add');
|
|
// req = ApplyApi.add(form)
|
|
// }
|
|
// req.then(result => {
|
|
// console.log("result: ", result);
|
|
// app.$toast(result.message)
|
|
// setTimeout(function() {
|
|
// uni.navigateBack()
|
|
// }, 2000)
|
|
|
|
// })
|
|
// .finally(() => app.disabled = false)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="less">
|
|
.partner {
|
|
.banner {
|
|
padding-top: 20rpx;
|
|
width: 100%;
|
|
}
|
|
|
|
.form-wrapper {
|
|
margin: 20rpx auto 20rpx auto;
|
|
padding: 0 40rpx;
|
|
width: 94%;
|
|
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
|
|
border-radius: 16rpx;
|
|
background: #fff;
|
|
|
|
.shop-box {
|
|
text-align: center;
|
|
display: flex;
|
|
flex-direction: column;
|
|
|
|
.shop-name {
|
|
font-weight: bold;
|
|
font-size: 36rpx;
|
|
}
|
|
}
|
|
|
|
.brand-poster{
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
|
|
.logo {
|
|
width: 100rpx;
|
|
}
|
|
|
|
.shipin {
|
|
width: 400rpx;
|
|
}
|
|
}
|
|
|
|
.footer {
|
|
width: 500rpx;
|
|
margin: 50rpx auto;
|
|
padding-bottom: 50rpx !important;
|
|
}
|
|
}
|
|
|
|
.brand-name {
|
|
text-align: center;
|
|
}
|
|
|
|
.buy-desc {
|
|
text-align: center;
|
|
color: #ff0000;
|
|
margin-top: 40rpx;
|
|
}
|
|
|
|
.buy-info {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
margin-top: 40rpx;
|
|
|
|
.price {
|
|
color: #ff0000;
|
|
}
|
|
|
|
.show-agreement{
|
|
color: #0000ff;
|
|
}
|
|
}
|
|
|
|
.buy-text {
|
|
text-align: center;
|
|
}
|
|
.agreement-content{
|
|
padding: 20rpx;
|
|
}
|
|
</style>
|