|
@@ -1,255 +1,272 @@
|
|
|
<!DOCTYPE html>
|
|
|
<html>
|
|
|
-<head>
|
|
|
- <title>客户账户-添加</title>
|
|
|
- <meta http-equiv="Content-Type" content="text/html; 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="https://unpkg.com/vue@2.6.10/dist/vue.js"></script>
|
|
|
- <script src="https://unpkg.com/element-ui@2.13.0/lib/index.js"></script>
|
|
|
- <script src="https://unpkg.com/http-vue-loader@1.4.2/src/httpVueLoader.js"></script>
|
|
|
- <script src="https://unpkg.com/jquery@3.4.1/dist/jquery.js"></script>
|
|
|
- <script src="https://www.layuicdn.com/layer-v3.1.1/layer.js"></script>
|
|
|
- <script src="../../static/sa.js"></script>
|
|
|
- <script src="../../static/kj/upload-util.js"></script>
|
|
|
- <script src="../../static/node_modules/crypto-js/crypto-js.js"></script>
|
|
|
- <style type="text/css">
|
|
|
- .c-panel .el-form .c-label {
|
|
|
- width: 8em !important;
|
|
|
- }
|
|
|
+ <head>
|
|
|
+ <title>客户账户-添加</title>
|
|
|
+ <meta http-equiv="Content-Type" content="text/html; 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="https://unpkg.com/vue@2.6.10/dist/vue.js"></script>
|
|
|
+ <script src="https://unpkg.com/element-ui@2.13.0/lib/index.js"></script>
|
|
|
+ <script src="https://unpkg.com/http-vue-loader@1.4.2/src/httpVueLoader.js"></script>
|
|
|
+ <script src="https://unpkg.com/jquery@3.4.1/dist/jquery.js"></script>
|
|
|
+ <script src="https://www.layuicdn.com/layer-v3.1.1/layer.js"></script>
|
|
|
+ <script src="../../static/sa.js"></script>
|
|
|
+ <script src="../../static/kj/upload-util.js"></script>
|
|
|
+ <script src="../../static/node_modules/crypto-js/crypto-js.js"></script>
|
|
|
+ <style type="text/css">
|
|
|
+ .c-panel .el-form .c-label {
|
|
|
+ width: 8em !important;
|
|
|
+ }
|
|
|
|
|
|
- .c-panel .el-form .el-input, .c-panel .el-form .el-textarea__inner {
|
|
|
- width: 250px;
|
|
|
- }
|
|
|
- #ast .c-label:before{
|
|
|
- content: '*';
|
|
|
- color:red;
|
|
|
- }
|
|
|
- </style>
|
|
|
-</head>
|
|
|
-<body>
|
|
|
-<div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
|
|
|
- <!-- ------- 内容部分 ------- -->
|
|
|
- <div class="s-body">
|
|
|
- <div class="c-panel" style="text-align:center; ">
|
|
|
- <div class="c-title">充值</div>
|
|
|
- <el-form v-if="m">
|
|
|
-<!-- <sa-item type="text" name="主键" v-model="m.id" br></sa-item>-->
|
|
|
-<!-- <sa-item type="text" name="客户id" v-model="m.customerId" br></sa-item>-->
|
|
|
- <sa-item type="text" name="客户名称" v-model="m.customerName" :disabled="true" br></sa-item>
|
|
|
- <sa-item type="text" name="客户余额" v-model="m.totalMoney" :disabled="true" br></sa-item>
|
|
|
- <sa-item id="ast" type="text" name="预存金额" br>
|
|
|
- <el-input v-model="m.preTopupMoney" placeholder="请输入金额" @change="computeChange" >
|
|
|
- <template slot="suffix">元</template>
|
|
|
- </el-input>
|
|
|
- </sa-item>
|
|
|
- <sa-item type="text" name="优惠金额" br>
|
|
|
- <el-input type="text" v-model="m.discountMoney" placeholder="请输入金额" @change="computeChange" >
|
|
|
- <template slot="suffix">元</template>
|
|
|
- </el-input>
|
|
|
- </sa-item>
|
|
|
- <sa-item type="text" name="总计充值" br>
|
|
|
- <el-input ref="totalTopupInp" type="text" v-model="m.totalTopup" :disabled="true">
|
|
|
- <template slot="suffix">元</template>
|
|
|
- </el-input>
|
|
|
- </sa-item>
|
|
|
- <sa-item type="enum" name="付款方式" br>
|
|
|
- <el-select v-model="m.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>
|
|
|
+ .c-panel .el-form .el-input,
|
|
|
+ .c-panel .el-form .el-textarea__inner {
|
|
|
+ width: 250px;
|
|
|
+ }
|
|
|
|
|
|
- <sa-item type="textarea" name="充值说明" v-model="m.remark" :rows="2" br></sa-item>
|
|
|
- <sa-item name="" class="s-ok" br>
|
|
|
- <el-button type="primary" icon="el-icon-plus" @click="ok()">确认充值</el-button>
|
|
|
- </sa-item>
|
|
|
- </el-form>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <!-- ------- 底部按钮 ------- -->
|
|
|
-<!-- <div class="s-foot">-->
|
|
|
-<!-- <el-button type="primary" @click="ok()">确定</el-button>-->
|
|
|
-<!-- <el-button @click="sa.closeCurrIframe()">取消</el-button>-->
|
|
|
-<!-- </div>-->
|
|
|
-</div>
|
|
|
-<script>
|
|
|
+ #ast .c-label:before {
|
|
|
+ content: '*';
|
|
|
+ color: red;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ <div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
|
|
|
+ <!-- ------- 内容部分 ------- -->
|
|
|
+ <div class="s-body">
|
|
|
+ <div class="c-panel" style="text-align:center; ">
|
|
|
+ <div class="c-title">充值</div>
|
|
|
+ <el-form v-if="m">
|
|
|
+ <!-- <sa-item type="text" name="主键" v-model="m.id" br></sa-item>-->
|
|
|
+ <!-- <sa-item type="text" name="客户id" v-model="m.customerId" br></sa-item>-->
|
|
|
+ <sa-item type="text" name="客户名称" v-model="m.customerName" :disabled="true" br></sa-item>
|
|
|
+ <sa-item type="text" name="客户余额" v-model="m.totalMoney" :disabled="true" br></sa-item>
|
|
|
+ <sa-item id="ast" type="text" name="充值金额" br>
|
|
|
+ <el-input v-model="m.preTopupMoney" placeholder="请输入金额" @change="computeChange">
|
|
|
+ <template slot="suffix">元</template>
|
|
|
+ </el-input>
|
|
|
+ </sa-item>
|
|
|
+ <sa-item type="text" name="优惠金额" br>
|
|
|
+ <el-input type="text" v-model="m.discountMoney" placeholder="请输入金额" @change="computeChange">
|
|
|
+ <template slot="suffix">元</template>
|
|
|
+ </el-input>
|
|
|
+ </sa-item>
|
|
|
+ <sa-item type="text" name="实收金额" br>
|
|
|
+ <el-input ref="totalTopupInp" type="text" v-model="m.totalTopup" :disabled="true">
|
|
|
+ <template slot="suffix">元</template>
|
|
|
+ </el-input>
|
|
|
+ </sa-item>
|
|
|
+ <sa-item type="enum" name="付款方式" br>
|
|
|
+ <el-select v-model="m.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="m.remark" :rows="2" br></sa-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- ------- 底部按钮 ------- -->
|
|
|
+ <div class="s-foot">
|
|
|
+ <el-button type="primary" @click="ok()">确定</el-button>
|
|
|
+ <el-button @click="sa.closeCurrIframe()">取消</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <script>
|
|
|
+ var app = new Vue({
|
|
|
+ components: {
|
|
|
+ "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
|
|
|
+ },
|
|
|
+ el: '.vue-box',
|
|
|
+ data: {
|
|
|
+ id: sa.p('id', ''),
|
|
|
+ customerId: sa.p('customerId', 0), // 获取超链接中的id参数(0=添加,非0=修改)
|
|
|
+ m: null, // 实体对象
|
|
|
+ payingTypeList: [], //付款方式集合
|
|
|
+ },
|
|
|
|
|
|
- var app = new Vue({
|
|
|
- components: {
|
|
|
- "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
|
|
|
- },
|
|
|
- el: '.vue-box',
|
|
|
- data: {
|
|
|
- id: '',
|
|
|
- customerId: sa.p('customerId', 0), // 获取超链接中的id参数(0=添加,非0=修改)
|
|
|
- m: null, // 实体对象
|
|
|
- payingTypeList:[], //付款方式集合
|
|
|
- },
|
|
|
+ methods: {
|
|
|
+ // 创建一个 默认Model
|
|
|
+ createModel: function() {
|
|
|
+ return {
|
|
|
+ id: '', // 主键
|
|
|
+ customerId: sa.p('customerId', ''), // 客户id
|
|
|
+ customerName: '',
|
|
|
+ totalMoney: '', // 总金额
|
|
|
+ preTopupMoney: '', //预充值金额
|
|
|
+ discountMoney: '', //优惠金额
|
|
|
+ totalTopup: '', //总计充值
|
|
|
+ payingType: '',
|
|
|
+ salt: '',
|
|
|
+ remark: '', // 备注
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 提交数据
|
|
|
+ ok: function() {
|
|
|
+ let that = this;
|
|
|
+ let m = {
|
|
|
+ ...this.m
|
|
|
+ };
|
|
|
+ sa.checkNull(m.preTopupMoney, '预存金额不能为空!');
|
|
|
+ if (!this.computeChange()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const key = 'h!f78tr#L3D$2Z0q';
|
|
|
+ m.salt = key.split("").reverse().join("");
|
|
|
+ m.totalTopup = this.encrypt(m.totalTopup, key);
|
|
|
+ m.discountMoney = this.encrypt(m.discountMoney, key);
|
|
|
+ m.preTopupMoney = this.encrypt(m.preTopupMoney, key);
|
|
|
+ m.id = sa.p('id', 0);
|
|
|
+ sa.ajax('/TbAccount/recharge2', sa.removeNull(m), function(res) {
|
|
|
+ layer.open({
|
|
|
+ content: '充值成功!', //内容区域
|
|
|
+ move: false, //是否可以拖动,默认可以拖动
|
|
|
+ btn: ['确定'],
|
|
|
+ btn1: function(index) {
|
|
|
+ // layer.close(index);//关闭弹框
|
|
|
+ that.clean();
|
|
|
+ },
|
|
|
+ cancel: function() {
|
|
|
+ that.clean();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- methods: {
|
|
|
- // 创建一个 默认Model
|
|
|
- createModel: function () {
|
|
|
- return {
|
|
|
- id: '', // 主键
|
|
|
- customerId: '', // 客户id
|
|
|
- customerName: '',
|
|
|
- // lockMoney: '', // 冻结金额
|
|
|
- // actMoney: '', // 可用金额
|
|
|
- totalMoney: '', // 总金额
|
|
|
- preTopupMoney: '', //预充值金额
|
|
|
- discountMoney:'', //优惠金额
|
|
|
- totalTopup:'', //总计充值
|
|
|
- payingType:'',
|
|
|
- salt:'',
|
|
|
- // status: '', // 状态(0=禁用,1=启用)
|
|
|
- remark: '', // 备注
|
|
|
- }
|
|
|
- },
|
|
|
- // 提交数据
|
|
|
- ok: function () {
|
|
|
- let that = this;
|
|
|
- let m = {...this.m};
|
|
|
- sa.checkNull(m.preTopupMoney, '预存金额不能为空!');
|
|
|
- if(!this.computeChange()){
|
|
|
- return;
|
|
|
- }
|
|
|
- const key = 'h!f78tr#L3D$2Z0q';
|
|
|
- m.salt = key.split("").reverse().join("");
|
|
|
- m.totalTopup = this.encrypt(m.totalTopup,key);
|
|
|
- m.discountMoney = this.encrypt(m.discountMoney,key);
|
|
|
- m.preTopupMoney = this.encrypt(m.preTopupMoney,key);
|
|
|
- m.id = sa.p('id', 0);
|
|
|
- sa.ajax('/TbAccount/recharge2', sa.removeNull(m), function (res) {
|
|
|
- layer.open({
|
|
|
- content: '充值成功!',//内容区域
|
|
|
- move: false,//是否可以拖动,默认可以拖动
|
|
|
- btn: ['确定'],
|
|
|
- btn1: function(index){
|
|
|
- // layer.close(index);//关闭弹框
|
|
|
- that.clean();
|
|
|
- },
|
|
|
- cancel: function(){
|
|
|
- that.clean();
|
|
|
- }
|
|
|
- });
|
|
|
+ }.bind(this));
|
|
|
|
|
|
- }.bind(this));
|
|
|
-
|
|
|
- },
|
|
|
- // 添加/修改 完成后的动作
|
|
|
- clean: function () {
|
|
|
- parent.app.f5(); // 刷新父页面列表
|
|
|
- sa.closeCurrIframe(); // 关闭本页
|
|
|
- },
|
|
|
- getPayingType(){
|
|
|
- sa.ajax('/TbAccount/getPayingType', function (res) {
|
|
|
- this.payingTypeList = res.data;
|
|
|
- }.bind(this))
|
|
|
- },
|
|
|
- computeChange(value){
|
|
|
- let preMoney = this.m.preTopupMoney;
|
|
|
- let disMoney = this.m.discountMoney;
|
|
|
- if(!disMoney){
|
|
|
- disMoney=0;
|
|
|
- }
|
|
|
- if(isNaN(preMoney)){
|
|
|
- throw {type: 'sa-error', msg: "预充值金额必须是数字!"};
|
|
|
- return false;
|
|
|
- }
|
|
|
- if(isNaN(disMoney)){
|
|
|
- throw {type: 'sa-error', msg: "优惠金额必须是数字!"};
|
|
|
- return false;
|
|
|
- }
|
|
|
- if(preMoney.length>1 && preMoney.substring(0,1)==0){
|
|
|
- throw {type: 'sa-error', msg: "请输入规范的数字,前面不要带零!"};
|
|
|
- return false;
|
|
|
- }
|
|
|
- if(disMoney.length>1 && disMoney.substring(0,1)==0){
|
|
|
- throw {type: 'sa-error', msg: "请输入规范的数字,前面不要带零!"};
|
|
|
- return false;
|
|
|
- }
|
|
|
- if(!preMoney){
|
|
|
- return false;
|
|
|
- }
|
|
|
- preMoney = Number(preMoney);
|
|
|
- disMoney = Number(disMoney);
|
|
|
- if(preMoney<=0){
|
|
|
- throw {type: 'sa-error', msg: "预存金额需大于零元!"};
|
|
|
- return false;
|
|
|
- }
|
|
|
- if(disMoney<0){
|
|
|
- throw {type: 'sa-error', msg: "优惠金额不得低于零元!"};
|
|
|
- return false;
|
|
|
- }
|
|
|
- let totalM = preMoney-disMoney;
|
|
|
- if(totalM<=0){
|
|
|
- throw {type: 'sa-error', msg: "总计金额是:"+totalM+",需大于零元!"};
|
|
|
- return false;
|
|
|
- }
|
|
|
- delete this.m.totalTopup;
|
|
|
- this.$set(this.m,"totalTopup",totalM)
|
|
|
- return true;
|
|
|
- },
|
|
|
- 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();
|
|
|
- },
|
|
|
- },
|
|
|
- mounted: function () {
|
|
|
- // 初始化数据
|
|
|
- this.m = this.createModel();
|
|
|
- this.m.customerId = this.customerId;
|
|
|
- this.getPayingType();
|
|
|
- sa.ajax('/TbAccount/getList', sa.removeNull(this.m), function (res) {
|
|
|
- if(res.data && res.data.length==1){
|
|
|
- this.m = res.data[0];
|
|
|
- if(this.m.totalMoney){
|
|
|
- this.m.totalMoney = this.decrypt(this.m.totalMoney,this.m.salt);
|
|
|
- }else {
|
|
|
- this.m.totalMoney = 0;
|
|
|
- }
|
|
|
- this.$set(this.m,"discountMoney",0);
|
|
|
- this.$set(this.m,"payingType",1);
|
|
|
- }else {
|
|
|
- sa.alert('未能查找到客户详细数据,窗口将在5秒后关闭!');
|
|
|
- setTimeout(function(){ sa.closeCurrIframe() }, 5000)
|
|
|
- }
|
|
|
- }.bind(this))
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
-</script>
|
|
|
-</body>
|
|
|
-</html>
|
|
|
+ },
|
|
|
+ // 添加/修改 完成后的动作
|
|
|
+ clean: function() {
|
|
|
+ parent.app.f5(); // 刷新父页面列表
|
|
|
+ sa.closeCurrIframe(); // 关闭本页
|
|
|
+ },
|
|
|
+ getPayingType() {
|
|
|
+ sa.ajax('/TbAccount/getPayingType', function(res) {
|
|
|
+ this.payingTypeList = res.data;
|
|
|
+ }.bind(this))
|
|
|
+ },
|
|
|
+ computeChange(value) {
|
|
|
+ let preMoney = this.m.preTopupMoney;
|
|
|
+ let disMoney = this.m.discountMoney;
|
|
|
+ if (!disMoney) {
|
|
|
+ disMoney = 0;
|
|
|
+ }
|
|
|
+ if (isNaN(preMoney)) {
|
|
|
+ throw {
|
|
|
+ type: 'sa-error',
|
|
|
+ msg: "预充值金额必须是数字!"
|
|
|
+ };
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (isNaN(disMoney)) {
|
|
|
+ throw {
|
|
|
+ type: 'sa-error',
|
|
|
+ msg: "优惠金额必须是数字!"
|
|
|
+ };
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (preMoney.length > 1 && preMoney.substring(0, 1) == 0) {
|
|
|
+ throw {
|
|
|
+ type: 'sa-error',
|
|
|
+ msg: "请输入规范的数字,前面不要带零!"
|
|
|
+ };
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (disMoney.length > 1 && disMoney.substring(0, 1) == 0) {
|
|
|
+ throw {
|
|
|
+ type: 'sa-error',
|
|
|
+ msg: "请输入规范的数字,前面不要带零!"
|
|
|
+ };
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!preMoney) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ preMoney = Number(preMoney);
|
|
|
+ disMoney = Number(disMoney);
|
|
|
+ if (preMoney <= 0) {
|
|
|
+ throw {
|
|
|
+ type: 'sa-error',
|
|
|
+ msg: "预存金额需大于零元!"
|
|
|
+ };
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (disMoney < 0) {
|
|
|
+ throw {
|
|
|
+ type: 'sa-error',
|
|
|
+ msg: "优惠金额不得低于零元!"
|
|
|
+ };
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ let totalM = preMoney - disMoney;
|
|
|
+ delete this.m.totalTopup;
|
|
|
+ this.$set(this.m, "totalTopup", totalM)
|
|
|
+ return true;
|
|
|
+ },
|
|
|
+ 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();
|
|
|
+ },
|
|
|
+ },
|
|
|
+ mounted: function() {
|
|
|
+ // 初始化数据
|
|
|
+ this.m = this.createModel();
|
|
|
+ this.m.customerId = this.customerId;
|
|
|
+ this.getPayingType();
|
|
|
+ sa.ajax('/TbAccount/getList', sa.removeNull(this.m), function(res) {
|
|
|
+ if (res.data && res.data.length == 1) {
|
|
|
+ this.m = res.data[0];
|
|
|
+ if (this.m.totalMoney) {
|
|
|
+ this.m.totalMoney = this.decrypt(this.m.totalMoney, this.m.salt);
|
|
|
+ } else {
|
|
|
+ this.m.totalMoney = 0;
|
|
|
+ }
|
|
|
+ this.$set(this.m, "discountMoney", 0);
|
|
|
+ this.$set(this.m, "payingType", 1);
|
|
|
+ } else {
|
|
|
+ sa.alert('未能查找到客户详细数据,窗口将在5秒后关闭!');
|
|
|
+ setTimeout(function() {
|
|
|
+ sa.closeCurrIframe()
|
|
|
+ }, 5000)
|
|
|
+ }
|
|
|
+ }.bind(this))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ </script>
|
|
|
+ </body>
|
|
|
+</html>
|