index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <zj-page-container v-if="formData">
  3. <zj-page-fill class="neibuview">
  4. <zj-form-container ref="formRef" :form-data="formData" :form-rules="formRules"
  5. :form-attributes="{ size: 'mini' }">
  6. <!-- 工程信息 -->
  7. <zj-form-module title="工程信息" :form-data="formData" :form-items="serviceInfo" label-width="120px" />
  8. <!-- 基本信息 -->
  9. <zj-form-module title="基本信息" :form-data="formData" :form-items="basicInfo" label-width="120px" />
  10. <!-- 产品信息 -->
  11. <zj-form-module title="产品信息" :form-data="formData" :form-items="product" label-width="120px" />
  12. <!-- 收款信息 -->
  13. <zj-form-module
  14. v-if="!!id && (formData.status == 'WAIT_PAY' || formData.status == 'PART_PAY' || formData.status == 'PAY')"
  15. title="收款信息" :form-data="formData" :form-items="product" label-width="120px" />
  16. </zj-form-container>
  17. </zj-page-fill>
  18. <!-- 操作按钮 -->
  19. <div>
  20. <div style="box-sizing: border-box; padding: 10px">
  21. <el-button size="mini">关闭</el-button>
  22. <el-button v-if="!id" size="mini" type="primary" @click="submit">提交</el-button>
  23. <el-button v-if="!!id && formData.status == 'WAIT'" size="mini" type="primary" @click="examine">审核</el-button>
  24. <el-button v-if="!!id && (formData.status == 'WAIT_PAY' || formData.status == 'PART_PAY')" size="mini"
  25. type="primary" @click="confirm">确定提交</el-button>
  26. </div>
  27. </div>
  28. </zj-page-container>
  29. </template>
  30. <script>
  31. import basicInfo from './mixins/basicInfo.js'
  32. import productColumns from './mixins/productColumns.js'
  33. import serviceInfo from './mixins/serviceInfo.js'
  34. import editTable from "@/components/template/editTable.js"
  35. import { enginPayDetail, enginPaySave, enginPayConfirm, enginPayPay } from "@/api/projectCollectionManagement.js"
  36. import ImageUpload from '@/components/file-upload'
  37. export default {
  38. props: {
  39. id: {
  40. type: [String, Number],
  41. default: null,
  42. },
  43. handleClose: Function
  44. },
  45. components: { ImageUpload },
  46. mixins: [
  47. basicInfo,
  48. productColumns,
  49. serviceInfo,
  50. editTable
  51. ],
  52. data() {
  53. return {
  54. formData: {
  55. "address": "",
  56. "area": "",
  57. "areaId": "",
  58. "city": "",
  59. "cityId": "",
  60. "companyWechatId": "",
  61. "companyWechatName": "",
  62. "confirmBy": "",
  63. "confirmTime": "",
  64. "customerMobile": "",
  65. "customerMobile2": "",
  66. "customerName": "",
  67. "goodsType": "",
  68. "items": [],
  69. "lastUpdateBy": "",
  70. "lastUpdateTime": "",
  71. "linkName": "",
  72. "orderSmallType": "",
  73. "orderSmallTypeText": "",
  74. "projectName": "",
  75. "projectNo": "",
  76. "province": "",
  77. "provinceId": "",
  78. "records": [],
  79. "remark": "",
  80. "salesNo": "",
  81. "salesWebsit": "",
  82. "status": "",
  83. "street": "",
  84. "streetId": "",
  85. "totalPayAmount": 0,
  86. "totalSalesAmount": 0,
  87. "websitId": "",
  88. "websitName": "",
  89. // 收款信息
  90. "amount": "",
  91. "fileUrl": [],
  92. "payRemark": ""
  93. },
  94. }
  95. },
  96. watch: {
  97. id: {
  98. handler(newVal, oldVal) {
  99. this.getorderDetail((data) => {
  100. this.getinitlbslist()
  101. this.gettGoodsAloneList()
  102. })
  103. },
  104. deep: true,
  105. immediate: true,
  106. },
  107. },
  108. computed: {
  109. // 用户信息
  110. userInfo() {
  111. return JSON.parse(localStorage.getItem('greemall_user'))
  112. },
  113. // 表单校验规则
  114. formRules() {
  115. return {}
  116. },
  117. payInfo() {
  118. return [
  119. ...(() => {
  120. if (!!this.id && (this.formData.status == 'WAIT_PAY' || this.formData.status == 'PART_PAY')) {
  121. return [{
  122. name: 'el-input',
  123. md: 6,
  124. attributes: { placeholder: '请输入' },
  125. formItemAttributes: {
  126. label: '收款金额',
  127. prop: 'amount',
  128. rules: [...required]
  129. }
  130. },
  131. {
  132. md: 24,
  133. isShow: true,
  134. name: 'slot-component',
  135. formItemAttributes: {
  136. label: '收款凭证',
  137. prop: 'fileUrl',
  138. rules: []
  139. },
  140. render: (h, { props, onInput }) => {
  141. var { value } = props
  142. return (
  143. <ImageUpload fileList={this.formData.fileUrl} limit={1} />
  144. )
  145. }
  146. },
  147. {
  148. name: 'el-input',
  149. md: 24,
  150. attributes: {
  151. type: 'textarea',
  152. rows: 3,
  153. placeholder: '请输入'
  154. },
  155. formItemAttributes: {
  156. label: '备注',
  157. prop: 'payRemark',
  158. rules: []
  159. }
  160. }]
  161. }
  162. return []
  163. })()
  164. ]
  165. }
  166. },
  167. methods: {
  168. // 获取工单详情
  169. getorderDetail(cb) {
  170. if (this.id) {
  171. // 编辑详情
  172. enginPayDetail({
  173. id: this.id
  174. }).then((res) => {
  175. Object.assign(this.formData, res.data)
  176. cb && cb()
  177. })
  178. }
  179. },
  180. appointVerify(arr, cb) {
  181. this.$refs.formRef.validateField(arr, (valid, invalidFields, errLabels) => {
  182. cb && cb(valid, invalidFields, errLabels)
  183. })
  184. },
  185. submit() {
  186. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  187. if (valid) {
  188. enginPaySave(this.formData).then(res => {
  189. this.$message({
  190. type: 'success',
  191. message: '提交成功'
  192. })
  193. this.handleClose && this.handleClose()
  194. })
  195. }
  196. })
  197. },
  198. examine() {
  199. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  200. if (valid) {
  201. enginPayConfirm({ id: this.formData.id }).then(res => {
  202. this.$message({
  203. type: 'success',
  204. message: '审核成功'
  205. })
  206. this.handleClose && this.handleClose()
  207. })
  208. }
  209. })
  210. },
  211. confirm() {
  212. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  213. if (valid) {
  214. enginPayPay({
  215. "amount": this.formData.amount,
  216. "fileUrl": this.formData.fileUrl.map(item => item.url).join(","),
  217. "payRemark": this.formData.payRemark,
  218. }).then(res => {
  219. this.$message({
  220. type: 'success',
  221. message: '收款成功'
  222. })
  223. this.handleClose && this.handleClose()
  224. })
  225. }
  226. })
  227. },
  228. }
  229. }
  230. </script>
  231. <style lang="scss" scoped>
  232. .neibuview {
  233. box-sizing: border-box;
  234. padding-left: 16px;
  235. ::v-deep &>.zj-page-fill-scroll {
  236. box-sizing: border-box;
  237. padding-right: 16px;
  238. &>div:nth-child(1) {
  239. margin-top: 20px;
  240. }
  241. }
  242. }
  243. .pgxxTable {
  244. position: absolute;
  245. top: 0;
  246. bottom: 0;
  247. left: 0;
  248. right: 0;
  249. }
  250. .withinLine {
  251. display: inline-block;
  252. ::v-deep .el-button {
  253. margin-left: 0;
  254. margin-right: 10px;
  255. margin-bottom: 10px;
  256. }
  257. }
  258. .redbordererr {
  259. ::v-deep .el-form-item {
  260. margin: 0 !important;
  261. overflow: hidden;
  262. }
  263. }
  264. </style>