123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>客户账户-列表</title>
- <meta charset="utf-8">
- <meta name="viewport"
- content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
- <!-- 所有的 css & js 资源 -->
- <link rel="stylesheet" href="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
- <link rel="stylesheet" href="../../static/sa.css">
- <script src="../../static/kj/vue.min.js"></script>
- <script src="../../static/kj/element-ui/index.js"></script>
- <script src="../../static/kj/httpVueLoader.js"></script>
- <script src="../../static/kj/jquery.min.js"></script>
- <script src="../../static/kj/layer/layer.js"></script>
- <script src="../../static/sa.js"></script>
- <script src="../../static/node_modules/crypto-js/crypto-js.js"></script>
- <style>
- .sum-div {
- text-align: right;
- padding: 10px 150px 10px;
- font-weight: bold;
- }
-
- .sum-title {
- color: darkred;
- font-weight: bold;
- }
- </style>
- </head>
- <body>
- <div class="vue-box" style="display: none;" :style="'display: block;'">
- <div class="c-panel">
- <!-- ------------- 检索参数 ------------- -->
- <div class="c-title">检索参数</div>
- <el-form ref="form" :model='p' @submit.native.prevent>
- <sa-item type="text" name="企业名称" v-model="p.customerName"></sa-item>
- <sa-item type="text" name="联系人" v-model="p.dutyPeople"></sa-item>
- <sa-item type="text" name="联系电话" v-model="p.phone"></sa-item>
- <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
- <el-button type="info" icon="el-icon-refresh" @click="p.customerName = '';p.dutyPeople='';p.phone=''; f5()">查询</el-button>
- <br />
- </el-form>
- <!-- ------------- 快捷按钮 ------------- -->
- <!-- <sa-item type="fast-btn" show="add,get,delete,export,reset"></sa-item>-->
- <!-- ------------- 数据列表 ------------- -->
- <div class="sum-div">总共 <span
- class="sum-title">{{dataCount}}</span>条;总金额:<span class="sum-title">¥{{totalMoney.toFixed(2)}}</span>元</div>
- <el-table class="data-table" ref="data-table" :data="dataList">
- <sa-td type="index" name="序号"></sa-td>
- <sa-td name="企业名称" prop="customerName" width="260"></sa-td>
- <sa-td name="联系人" prop="dutyPeople"></sa-td>
- <sa-td name="联系电话" prop="phone"></sa-td>
- <sa-td name="纳税识别号" prop="taxNum" width="200"></sa-td>
- <sa-td name="开户银行" prop="bank"></sa-td>
- <sa-td name="银行账户" prop="bankAccount"></sa-td>
- <sa-td name="余额(元)" prop="totalMoney" not="0" width="120"></sa-td>
- <el-table-column label="操作" fixed="right" width="180px">
- <template slot-scope="s">
- <el-button class="c-btn" type="success" @click="add(s.row)"
- v-if="sa.isAuth('tb-account-list-add')">充值</el-button>
- <el-button class="c-btn" type="warning" @click="refundFn(s.row)"
- v-if="sa.isAuth('tb-account-list-refund')&&s.row.totalMoney>0">退款</el-button>
- <el-button class="c-btn" type="primary" v-if="sa.isAuth('tb-account-list-update')"
- @click="update(s.row)">修改</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!-- ------------- 分页 ------------- -->
- <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
- </sa-item>
- </div>
- <div>
- <el-dialog title="退款操作" :visible.sync="refund.visible" :modal="false" width="400px">
- <div>
- <el-form>
- <sa-item type="text" name="企业名称" v-model="refund.form.customerName" :disabled="true" br>
- </sa-item>
- <sa-item type="text" name="可退款金额" v-model="refund.form.totalMoney" :disabled="true" br>
- </sa-item>
- <sa-item type="num" name="退款金额" v-model="refund.form.refundMoney" br></sa-item>
- <sa-item type="enum" name="退款方式" br>
- <el-select v-model="refund.form.payingType">
- <el-option label="请选择" v-for="(item,index) in payingTypeList" :key="item.id"
- :label="item.name" :value="item.id">
- </el-option>
- </el-select>
- </sa-item>
- <sa-item type="textarea" name="退款原因" v-model="refund.form.refundReason" :rows="2" br>
- </sa-item>
- </el-form>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="refund.visible = false">取 消</el-button>
- <el-button type="primary" @click="sureRefund">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </div>
- <script>
- </script>
- <script>
- var app = new Vue({
- components: {
- "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
- "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
- },
- el: '.vue-box',
- data: {
- refund: {
- visible: false,
- form: {
- id: '',
- money: '',
- refundMoney: 0,
- refundReason: '',
- payingType: 1
- }
- },
- payingTypeList: [],
- totalMoney:0,
- p: { // 查询参数
- id: '', // 主键
- customerId: '', // 客户id
- // accountNo: '', // 账户
- customerName: '',
- dutyPeople: '',
- phone: '',
- taxNum: '',
- bank: '',
- bankAccount: '',
- address: '',
- totalMoney: '', // 总金额
- lastTopupMoney: '', // 最后充值金额
- // status: '', // 状态(0=禁用,1=启用)
- createTime: '', // 创建时间
- createBy: '', // 创建人
- updateTime: '', // 更新时间
- updateBy: '', // 更新人
- pageNo: 1, // 当前页
- pageSize: 10, // 页大小
- sortType: 0 // 排序方式
- },
- dataCount: 0,
- dataList: [], // 数据集合
- },
-
- methods: {
- getSum(){
- sa.ajax('/TbAccount/getSum', sa.removeNull(this.p), function(res) {
- this.totalMoney=res.data;
- }.bind(this));
- },
- refundFn(data) {
- Object.assign(this.refund, {
- visible: true,
- form: {
- id: data.id,
- customerId: data.customerId,
- customerName: data.customerName,
- totalMoney: data.totalMoney,
- refundMoney: 0,
- payingType: 1,
- refundReason: ''
- }
- })
- },
- sureRefund() {
- let form = this.refund.form;
- let refundMoney = form.refundMoney;
- if (refundMoney <= 0) {
- sa.error('退款金额须大于0')
- return;
- }
- if (refundMoney > form.totalMoney) {
- sa.error('退款金额不能大于余额')
- return;
- }
- if (!form.refundReason) {
- sa.error('请输入退款原因')
- return;
- }
- sa.ajax('/TbAccount/refund/account', form, function(res) {
- this.refund.visible = false;
- sa.alert('已退款');
- this.f5();
- }.bind(this))
- },
- getPayingType() {
- sa.ajax('/TbAccount/getPayingType', function(res) {
- this.payingTypeList = res.data;
- }.bind(this))
- },
- printFn() {
- let p = this.p;
- sa.showIframe('打印', 'balance-print.html', '1080px', '90%');
- },
- // 刷新
- f5: function() {
- sa.ajax('/TbAccount/getList', sa.removeNull(this.p), function(res) {
- this.dataList = res.data; // 数据
- this.dataCount = res.dataCount; // 数据总数
- sa.f5TableHeight(); // 刷新表格高度
- this.getSum();
- }.bind(this));
- },
- update: function(data) {
- sa.showIframe('修改数据', 'tb-account-update.html?customerId=' + data.customerId +
- '&id=' + data.id, '1000px', '90%');
- },
- // 新增
- add: function(data) {
- sa.showIframe('充值账户', 'tb-account-add.html?customerId=' + data.customerId +
- '&id=' + data.id, '700px', '70%');
- },
- encrypt(word, keyStr) { // word, keyStr第一个参数是加密的字段名字 第二个是key值(16位)
- if (!word) {
- return;
- }
- if (typeof word === 'object') {
- // 如果传入的data是json对象,先转义为json字符串
- try {
- word = JSON.stringify(word);
- } catch (error) {
- console.log('error:', error);
- }
- }
- keyStr = keyStr || 'h!f78tr#L3D$2Z0q'; // 密文(密钥)
- let key = CryptoJS.enc.Utf8.parse(keyStr);
- let src = CryptoJS.enc.Utf8.parse(word);
- let encrypted = CryptoJS.AES.encrypt(src, key, {
- mode: CryptoJS.mode.ECB,
- padding: CryptoJS.pad.Pkcs7
- });
- // console.log(encrypted.toString())
- return CryptoJS.enc.Base64.stringify(encrypted.ciphertext);
- },
- decrypt(word, keyStr) {
- if (!word) {
- return;
- }
- keyStr = keyStr || 'h!f78tr#L3D$2Z0q';
- let base64 = CryptoJS.enc.Base64.parse(word);
- let src = CryptoJS.enc.Base64.stringify(base64);
- let key = CryptoJS.enc.Utf8.parse(keyStr);
- let decrypt = CryptoJS.AES.decrypt(src, key, {
- mode: CryptoJS.mode.ECB,
- padding: CryptoJS.pad.Pkcs7
- });
- // let decryptedStr = decrypt.toString(CryptoJS.enc.Utf8);
- return CryptoJS.enc.Utf8.stringify(decrypt).toString();
- },
- },
- created: function() {
- this.f5();
- sa.onInputEnter();
- this.getPayingType();
-
- }
- })
- </script>
- </body>
- </html>
|