| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- <template>
- <div class="serviceRenew">
- <div class="descriptions-container">
- <div class="descriptions">
- <div class="title">
- {{ tenantInfo.platformServeName }}
- <span class="version" @click="versionVisible = true"><i class="icon_version"></i>版本对比</span>
- </div>
- <el-row style="padding: 0 20px">
- <el-col :span="6" class="border">
- <el-row>
- <el-col :span="24">学员上限:<span>{{ tenantInfo.studentUpLimit | numberFormat }}人</span></el-col>
- <el-col :span="24">原价:<span class="color">{{ tenantInfo.originalPrice | hasMoneyFormat }}</span></el-col>
- </el-row>
- </el-col>
- <el-col :span="16" :offset="2">
- <el-row>
- <el-col :span="24"> </el-col>
- <el-col :span="24">合同价:<span class="color">{{ tenantInfo.contractPrice | moneyFormat }}元/{{ unitSuffix }}</span></el-col>
- </el-row>
- </el-col>
- </el-row>
- </div>
- </div>
- <el-form inline ref="form" :model="form" label-width="80px">
- <el-form-item label="续费期限"
- prop="val"
- :rules="[{ required: true, message: '请输入续费期限', trigger: 'blur' },
- { required: true, validator: validPrice, trigger: 'blur' }]">
- <el-input v-model="form.val" placeholder="请输入续费期限"
- oninput="value=value.indexOf('.') > -1?value.slice(0, value.indexOf('.') + 3):value"
- type="number">
- <div slot="append">{{ unitSuffix }}</div>
- </el-input>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="onRecharge" v-if="$helpers.permission('tenantInfo/renew')">确认续费</el-button>
- </el-form-item>
- </el-form>
- <el-dialog
- title="服务订单"
- :visible.sync="serviceVisible"
- width="1000px"
- v-if="serviceVisible"
- >
- <serviceModel :value="form.val" :tenantInfo="tenantInfo" v-on="$listeners" @close="serviceVisible = false" />
- </el-dialog>
- <el-dialog
- title="版本对比"
- :visible.sync="versionVisible"
- width="1000px"
- v-if="versionVisible"
- append-to-body
- >
- <version @close="versionVisible = false" />
- </el-dialog>
- </div>
- </template>
- <script>
- import serviceModel from '@/views/productService/model/serviceModel'
- import version from '@/views/productService/model/version'
- import { tenantInfoInfo } from '@/views/organManager/api'
- import { getTenantId } from '@/utils/auth'
- import { paymentMode } from '@/constant'
- export default {
- name: 'serviceRenew',
- components: {
- serviceModel,
- version
- },
- data() {
- return {
- paymentMode,
- serviceVisible: false,
- versionVisible: false,
- form: {
- val: null
- },
- tenantInfo: {
- platformServeName: null,
- studentUpLimit: 0,
- contractPrice: 0,
- originalPrice: 0,
- expiryUnit: 'YEAR'
- }
- }
- },
- computed: {
- unitSuffix() {
- // 后辍默认为年
- return this.paymentMode[this.tenantInfo.expiryUnit] || '年'
- }
- },
- mounted() {
- this.__init();
- },
- methods: {
- async __init() {
- try {
- const res = await tenantInfoInfo({ id: getTenantId() })
- const { data } = res
- this.tenantInfo = {
- platformServeName: data.platformServeName,
- studentUpLimit: data.studentUpLimit,
- contractPrice: data.productInfo?.contractPrice || 0,
- originalPrice: data.productInfo?.originalPrice || 0,
- expiryUnit: data.productInfo?.expiryUnit
- }
- } catch(e) {}
- },
- onRecharge() {
- this.$refs.form.validate(async (_) => {
- if(_) {
- this.serviceVisible = true
- }
- })
- },
- validPrice (rule, value, callback) {
- if ((value == "" && typeof value == "string") || value == null) {
- callback(new Error("请输入金额"));
- } else if (value <= 0) {
- callback(new Error("输入金额必须大于0"));
- } else if (value >= 100000) {
- callback(new Error("输入金额必须小于100000"));
- } else {
- callback();
- }
- }
- }
- }
- </script>
- <style lang="less" scoped>
- .descriptions-container {
- display: flex;
- // align-items: center;
- justify-content: space-between;
- margin-bottom: 15px;
- .descriptions {
- width: 100%;
- min-height: 170px;
- background-color: #f8f8f8;
- border-radius: 6px;
- border: 1px solid rgba(0, 0, 0, 0.1);
- .title {
- display: flex;
- align-items: center;
- // justify-content: space-between;
- padding: 20px 0 15px;
- margin: 0 20px 5px;
- line-height: 30px;
- font-size: 21px;
- font-weight: 500;
- border-bottom: 1px solid #979797;
- }
- }
- .el-col {
- height: 22px;
- line-height: 22px;
- font-size: 16px;
- color: #212121;
- display: table;
- span {
- color: #6D7278;
- }
- }
- .el-col-24 {
- padding-top: 15px;
- }
- .border {
- position: relative;
- &::after {
- content: ' ';
- width: 1px;
- height: 36px;
- background-color: #979797;
- display: block;
- position: absolute;
- top: 25px;
- right: 0;
- }
- }
- }
- .version {
- margin-left: 12px;
- cursor: pointer;
- display: flex;
- align-items: center;
- justify-content: center;
- width: 92px;
- height: 26px;
- line-height: 26px;
- background: var(--color-primary);
- border-radius: 7px 0px 7px 0px;
- font-size: 14px;
- color: #fff;
- .icon_version {
- display: inline-block;
- background: url("../../../assets/images/icon_version.png") no-repeat center;
- background-size: cover;
- width: 14px;
- height: 15px;
- margin-right: 6px;
- }
- }
- .tips {
- background: #f7f7f7;
- padding: 15px;
- h2 {
- font-size: 18px;
- line-height: 1.5;
- height: auto;
- }
- .tips_container {
- line-height: 1.5;
- }
- }
- .el-input, .el-select {
- width: 300px !important;
- }
- </style>
|