add.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <template>
  2. <div>
  3. <el-button class="inline-24" type="primary" size="small" @click="onShow">新建付费订单</el-button>
  4. <el-dialog
  5. title="新建付费订单"
  6. :visible.sync="dialogVisible"
  7. width="980px"
  8. >
  9. <el-row :gutter="20" style="margin-top: -20px">
  10. <el-col :span="24" v-if="payInstructions">
  11. <div class="pay_border">
  12. <span class="pay_font">付费说明:{{payInstructions}}</span>
  13. </div>
  14. </el-col>
  15. <el-col :span="24" class="div_top">
  16. <span style="color: red">*</span>
  17. <span>选择版本:</span>
  18. </el-col>
  19. <el-col :span="10" class="div_top">
  20. <el-table
  21. :data="versionList"
  22. height="300px"
  23. :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}"
  24. :header-cell-style="{height:'40px',color:'#333',fontWeight:'400',fontSize:'14px',background:'#EEEEEE'}"
  25. @row-click="rowClick"
  26. style="width: 100%">
  27. <el-table-column
  28. prop="partitionname"
  29. label="版本名称"
  30. >
  31. </el-table-column>
  32. <el-table-column
  33. label="操作"
  34. width="120">
  35. <template slot-scope="scope">
  36. <input type="radio" :checked="scope.row.checkRow" @click="onCheck(scope.row)"></input>
  37. </template>
  38. </el-table-column>
  39. </el-table>
  40. </el-col>
  41. <el-col :span="14" class="div_top">
  42. <el-table
  43. :data="modulesList"
  44. height="300px"
  45. :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}"
  46. :header-cell-style="{height:'40px',color:'#333',fontWeight:'400',fontSize:'14px',background:'#EEEEEE'}"
  47. style="width: 100%">
  48. <el-table-column
  49. prop="systemclient"
  50. label="端口"
  51. >
  52. </el-table-column>
  53. <el-table-column
  54. prop="systemname"
  55. label="系统名称"
  56. >
  57. </el-table-column>
  58. <el-table-column
  59. prop="systemmodulename"
  60. label="模块名称"
  61. >
  62. </el-table-column>
  63. <el-table-column
  64. prop="systemappname"
  65. label="应用名称"
  66. >
  67. </el-table-column>
  68. </el-table>
  69. </el-col>
  70. <el-col :span="24" class="div_top">
  71. <span style="color: red">*</span>
  72. <span>选择付费账号:</span>
  73. </el-col>
  74. <el-col :span="24" class="div_top" v-if="sys_payincidence == '1'">
  75. <tableLayout :layout="tablecolsAccount" :data="list" :opwidth="200" :custom="true" height="370px" fixedName="operation">
  76. <template v-slot:customcol="scope">
  77. <span v-if="scope.column.columnname === 'operation'" ></span>
  78. <span v-else-if="scope.column.columnname === 'enddate'">
  79. <span v-for="(item,index) in scope.column.data.enddate" :key="index">
  80. <span v-if="form.sys_site_systempartitionid == index">{{item}}</span>
  81. </span>
  82. </span>
  83. <p v-else>{{scope.column.data[scope.column.columnname] || ''}}</p>
  84. </template>
  85. <template v-slot:opreation="scope">
  86. <el-checkbox :checked="scope.data.checkRow" @change="userCheck(scope.data)"></el-checkbox>
  87. </template>
  88. </tableLayout>
  89. </el-col>
  90. <el-col :span="24" class="div_top" v-else>
  91. <tableLayout :layout="tablecolsMain" :data="list" :opwidth="200" :custom="true" height="370px" fixedName="operation">
  92. <template v-slot:customcol="scope">
  93. <span v-if="scope.column.columnname === 'operation'" ></span>
  94. <span v-else-if="scope.column.columnname === 'enddate'">
  95. <span v-for="(item,index) in scope.column.data.enddate" :key="index">
  96. <span v-if="form.sys_site_systempartitionid == index">{{item}}</span>
  97. </span>
  98. </span>
  99. <p v-else>{{scope.column.data[scope.column.columnname] || ''}}</p>
  100. </template>
  101. <template v-slot:opreation="scope">
  102. <el-checkbox :checked="scope.data.checkRow" @change="userCheck(scope.data)"></el-checkbox>
  103. </template>
  104. </tableLayout>
  105. </el-col>
  106. <el-col :span="24" class="div_top">
  107. <el-form :model="form" ref="form" label-width="50px" label-position="right" size="mini">
  108. <el-form-item label="备注:" >
  109. <el-input v-model="form.remarks" placeholder="请输入备注内容"></el-input>
  110. </el-form-item>
  111. </el-form>
  112. </el-col>
  113. </el-row>
  114. <span slot="footer" class="dialog-footer">
  115. <span >共</span>
  116. <span style="color: red">{{accountNum}}</span>
  117. <span style="margin-right: 10px">个账号</span>
  118. <span >总价:</span>
  119. <span style="color: red;margin-right: 10px">¥{{amount}}</span>
  120. <el-button type="danger" @click="onSubmit">生成订单</el-button>
  121. </span>
  122. </el-dialog>
  123. </div>
  124. </template>
  125. <script>
  126. import tableLayout from '@/components/table/index2.vue'
  127. export default {
  128. name: "add",
  129. data() {
  130. return {
  131. dialogVisible:false,
  132. versionList:[],
  133. modulesList:[],
  134. form:{
  135. "sys_site_systempartitionid": '',
  136. "orderno":'',
  137. "sys_payorderid": '',
  138. "remarks": "",
  139. "userids": []
  140. },
  141. tablecolsAccount:[],
  142. tablecolsMain:[],
  143. list:[],
  144. param:{
  145. "classname": "system.payorder.payorder",
  146. "method": "chooseUsers",
  147. "content": {
  148. "pageNumber": 1,
  149. "pageSize": 999,
  150. "where": {
  151. "condition": ""
  152. }
  153. },
  154. },
  155. payInstructions:'',
  156. sys_payincidence:'',
  157. userids:[],
  158. accountNum:0,
  159. amount:0,
  160. createNow:false
  161. }
  162. },
  163. components:{tableLayout},
  164. methods:{
  165. onShow(){
  166. this.dialogVisible = true
  167. this.queryVersion()
  168. this.queryAccount()
  169. this.queryInstructions()
  170. this.creatOrder()
  171. },
  172. /*新建订单*/
  173. async creatOrder(){
  174. const res = await this.$api.requested({
  175. "classname": "system.payorder.payorder",
  176. "method": "createOrder",
  177. "content": {},
  178. })
  179. this.form.sys_payorderid = res.data.sys_payorderid
  180. this.form.orderno = res.data.orderno
  181. },
  182. /*查询付费说明*/
  183. async queryInstructions(){
  184. const res = await this.$api.requested({
  185. "classname": "webmanage.site.site",
  186. "method": "querySite_Parameter",
  187. "content": {},
  188. })
  189. this.payInstructions = res.data.sys_payinstructions
  190. this.sys_payincidence = res.data.sys_payincidence
  191. },
  192. /*查询可选版本信息*/
  193. async queryVersion(){
  194. const res = await this.$api.requested({
  195. "classname": "system.payorder.payorder",
  196. "method": "chooseSystemPartition",
  197. "content": {
  198. "pageNumber": 1,
  199. "pageSize": 999,
  200. "where": {
  201. "condition": ""
  202. }
  203. },
  204. })
  205. this.versionList = res.data.map(item=>{
  206. return {
  207. partitionname:item.partitionname,
  208. rowindex:item.rowindex,
  209. sys_site_systempartitionid:item.sys_site_systempartitionid,
  210. systemapp:item.systemapp,
  211. systemappids:item.systemappids,
  212. checkRow:false
  213. }
  214. })
  215. this.versionList[0].checkRow = true
  216. this.modulesList = this.versionList[0].systemapp
  217. this.form.sys_site_systempartitionid = this.versionList[0].sys_site_systempartitionid
  218. },
  219. /*获取可选账号*/
  220. async queryAccount(){
  221. this.list = []
  222. const res = await this.$api.requested(this.param)
  223. this.list = res.data.map(item=>{
  224. return {
  225. accountno:item.accountno,
  226. agentname:item.agentname,
  227. enddate:item.enddate,
  228. isleader:item.isleader,
  229. phonenumber:item.phonenumber,
  230. rowindex:item.rowindex,
  231. sa_agentsid:item.sa_agentsid,
  232. userid:item.userid,
  233. checkRow:false
  234. }
  235. })
  236. },
  237. /*选择版本*/
  238. onCheck(val){
  239. this.versionList.forEach(item=>{
  240. if (item.sys_site_systempartitionid === val.sys_site_systempartitionid){
  241. item.checkRow = true
  242. this.form.sys_site_systempartitionid = item.sys_site_systempartitionid
  243. }else {
  244. item.checkRow = false
  245. }
  246. this.modulesList = val.systemapp
  247. })
  248. this.userids = []
  249. /* this.list.forEach(item=>{
  250. if (item.checkRow){
  251. item.checkRow = false
  252. }
  253. })
  254. console.log(this.list)*/
  255. this.queryAccount()
  256. },
  257. /*选择付费账号*/
  258. userCheck(val){
  259. this.userids = []
  260. val.checkRow ? this.list[val.index].checkRow = false : this.list[val.index].checkRow = true
  261. this.list.forEach(item=>{
  262. if (item.checkRow){
  263. this.userids.push({
  264. "isleader": item.isleader,
  265. "userid": item.userid,
  266. "sa_agentsid": item.sa_agentsid,
  267. "enddate": item.enddate
  268. })
  269. }
  270. })
  271. this.accountNum = this.userids.length
  272. this.queryPrice()
  273. },
  274. rowClick(val){
  275. this.onCheck(val)
  276. },
  277. onSubmit(){
  278. this.createNow = true
  279. this.queryPrice()
  280. },
  281. /*获取订单价格*/
  282. async queryPrice(){
  283. const res = await this.$api.requested({
  284. "classname": "system.payorder.payorder",
  285. "method": "insertUsers",
  286. "content": {
  287. "sys_site_systempartitionid": this.form.sys_site_systempartitionid,
  288. "sys_payorderid": this.form.sys_payorderid,
  289. "remarks": this.form.remarks,
  290. "users": this.userids
  291. },
  292. })
  293. this.amount = res.data.amount
  294. if (this.createNow){
  295. this.dialogVisible = false
  296. this.$emit('onSuccess',this.form.sys_payorderid,this.form.orderno)
  297. }
  298. }
  299. },
  300. created() {
  301. this.tablecolsAccount = this.tool.tabelCol(this.$route.name).accountTable.tablecols
  302. this.tablecolsMain = this.tool.tabelCol(this.$route.name).mainBodyTable.tablecols
  303. }
  304. }
  305. </script>
  306. <style scoped>
  307. /deep/ .el-dialog__title {
  308. line-height: 24px;
  309. font-size: 16px;
  310. color: #303133;
  311. font-weight: bold;
  312. }
  313. .pay_border{
  314. background: #FFF9F2;
  315. height: 30px;
  316. vertical-align: center;
  317. line-height: 30px
  318. }
  319. .pay_font{
  320. color: #FA8C16;margin-left: 10px
  321. }
  322. .div_top{
  323. margin-top: 20px;
  324. }
  325. </style>