index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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="payInfo" 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" @click="handleClose">关闭</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. import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
  38. export default {
  39. props: {
  40. id: {
  41. type: [String, Number],
  42. default: null,
  43. },
  44. handleClose: Function
  45. },
  46. components: { ImageUpload },
  47. mixins: [
  48. basicInfo,
  49. productColumns,
  50. serviceInfo,
  51. editTable
  52. ],
  53. data() {
  54. return {
  55. formData: {
  56. "address": "",
  57. "area": "",
  58. "areaId": "",
  59. "city": "",
  60. "cityId": "",
  61. "companyWechatId": "",
  62. "companyWechatName": "",
  63. "confirmBy": "",
  64. "confirmTime": "",
  65. "customerMobile": "",
  66. "customerMobile2": "",
  67. "customerName": "",
  68. "goodsType": "",
  69. "items": [],
  70. "lastUpdateBy": "",
  71. "lastUpdateTime": "",
  72. "linkName": "",
  73. "orderSmallType": "",
  74. "orderSmallTypeText": "",
  75. "projectName": "",
  76. "projectNo": "",
  77. "province": "",
  78. "provinceId": "",
  79. "records": [],
  80. "remark": "",
  81. "salesNo": "",
  82. "salesWebsit": "",
  83. "status": "",
  84. "street": "",
  85. "streetId": "",
  86. "totalPayAmount": 0,
  87. "totalSalesAmount": 0,
  88. "websitId": "",
  89. "websitName": "",
  90. // 收款信息
  91. "amount": "",
  92. "fileUrl": [],
  93. "payRemark": ""
  94. },
  95. }
  96. },
  97. watch: {
  98. id: {
  99. handler(newVal, oldVal) {
  100. this.getorderDetail((data) => {
  101. this.getinitlbslist()
  102. this.gettGoodsAloneList()
  103. })
  104. },
  105. deep: true,
  106. immediate: true,
  107. },
  108. },
  109. computed: {
  110. // 用户信息
  111. userInfo() {
  112. return JSON.parse(localStorage.getItem('greemall_user'))
  113. },
  114. // 表单校验规则
  115. formRules() {
  116. return {}
  117. },
  118. payInfo() {
  119. return [
  120. ...(() => {
  121. if (!!this.id && (this.formData.status == 'WAIT_PAY' || this.formData.status == 'PART_PAY')) {
  122. return [{
  123. name: 'el-input',
  124. md: 6,
  125. attributes: { placeholder: '请输入' },
  126. formItemAttributes: {
  127. label: '收款金额',
  128. prop: 'amount',
  129. rules: [...required]
  130. }
  131. },
  132. {
  133. md: 24,
  134. isShow: true,
  135. name: 'slot-component',
  136. formItemAttributes: {
  137. label: '收款凭证',
  138. prop: 'fileUrl',
  139. rules: []
  140. },
  141. render: (h, { props, onInput }) => {
  142. var { value } = props
  143. return (
  144. <ImageUpload fileList={this.formData.fileUrl} limit={1} />
  145. )
  146. }
  147. },
  148. {
  149. name: 'el-input',
  150. md: 24,
  151. attributes: {
  152. type: 'textarea',
  153. rows: 3,
  154. placeholder: '请输入'
  155. },
  156. formItemAttributes: {
  157. label: '备注',
  158. prop: 'payRemark',
  159. rules: []
  160. }
  161. }]
  162. }
  163. return []
  164. })(),
  165. {
  166. md: 24,
  167. isShow: true,
  168. name: 'slot-component',
  169. formItemAttributes: {
  170. label: '收款记录',
  171. prop: 'records',
  172. rules: []
  173. },
  174. render: (h, { props, onInput }) => {
  175. var { value } = props
  176. return (
  177. <zj-table
  178. columns={[{
  179. columnAttributes: {
  180. label: '收款结果',
  181. prop: 'status'
  182. },
  183. render: (h, { row, column, index }) => {
  184. return <div div style="padding-left:10px">
  185. {({ WAIT: "待审核", WAIT_PAY: "待收款", PART_PAY: "部分收款", PAY: "收款完成", })[row.status]}
  186. </div>
  187. },
  188. }, {
  189. columnAttributes: {
  190. label: '收款金额',
  191. prop: 'payAmount'
  192. }
  193. }, {
  194. columnAttributes: {
  195. label: '收款凭证',
  196. prop: 'fileUrl'
  197. },
  198. render: (h, { row, column, index }) => {
  199. return <div div style="padding-left:10px">
  200. {row.fileUrl ? <ImageUpload fileList={[{ url: row.fileUrl }]} limit={1} isEdit={false} /> : null}
  201. </div>
  202. },
  203. }, {
  204. columnAttributes: {
  205. label: '备注',
  206. prop: 'payRemark'
  207. }
  208. }, {
  209. columnAttributes: {
  210. label: '收款人',
  211. prop: 'lastUpdateBy'
  212. }
  213. }, {
  214. columnAttributes: {
  215. label: '收款时间',
  216. prop: 'lastUpdateTime'
  217. }
  218. },]}
  219. table-data={value}
  220. />
  221. )
  222. }
  223. },
  224. ]
  225. }
  226. },
  227. methods: {
  228. // 获取工单详情
  229. getorderDetail(cb) {
  230. if (this.id) {
  231. // 编辑详情
  232. enginPayDetail({
  233. id: this.id
  234. }).then((res) => {
  235. Object.assign(this.formData, res.data)
  236. cb && cb()
  237. })
  238. }
  239. },
  240. appointVerify(arr, cb) {
  241. this.$refs.formRef.validateField(arr, (valid, invalidFields, errLabels) => {
  242. cb && cb(valid, invalidFields, errLabels)
  243. })
  244. },
  245. submit() {
  246. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  247. if (valid) {
  248. enginPaySave(this.formData).then(res => {
  249. this.$message({
  250. type: 'success',
  251. message: '提交成功'
  252. })
  253. this.handleClose && this.handleClose()
  254. })
  255. }
  256. })
  257. },
  258. examine() {
  259. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  260. if (valid) {
  261. enginPayConfirm({ id: this.formData.id }).then(res => {
  262. this.$message({
  263. type: 'success',
  264. message: '审核成功'
  265. })
  266. this.handleClose && this.handleClose()
  267. })
  268. }
  269. })
  270. },
  271. confirm() {
  272. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  273. if (valid) {
  274. enginPayPay({
  275. id: this.formData.id,
  276. "amount": this.formData.amount,
  277. "fileUrl": this.formData.fileUrl.map(item => item.url).join(","),
  278. "payRemark": this.formData.payRemark,
  279. }).then(res => {
  280. this.$message({
  281. type: 'success',
  282. message: '收款成功'
  283. })
  284. this.handleClose && this.handleClose()
  285. })
  286. }
  287. })
  288. },
  289. }
  290. }
  291. </script>
  292. <style lang="scss" scoped>
  293. .neibuview {
  294. box-sizing: border-box;
  295. padding-left: 16px;
  296. ::v-deep &>.zj-page-fill-scroll {
  297. box-sizing: border-box;
  298. padding-right: 16px;
  299. &>div:nth-child(1) {
  300. margin-top: 20px;
  301. }
  302. }
  303. }
  304. .pgxxTable {
  305. position: absolute;
  306. top: 0;
  307. bottom: 0;
  308. left: 0;
  309. right: 0;
  310. }
  311. .withinLine {
  312. display: inline-block;
  313. ::v-deep .el-button {
  314. margin-left: 0;
  315. margin-right: 10px;
  316. margin-bottom: 10px;
  317. }
  318. }
  319. .redbordererr {
  320. ::v-deep .el-form-item {
  321. margin: 0 !important;
  322. overflow: hidden;
  323. }
  324. }
  325. </style>