123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <!DOCTYPE html>
- <html>
- <head>
- <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="../../static/kj/element-ui/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>
- <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;
- }
- .item-num .el-input__inner {
- width: 130px;
- display: inline;
- }
- </style>
- </head>
- <body>
- <div class="vue-box sbot" style="display: none;" :style="'display: block;'">
- <!-- ------- 内容部分 ------- -->
- <div class="s-body">
- <div class="c-panel">
- <el-form>
- <div style="margin-top: 20px;">
- <div>
- <div class="c-item">
- <label class="c-label"><span style="color: red;">*</span>业务类型:</label>
- <el-select v-model="m.itemTypeId" placeholder="请选择" filterable @change="itemTypeChange">
- <el-option :label="type.name" :value="type.id"
- v-for="(type,index) in businessTypeList">
- </el-option>
- </el-select>
- <div>
- <label class="c-label"><span style="color: red;">*</span>车型:</label>
- <el-select v-model="m.itemId" placeholder="请选择">
- <el-option :label="detail.itemName+'('+detail.price+'/'+detail.unit+')'" :value="detail.id"
- v-for="(detail,i) in items">
- </el-option>
- </el-select>
- </div>
- <label class="c-label" style="width: 160px;">数量:</label>
- <el-input-number v-model="m.num" class="item-num " v-model="item.num" :step="1"
- :min="1" :max="999">
- </el-input-number>
- </div>
- <div class="c-item" v-if="totalMoney>0">
- <label class="c-label"><span style="color: red;font-weight: 500;">总金额:¥{{totalMoney}}</span></label>
- </div>
- </div>
- </div>
- </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: {
- m: {
- itemTypeId: '', // 名称
- itemId: '',
- businessId:sa.p('id', 0),
- num: 1,
- }, // 实体对象
- list: [],
- businessTypeList :[],
- items: [],
- },
- computed:{
- totalMoney(){
- let itemId=this.m.itemId;
- if(itemId){
- let items=this.items;
- let item= items.filter(item=>item.id==itemId)[0];
- return item.price*this.m.num;
- }
- return 0;
- }
- },
- methods: {
- getBusinessType() {
- sa.ajax('/TbItemType/getList', {
- sortType: 0,
- pageSize: 50
- }, function(resp) {
- let list = resp.data;
- this.businessTypeList = list;
- }.bind(this))
- },
- itemTypeChange(itemTypeId) {
- sa.ajax('/TbItem/getByItemTypeId', {
- itemTypeId: itemTypeId
- }, function(resp) {
- let list = resp.data;
- if (list.length > 0) {
- this.m.itemId = list[0].id;
- }
- this.items = list;
- }.bind(this))
- },
- // 提交数据
- ok: function() {
- // 表单校验
- let m = this.m;
- if(!m.itemTypeId){
- sa.error('请选择业务类型')
- return;
- }
- if(!m.itemId){
- sa.error('请选择车型')
- return;
- }
- sa.confirm('是否确认添加该缴费补录?', function () {
- sa.ajax('/TbBusinessItem/add', m, function(res) {
- sa.alert('补录成功', this.clean);
- }.bind(this));
- }.bind(this));
-
- },
- // 添加/修改 完成后的动作
- clean: function() {
- parent.app.getInfo(); // 刷新父页面列表
- sa.closeCurrIframe();
- }
- },
- mounted: function() {
- this.getBusinessType();
- }
- })
- </script>
- </body>
- </html>
|