form_ty.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. import { required } from '@/components/template/rules_verify.js'
  2. import { listPageV2 } from '@/api/auxiliaryFittings/supplier'
  3. import { goodsPurchaseList, goodsPurchaseDetail } from '@/api/goodsPurchasedStored.js'
  4. import ImageUpload from '@/components/file-upload'
  5. export default {
  6. data() {
  7. return {
  8. gysList: [],
  9. cgrkOrder: []
  10. }
  11. },
  12. computed: {
  13. formItems() {
  14. return [
  15. {
  16. md: 24,
  17. isShow: true,
  18. name: 'slot-component',
  19. formItemAttributes: {
  20. label: '',
  21. prop: '',
  22. 'label-width': '0px'
  23. },
  24. render: (h, { props, onInput }) => {
  25. var { value } = props
  26. return (
  27. <div>
  28. <el-descriptions
  29. border
  30. title=""
  31. column={4}
  32. colon={false}
  33. labelStyle={{ width: '8%' }}
  34. contentStyle={{ width: '17%' }}
  35. >
  36. <el-descriptions-item label="单据状态">
  37. {{ SAVE: '保存', WAIT: '待审核', OK: '通过', FAIL: '失败' }[this.formData.status] || ''}
  38. </el-descriptions-item>
  39. <el-descriptions-item label="单据编号">{this.formData.id || ''}</el-descriptions-item>
  40. <el-descriptions-item label="所属商户" contentStyle={{ width: '42%' }}>
  41. {JSON.parse(localStorage.getItem('greemall_user')).companyName}
  42. </el-descriptions-item>
  43. </el-descriptions>
  44. <el-descriptions
  45. border
  46. title=""
  47. column={2}
  48. colon={false}
  49. labelStyle={{ width: '8%' }}
  50. contentStyle={{ width: '42%' }}
  51. style="margin-top:-1px"
  52. >
  53. <el-descriptions-item label="供应商名称">
  54. <div class="redbordererr">
  55. <el-form-item label="" lebel-width="0px" prop={`venderId`} rules={required}>
  56. <el-select
  57. style="width:100%"
  58. value={this.formData.venderId}
  59. onInput={val => {
  60. this.formData.venderId = val
  61. }}
  62. placeholder="请选择"
  63. disabled={!!~['SAVE', 'WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)}
  64. onChange={val => {
  65. if (val) {
  66. this.formData['venderName'] = this.gysList.find(item => item.venderId == val).venderName
  67. if (!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name)) {
  68. this.cgrkOrder = []
  69. this.formData.items = []
  70. this.getCgrkOrder()
  71. }
  72. } else {
  73. this.formData['venderName'] = ''
  74. if (!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name)) {
  75. this.cgrkOrder = []
  76. this.formData.items = []
  77. this.formData.goodsPurchaseId = ''
  78. }
  79. }
  80. }}
  81. >
  82. {this.gysList.map(item => (
  83. <el-option key={item.venderId} label={item.venderName} value={item.venderId}></el-option>
  84. ))}
  85. </el-select>
  86. </el-form-item>
  87. </div>
  88. </el-descriptions-item>
  89. {!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name) ? (
  90. <el-descriptions-item label="采购入库单">
  91. <div class="redbordererr">
  92. <el-form-item label="" lebel-width="0px" prop={`goodsPurchaseId`} rules={required}>
  93. <el-select
  94. style="width:100%"
  95. value={this.formData.goodsPurchaseId}
  96. onInput={val => {
  97. this.formData.goodsPurchaseId = val
  98. }}
  99. placeholder="请选择"
  100. disabled={!!~['SAVE', 'WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)}
  101. filterable={true}
  102. clearable={true}
  103. onChange={val => {
  104. this.formData.items = []
  105. if (val) {
  106. goodsPurchaseDetail({ id: val }).then(res => {
  107. this.formData.items = res.data.items.map(item => ({
  108. brandId: item.brandId,
  109. brandName: item.brandName,
  110. mainId: item.mainId,
  111. mainName: item.mainName,
  112. smallId: item.smallId,
  113. smallName: item.smallName,
  114. goodsMaterialId: item.goodsMaterialId,
  115. goodsMaterialName: item.goodsMaterialName,
  116. specsName: item.specsName,
  117. unit: item.unit,
  118. insideQty: item.insideQty,
  119. outQty: item.outQty,
  120. partsQty: item.partsQty,
  121. qty: item.qty,
  122. price: item.price,
  123. amount: item.amount,
  124. stockQty: item.stockQty,
  125. retQty: '',
  126. retInsideQty: '',
  127. retOutQty: '',
  128. retPartsQty: '',
  129. insideCodeQty: '',
  130. outCodeQty: '',
  131. partsCodeQty: '',
  132. retAmount: '',
  133. details: {}
  134. }))
  135. })
  136. }
  137. }}
  138. >
  139. {this.cgrkOrder.map(item => (
  140. <el-option
  141. key={item.id}
  142. label={`${item.id} | 销售金额:${item.totalAmount || '-'} | 入库时间:${
  143. item.examineTime || '-'
  144. }`}
  145. value={item.id}
  146. ></el-option>
  147. ))}
  148. </el-select>
  149. </el-form-item>
  150. </div>
  151. </el-descriptions-item>
  152. ) : (
  153. <el-descriptions-item label=""></el-descriptions-item>
  154. )}
  155. </el-descriptions>
  156. <el-descriptions
  157. border
  158. title=""
  159. column={4}
  160. colon={false}
  161. labelStyle={{ width: '8%' }}
  162. contentStyle={{ width: '17%' }}
  163. style="margin-top:-1px"
  164. >
  165. {!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name)
  166. ? [
  167. <el-descriptions-item label="退货数量">{this.formData.totalQty}</el-descriptions-item>,
  168. <el-descriptions-item label="退款金额">{this.formData.totalAmount}</el-descriptions-item>,
  169. <el-descriptions-item label=""></el-descriptions-item>,
  170. <el-descriptions-item label=""></el-descriptions-item>
  171. ]
  172. : null}
  173. <el-descriptions-item label="制单人">{this.formData.createBy}</el-descriptions-item>
  174. <el-descriptions-item label="制单时间">{this.formData.createTime}</el-descriptions-item>
  175. <el-descriptions-item label="审核人">{this.formData.examineBy}</el-descriptions-item>
  176. <el-descriptions-item label="审核时间">{this.formData.examineTime}</el-descriptions-item>
  177. </el-descriptions>
  178. <el-descriptions
  179. border
  180. title=""
  181. column={4}
  182. colon={false}
  183. labelStyle={{ width: '8%' }}
  184. contentStyle={{ width: '17%' }}
  185. style="margin-top:-1px"
  186. >
  187. <el-descriptions-item label="备注" contentStyle={{ width: '92%' }}>
  188. <el-input
  189. type="textarea"
  190. placeholder="请输入内容"
  191. value={this.formData.remark}
  192. onInput={val => {
  193. this.formData.remark = val
  194. }}
  195. maxlength="200"
  196. show-word-limit
  197. autosize={{ minRows: 2, maxRows: 4 }}
  198. disabled={!!~['SAVE', 'WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)}
  199. ></el-input>
  200. </el-descriptions-item>
  201. </el-descriptions>
  202. <el-descriptions
  203. border
  204. title=""
  205. column={4}
  206. colon={false}
  207. labelStyle={{ width: '8%' }}
  208. contentStyle={{ width: '17%' }}
  209. style="margin-top:-1px"
  210. >
  211. <el-descriptions-item label="附件" contentStyle={{ width: '92%' }}>
  212. <ImageUpload
  213. fileList={this.formData.fileUrl}
  214. uid="imgSrc666_materials_drawing_images"
  215. limit={1}
  216. isEdit={!~['SAVE', 'WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)}
  217. fileType={['image']}
  218. />
  219. </el-descriptions-item>
  220. </el-descriptions>
  221. </div>
  222. )
  223. }
  224. }
  225. ]
  226. }
  227. },
  228. methods: {
  229. // 获取供应商列表
  230. getGysList() {
  231. listPageV2({
  232. pageNum: 1,
  233. pageSize: -1,
  234. params: [
  235. { param: 'a.status', compare: '=', value: 'ON' },
  236. { param: 'a.vender_type', compare: 'like', value: '商品' }
  237. ]
  238. }).then(res => {
  239. this.gysList = res.data.records
  240. })
  241. },
  242. getCgrkOrder() {
  243. if (this.formData.venderId) {
  244. goodsPurchaseList({
  245. pageNum: 1,
  246. pageSize: -1,
  247. params: [{ param: 'a.vender_id', compare: '=', value: this.formData.venderId }]
  248. }).then(res => {
  249. this.cgrkOrder = res.data.records
  250. console.log(res.data.records)
  251. })
  252. }
  253. }
  254. }
  255. }