tb-account-list.html 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>客户账户-列表</title>
  5. <meta 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/node_modules/crypto-js/crypto-js.js"></script>
  18. <style>
  19. .sum-div {
  20. text-align: right;
  21. padding: 10px 150px 10px;
  22. font-weight: bold;
  23. }
  24. .sum-title {
  25. color: darkred;
  26. font-weight: bold;
  27. }
  28. </style>
  29. </head>
  30. <body>
  31. <div class="vue-box" style="display: none;" :style="'display: block;'">
  32. <div class="c-panel">
  33. <!-- ------------- 检索参数 ------------- -->
  34. <div class="c-title">检索参数</div>
  35. <el-form ref="form" :model='p' @submit.native.prevent>
  36. <sa-item type="text" name="企业名称" v-model="p.customerName"></sa-item>
  37. <sa-item type="text" name="联系人" v-model="p.dutyPeople"></sa-item>
  38. <sa-item type="text" name="联系电话" v-model="p.phone"></sa-item>
  39. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  40. <el-button type="info" icon="el-icon-refresh" @click="p.customerName = '';p.dutyPeople='';p.phone=''; f5()">查询</el-button>
  41. <br />
  42. </el-form>
  43. <!-- ------------- 快捷按钮 ------------- -->
  44. <!-- <sa-item type="fast-btn" show="add,get,delete,export,reset"></sa-item>-->
  45. <!-- ------------- 数据列表 ------------- -->
  46. <div class="sum-div">总共 <span
  47. class="sum-title">{{dataCount}}</span>条;总金额:<span class="sum-title">¥{{totalMoney.toFixed(2)}}</span>元</div>
  48. <el-table class="data-table" ref="data-table" :data="dataList">
  49. <sa-td type="index" name="序号"></sa-td>
  50. <sa-td name="企业名称" prop="customerName" width="260"></sa-td>
  51. <sa-td name="联系人" prop="dutyPeople"></sa-td>
  52. <sa-td name="联系电话" prop="phone"></sa-td>
  53. <sa-td name="纳税识别号" prop="taxNum" width="200"></sa-td>
  54. <sa-td name="开户银行" prop="bank"></sa-td>
  55. <sa-td name="银行账户" prop="bankAccount"></sa-td>
  56. <sa-td name="余额(元)" prop="totalMoney" not="0" width="120"></sa-td>
  57. <el-table-column label="操作" fixed="right" width="180px">
  58. <template slot-scope="s">
  59. <el-button class="c-btn" type="success" @click="add(s.row)"
  60. v-if="sa.isAuth('tb-account-list-add')">充值</el-button>
  61. <el-button class="c-btn" type="warning" @click="refundFn(s.row)"
  62. v-if="sa.isAuth('tb-account-list-refund')&&s.row.totalMoney>0">退款</el-button>
  63. <el-button class="c-btn" type="primary" v-if="sa.isAuth('tb-account-list-update')"
  64. @click="update(s.row)">修改</el-button>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <!-- ------------- 分页 ------------- -->
  69. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
  70. </sa-item>
  71. </div>
  72. <div>
  73. <el-dialog title="退款操作" :visible.sync="refund.visible" :modal="false" width="400px">
  74. <div>
  75. <el-form>
  76. <sa-item type="text" name="企业名称" v-model="refund.form.customerName" :disabled="true" br>
  77. </sa-item>
  78. <sa-item type="text" name="可退款金额" v-model="refund.form.totalMoney" :disabled="true" br>
  79. </sa-item>
  80. <sa-item type="num" name="退款金额" v-model="refund.form.refundMoney" br></sa-item>
  81. <sa-item type="enum" name="退款方式" br>
  82. <el-select v-model="refund.form.payingType">
  83. <el-option label="请选择" v-for="(item,index) in payingTypeList" :key="item.id"
  84. :label="item.name" :value="item.id">
  85. </el-option>
  86. </el-select>
  87. </sa-item>
  88. <sa-item type="textarea" name="退款原因" v-model="refund.form.refundReason" :rows="2" br>
  89. </sa-item>
  90. </el-form>
  91. </div>
  92. <span slot="footer" class="dialog-footer">
  93. <el-button @click="refund.visible = false">取 消</el-button>
  94. <el-button type="primary" @click="sureRefund">确 定</el-button>
  95. </span>
  96. </el-dialog>
  97. </div>
  98. </div>
  99. <script>
  100. </script>
  101. <script>
  102. var app = new Vue({
  103. components: {
  104. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  105. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  106. },
  107. el: '.vue-box',
  108. data: {
  109. refund: {
  110. visible: false,
  111. form: {
  112. id: '',
  113. money: '',
  114. refundMoney: 0,
  115. refundReason: '',
  116. payingType: 1
  117. }
  118. },
  119. payingTypeList: [],
  120. totalMoney:0,
  121. p: { // 查询参数
  122. id: '', // 主键
  123. customerId: '', // 客户id
  124. // accountNo: '', // 账户
  125. customerName: '',
  126. dutyPeople: '',
  127. phone: '',
  128. taxNum: '',
  129. bank: '',
  130. bankAccount: '',
  131. address: '',
  132. totalMoney: '', // 总金额
  133. lastTopupMoney: '', // 最后充值金额
  134. // status: '', // 状态(0=禁用,1=启用)
  135. createTime: '', // 创建时间
  136. createBy: '', // 创建人
  137. updateTime: '', // 更新时间
  138. updateBy: '', // 更新人
  139. pageNo: 1, // 当前页
  140. pageSize: 10, // 页大小
  141. sortType: 0 // 排序方式
  142. },
  143. dataCount: 0,
  144. dataList: [], // 数据集合
  145. },
  146. methods: {
  147. getSum(){
  148. sa.ajax('/TbAccount/getSum', sa.removeNull(this.p), function(res) {
  149. this.totalMoney=res.data;
  150. }.bind(this));
  151. },
  152. refundFn(data) {
  153. Object.assign(this.refund, {
  154. visible: true,
  155. form: {
  156. id: data.id,
  157. customerId: data.customerId,
  158. customerName: data.customerName,
  159. totalMoney: data.totalMoney,
  160. refundMoney: 0,
  161. payingType: 1,
  162. refundReason: ''
  163. }
  164. })
  165. },
  166. sureRefund() {
  167. let form = this.refund.form;
  168. let refundMoney = form.refundMoney;
  169. if (refundMoney <= 0) {
  170. sa.error('退款金额须大于0')
  171. return;
  172. }
  173. if (refundMoney > form.totalMoney) {
  174. sa.error('退款金额不能大于余额')
  175. return;
  176. }
  177. if (!form.refundReason) {
  178. sa.error('请输入退款原因')
  179. return;
  180. }
  181. sa.ajax('/TbAccount/refund/account', form, function(res) {
  182. this.refund.visible = false;
  183. sa.alert('已退款');
  184. this.f5();
  185. }.bind(this))
  186. },
  187. getPayingType() {
  188. sa.ajax('/TbAccount/getPayingType', function(res) {
  189. this.payingTypeList = res.data;
  190. }.bind(this))
  191. },
  192. printFn() {
  193. let p = this.p;
  194. sa.showIframe('打印', 'balance-print.html', '1080px', '90%');
  195. },
  196. // 刷新
  197. f5: function() {
  198. sa.ajax('/TbAccount/getList', sa.removeNull(this.p), function(res) {
  199. this.dataList = res.data; // 数据
  200. this.dataCount = res.dataCount; // 数据总数
  201. sa.f5TableHeight(); // 刷新表格高度
  202. this.getSum();
  203. }.bind(this));
  204. },
  205. update: function(data) {
  206. sa.showIframe('修改数据', 'tb-account-update.html?customerId=' + data.customerId +
  207. '&id=' + data.id, '1000px', '90%');
  208. },
  209. // 新增
  210. add: function(data) {
  211. sa.showIframe('充值账户', 'tb-account-add.html?customerId=' + data.customerId +
  212. '&id=' + data.id, '700px', '70%');
  213. },
  214. encrypt(word, keyStr) { // word, keyStr第一个参数是加密的字段名字 第二个是key值(16位)
  215. if (!word) {
  216. return;
  217. }
  218. if (typeof word === 'object') {
  219. // 如果传入的data是json对象,先转义为json字符串
  220. try {
  221. word = JSON.stringify(word);
  222. } catch (error) {
  223. console.log('error:', error);
  224. }
  225. }
  226. keyStr = keyStr || 'h!f78tr#L3D$2Z0q'; // 密文(密钥)
  227. let key = CryptoJS.enc.Utf8.parse(keyStr);
  228. let src = CryptoJS.enc.Utf8.parse(word);
  229. let encrypted = CryptoJS.AES.encrypt(src, key, {
  230. mode: CryptoJS.mode.ECB,
  231. padding: CryptoJS.pad.Pkcs7
  232. });
  233. // console.log(encrypted.toString())
  234. return CryptoJS.enc.Base64.stringify(encrypted.ciphertext);
  235. },
  236. decrypt(word, keyStr) {
  237. if (!word) {
  238. return;
  239. }
  240. keyStr = keyStr || 'h!f78tr#L3D$2Z0q';
  241. let base64 = CryptoJS.enc.Base64.parse(word);
  242. let src = CryptoJS.enc.Base64.stringify(base64);
  243. let key = CryptoJS.enc.Utf8.parse(keyStr);
  244. let decrypt = CryptoJS.AES.decrypt(src, key, {
  245. mode: CryptoJS.mode.ECB,
  246. padding: CryptoJS.pad.Pkcs7
  247. });
  248. // let decryptedStr = decrypt.toString(CryptoJS.enc.Utf8);
  249. return CryptoJS.enc.Utf8.stringify(decrypt).toString();
  250. },
  251. },
  252. created: function() {
  253. this.f5();
  254. sa.onInputEnter();
  255. this.getPayingType();
  256. }
  257. })
  258. </script>
  259. </body>
  260. </html>