serviceRenew.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <div class="serviceRenew">
  3. <div class="descriptions-container">
  4. <div class="descriptions">
  5. <div class="title">
  6. {{ tenantInfo.platformServeName }}
  7. <span class="version" @click="versionVisible = true"><i class="icon_version"></i>版本对比</span>
  8. </div>
  9. <el-row style="padding: 0 20px">
  10. <el-col :span="6" class="border">
  11. <el-row>
  12. <el-col :span="24">学员上限:<span>{{ tenantInfo.studentUpLimit | numberFormat }}人</span></el-col>
  13. <el-col :span="24">原价:<span class="color">{{ tenantInfo.originalPrice | hasMoneyFormat }}</span></el-col>
  14. </el-row>
  15. </el-col>
  16. <el-col :span="16" :offset="2">
  17. <el-row>
  18. <el-col :span="24">&nbsp;</el-col>
  19. <el-col :span="24">合同价:<span class="color">{{ tenantInfo.contractPrice | moneyFormat }}元/{{ unitSuffix }}</span></el-col>
  20. </el-row>
  21. </el-col>
  22. </el-row>
  23. </div>
  24. </div>
  25. <el-form inline ref="form" :model="form" label-width="80px">
  26. <el-form-item label="续费期限"
  27. prop="val"
  28. :rules="[{ required: true, message: '请输入续费期限', trigger: 'blur' },
  29. { required: true, validator: validPrice, trigger: 'blur' }]">
  30. <el-input v-model="form.val" placeholder="请输入续费期限"
  31. oninput="value=value.indexOf('.') > -1?value.slice(0, value.indexOf('.') + 3):value"
  32. type="number">
  33. <div slot="append">{{ unitSuffix }}</div>
  34. </el-input>
  35. </el-form-item>
  36. <el-form-item>
  37. <el-button type="primary" @click="onRecharge" v-if="$helpers.permission('tenantInfo/renew')">确认续费</el-button>
  38. </el-form-item>
  39. </el-form>
  40. <el-dialog
  41. title="服务订单"
  42. :visible.sync="serviceVisible"
  43. width="1000px"
  44. v-if="serviceVisible"
  45. >
  46. <serviceModel :value="form.val" :tenantInfo="tenantInfo" v-on="$listeners" @close="serviceVisible = false" />
  47. </el-dialog>
  48. <el-dialog
  49. title="版本对比"
  50. :visible.sync="versionVisible"
  51. width="1000px"
  52. v-if="versionVisible"
  53. append-to-body
  54. >
  55. <version @close="versionVisible = false" />
  56. </el-dialog>
  57. </div>
  58. </template>
  59. <script>
  60. import serviceModel from '@/views/productService/model/serviceModel'
  61. import version from '@/views/productService/model/version'
  62. import { tenantInfoInfo } from '@/views/organManager/api'
  63. import { getTenantId } from '@/utils/auth'
  64. import { paymentMode } from '@/constant'
  65. export default {
  66. name: 'serviceRenew',
  67. components: {
  68. serviceModel,
  69. version
  70. },
  71. data() {
  72. return {
  73. paymentMode,
  74. serviceVisible: false,
  75. versionVisible: false,
  76. form: {
  77. val: null
  78. },
  79. tenantInfo: {
  80. platformServeName: null,
  81. studentUpLimit: 0,
  82. contractPrice: 0,
  83. originalPrice: 0,
  84. expiryUnit: 'YEAR'
  85. }
  86. }
  87. },
  88. computed: {
  89. unitSuffix() {
  90. // 后辍默认为年
  91. return this.paymentMode[this.tenantInfo.expiryUnit] || '年'
  92. }
  93. },
  94. mounted() {
  95. this.__init();
  96. },
  97. methods: {
  98. async __init() {
  99. try {
  100. const res = await tenantInfoInfo({ id: getTenantId() })
  101. const { data } = res
  102. this.tenantInfo = {
  103. platformServeName: data.platformServeName,
  104. studentUpLimit: data.studentUpLimit,
  105. contractPrice: data.productInfo?.contractPrice || 0,
  106. originalPrice: data.productInfo?.originalPrice || 0,
  107. expiryUnit: data.productInfo?.expiryUnit
  108. }
  109. } catch(e) {}
  110. },
  111. onRecharge() {
  112. this.$refs.form.validate(async (_) => {
  113. if(_) {
  114. this.serviceVisible = true
  115. }
  116. })
  117. },
  118. validPrice (rule, value, callback) {
  119. if ((value == "" && typeof value == "string") || value == null) {
  120. callback(new Error("请输入金额"));
  121. } else if (value <= 0) {
  122. callback(new Error("输入金额必须大于0"));
  123. } else if (value >= 100000) {
  124. callback(new Error("输入金额必须小于100000"));
  125. } else {
  126. callback();
  127. }
  128. }
  129. }
  130. }
  131. </script>
  132. <style lang="less" scoped>
  133. .descriptions-container {
  134. display: flex;
  135. // align-items: center;
  136. justify-content: space-between;
  137. margin-bottom: 15px;
  138. .descriptions {
  139. width: 100%;
  140. min-height: 170px;
  141. background-color: #f8f8f8;
  142. border-radius: 6px;
  143. border: 1px solid rgba(0, 0, 0, 0.1);
  144. .title {
  145. display: flex;
  146. align-items: center;
  147. // justify-content: space-between;
  148. padding: 20px 0 15px;
  149. margin: 0 20px 5px;
  150. line-height: 30px;
  151. font-size: 21px;
  152. font-weight: 500;
  153. border-bottom: 1px solid #979797;
  154. }
  155. }
  156. .el-col {
  157. height: 22px;
  158. line-height: 22px;
  159. font-size: 16px;
  160. color: #212121;
  161. display: table;
  162. span {
  163. color: #6D7278;
  164. }
  165. }
  166. .el-col-24 {
  167. padding-top: 15px;
  168. }
  169. .border {
  170. position: relative;
  171. &::after {
  172. content: ' ';
  173. width: 1px;
  174. height: 36px;
  175. background-color: #979797;
  176. display: block;
  177. position: absolute;
  178. top: 25px;
  179. right: 0;
  180. }
  181. }
  182. }
  183. .version {
  184. margin-left: 12px;
  185. cursor: pointer;
  186. display: flex;
  187. align-items: center;
  188. justify-content: center;
  189. width: 92px;
  190. height: 26px;
  191. line-height: 26px;
  192. background: var(--color-primary);
  193. border-radius: 7px 0px 7px 0px;
  194. font-size: 14px;
  195. color: #fff;
  196. .icon_version {
  197. display: inline-block;
  198. background: url("../../../assets/images/icon_version.png") no-repeat center;
  199. background-size: cover;
  200. width: 14px;
  201. height: 15px;
  202. margin-right: 6px;
  203. }
  204. }
  205. .tips {
  206. background: #f7f7f7;
  207. padding: 15px;
  208. h2 {
  209. font-size: 18px;
  210. line-height: 1.5;
  211. height: auto;
  212. }
  213. .tips_container {
  214. line-height: 1.5;
  215. }
  216. }
  217. .el-input, .el-select {
  218. width: 300px !important;
  219. }
  220. </style>