tb-account-add.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>客户账户-添加</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  6. <meta name="viewport"
  7. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  8. <!-- 所有的 css js 资源 -->
  9. <link rel="stylesheet" href="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
  10. <link rel="stylesheet" href="../../static/sa.css">
  11. <script src="../../static/kj/vue.min.js"></script>
  12. <script src="../../static/kj/element-ui/index.js"></script>
  13. <script src="../../static/kj/httpVueLoader.js"></script>
  14. <script src="../../static/kj/jquery.min.js"></script>
  15. <script src="../../static/kj/layer/layer.js"></script>
  16. <script src="../../static/sa.js"></script>
  17. <script src="../../static/kj/upload-util.js"></script>
  18. <script src="../../static/node_modules/crypto-js/crypto-js.js"></script>
  19. <style type="text/css">
  20. .c-panel .el-form .c-label {
  21. width: 8em !important;
  22. }
  23. .c-panel .el-form .el-input,
  24. .c-panel .el-form .el-textarea__inner {
  25. width: 250px;
  26. }
  27. #ast .c-label:before {
  28. content: '*';
  29. color: red;
  30. }
  31. </style>
  32. </head>
  33. <body>
  34. <div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
  35. <!-- ------- 内容部分 ------- -->
  36. <div class="s-body">
  37. <div class="c-panel" style="text-align:center; ">
  38. <div class="c-title">充值</div>
  39. <el-form v-if="m">
  40. <sa-item type="text" name="客户名称" v-model="m.customerName" :disabled="true" br></sa-item>
  41. <sa-item type="text" name="客户余额" v-model="m.totalMoney" :disabled="true" br></sa-item>
  42. <sa-item name="实际收款" br>
  43. <el-input type="number" v-model="m.totalTopup" >
  44. <template slot="suffix">元</template>
  45. </el-input>
  46. </sa-item>
  47. <sa-item type="num" name="优惠金额" v-model="m.discountMoney" br></sa-item>
  48. <sa-item type="num" name="本次充值金额" v-model="preTopupMoney" disabled br></sa-item>
  49. <sa-item type="enum" name="付款方式" br>
  50. <el-select v-model="m.payingType">
  51. <el-option label="请选择" v-for="(item,index) in payingTypeList" :key="item.id"
  52. :label="item.name" :value="item.id">
  53. </el-option>
  54. </el-select>
  55. </sa-item>
  56. <sa-item type="textarea" name="充值说明" v-model="m.remark" :rows="2" br></sa-item>
  57. </el-form>
  58. </div>
  59. </div>
  60. <!-- ------- 底部按钮 ------- -->
  61. <div class="s-foot">
  62. <el-button type="primary" @click="ok()">确定</el-button>
  63. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  64. </div>
  65. </div>
  66. <script>
  67. var app = new Vue({
  68. components: {
  69. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  70. },
  71. el: '.vue-box',
  72. data: {
  73. id: sa.p('id', ''),
  74. customerId: sa.p('customerId', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  75. m: {
  76. id: '',
  77. customerId: sa.p('customerId', ''),
  78. customerName: '',
  79. totalMoney: 0,
  80. preTopupMoney: 0,
  81. discountMoney: 0,
  82. totalTopup: 0,
  83. payingType: '',
  84. salt: '',
  85. remark: '',
  86. },
  87. payingTypeList: [], //付款方式集合
  88. },
  89. computed: {
  90. preTopupMoney() {
  91. let money= parseInt(this.m.totalTopup) + parseInt(this.m.discountMoney);
  92. if(money<0){
  93. money=0;
  94. sa.error('金额不正确');
  95. }
  96. return money;
  97. }
  98. },
  99. methods: {
  100. // 提交数据
  101. ok: function() {
  102. this.m.preTopupMoney=this.preTopupMoney;
  103. sa.ajax('/TbAccount/recharge', sa.removeNull(this.m), function(res) {
  104. sa.alert('充值成功', this.clean);
  105. }.bind(this));
  106. },
  107. // 添加/修改 完成后的动作
  108. clean: function() {
  109. parent.app.f5(); // 刷新父页面列表
  110. sa.closeCurrIframe(); // 关闭本页
  111. },
  112. getPayingType() {
  113. sa.ajax('/TbAccount/getPayingType', function(res) {
  114. this.payingTypeList = res.data;
  115. }.bind(this))
  116. },
  117. computeChange(value) {
  118. let preMoney = this.m.preTopupMoney;
  119. if (preMoney <= 0) {
  120. sa.error('充值金额须大于0');
  121. return;
  122. }
  123. let disMoney = this.m.discountMoney;
  124. if (disMoney < 0) {
  125. sa.error('优惠金额须不能为负数');
  126. return;
  127. }
  128. },
  129. },
  130. mounted: function() {
  131. let customerId=this.customerId;
  132. this.getPayingType();
  133. sa.ajax('/TbAccount/getCustomerAccount', {
  134. customerId: customerId
  135. }, function(res) {
  136. let data=res.data;
  137. this.m={
  138. id: data.id,
  139. customerId: customerId,
  140. customerName: data.customerName,
  141. totalMoney: data.totalMoney,
  142. preTopupMoney: 0,
  143. discountMoney: 0,
  144. totalTopup: 0,
  145. payingType: 1,
  146. remark: '',
  147. }
  148. }.bind(this))
  149. }
  150. })
  151. </script>
  152. </body>
  153. </html>