tb-order-after-sale-add.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <!-- 所有的 css js 资源 -->
  8. <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
  9. <link rel="stylesheet" href="../../static/sa.css">
  10. <script src="../../static/kj/vue.min.js"></script>
  11. <script src="../../static/kj/element-ui/index.js"></script>
  12. <script src="../../static/kj/httpVueLoader.js"></script>
  13. <script src="../../static/kj/jquery.min.js"></script>
  14. <script src="../../static/kj/layer/layer.js"></script>
  15. <script src="../../static/sa.js"></script>
  16. <style type="text/css">
  17. .c-panel .el-form .c-label{width: 7em !important;}
  18. .c-panel .el-form .el-input, .c-panel .el-form .el-textarea__inner{width: 250px;}
  19. </style>
  20. </head>
  21. <body>
  22. <div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
  23. <!-- ------- 内容部分 ------- -->
  24. <div class="s-body">
  25. <div class="c-panel">
  26. <div class="c-title" v-if="id == 0">数据添加</div>
  27. <div class="c-title" v-else>数据修改</div>
  28. <el-form v-if="m">
  29. <el-row :gutter="50">
  30. <el-col :span="12">
  31. <sa-item type="text" name="售后发起人电话" v-model="m.userPhone" br></sa-item>
  32. </el-col>
  33. <el-col :span="12">
  34. <sa-item type="text" name="发起售后时间" v-model="m.time" br></sa-item>
  35. </el-col>
  36. </el-row>
  37. <el-row :gutter="50">
  38. <el-col :span="12">
  39. <sa-item type="text" name="申请类型" v-model="m.applyType" br></sa-item>
  40. </el-col>
  41. <el-col :span="12">
  42. <sa-item type="text" name="发起售后原因" v-model="m.remark" br></sa-item>
  43. </el-col>
  44. </el-row>
  45. <el-row :gutter="50">
  46. <el-col :span="12">
  47. <sa-item type="text" name="售后状态" v-model="m.afterSaleStatus" br></sa-item>
  48. </el-col>
  49. <el-col :span="12">
  50. <sa-item type="text" name="货物图片" v-model="m.goodsImg" br></sa-item>
  51. </el-col>
  52. </el-row>
  53. <el-row :gutter="50">
  54. <el-col :span="12">
  55. <sa-item type="text" name="货物名称" v-model="m.goodsName" br></sa-item>
  56. </el-col>
  57. <el-col :span="12">
  58. <sa-item type="text" name="货物数量" v-model="m.goodsNum" br></sa-item>
  59. </el-col>
  60. </el-row>
  61. <sa-item name="" class="s-ok" br>
  62. <el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
  63. </sa-item>
  64. </el-form>
  65. </div>
  66. </div>
  67. <!-- ------- 底部按钮 ------- -->
  68. <div class="s-foot">
  69. <el-button type="primary" @click="ok()">确定</el-button>
  70. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  71. </div>
  72. </div>
  73. <script>
  74. var app = new Vue({
  75. components: {
  76. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  77. },
  78. el: '.vue-box',
  79. data: {
  80. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  81. m: null, // 实体对象
  82. },
  83. methods: {
  84. // 创建一个 默认Model
  85. createModel: function() {
  86. return {
  87. id: '', // 售后申请表主键id
  88. orderId: '', // 订单表主键
  89. userId: '', // 发起售后人的ID
  90. userPhone: '', // 售后发起人电话
  91. time: '', // 发起售后时间
  92. applyType: '', // 申请类型
  93. remark: '', // 发起售后原因
  94. afterSaleStatus: '', // 售后状态
  95. goodsImg: '', // 货物图片
  96. goodsName: '', // 货物名称
  97. goodsNum: '', // 货物数量
  98. }
  99. },
  100. // 提交数据
  101. ok: function(){
  102. // 表单校验
  103. let m = this.m;
  104. sa.checkNull(m.id, '请输入 [售后申请表主键id]');
  105. sa.checkNull(m.orderId, '请输入 [订单表主键]');
  106. sa.checkNull(m.userId, '请输入 [发起售后人的ID]');
  107. sa.checkNull(m.userPhone, '请输入 [售后发起人电话]');
  108. sa.checkNull(m.time, '请输入 [发起售后时间]');
  109. sa.checkNull(m.applyType, '请输入 [申请类型]');
  110. sa.checkNull(m.remark, '请输入 [发起售后原因]');
  111. sa.checkNull(m.afterSaleStatus, '请输入 [售后状态]');
  112. sa.checkNull(m.goodsImg, '请输入 [货物图片]');
  113. sa.checkNull(m.goodsName, '请输入 [货物名称]');
  114. sa.checkNull(m.goodsNum, '请输入 [货物数量]');
  115. // 开始增加或修改
  116. if(this.id <= 0) { // 添加
  117. sa.ajax('/TbOrderAfterSale/add', m, function(res){
  118. sa.alert('增加成功', this.clean);
  119. }.bind(this));
  120. } else { // 修改
  121. sa.ajax('/TbOrderAfterSale/update', m, function(res){
  122. sa.alert('修改成功', this.clean);
  123. }.bind(this));
  124. }
  125. },
  126. // 添加/修改 完成后的动作
  127. clean: function() {
  128. if(this.id == 0) {
  129. this.m = this.createModel();
  130. } else {
  131. parent.app.f5(); // 刷新父页面列表
  132. sa.closeCurrIframe(); // 关闭本页
  133. }
  134. }
  135. },
  136. mounted: function(){
  137. // 初始化数据
  138. if(this.id <= 0) {
  139. this.m = this.createModel();
  140. } else {
  141. sa.ajax('/TbOrderAfterSale/getById?id=' + this.id, function(res) {
  142. this.m = res.data;
  143. if(res.data == null) {
  144. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  145. }
  146. }.bind(this))
  147. }
  148. }
  149. })
  150. </script>
  151. </body>
  152. </html>