home_form.vue 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217
  1. <template>
  2. <div class="detail-container">
  3. <el-page-header @back="goBack" :content="listItem ? '编辑':'新增'"></el-page-header>
  4. <div class="main-title">
  5. <div class="title">工程订单</div>
  6. </div>
  7. <el-form ref="mainForm" :model="mainForm" :rules="mainFormRules" label-width="110px" size="small" label-position="right">
  8. <el-row :gutter="20">
  9. <el-col :xs="24" :sm="12" :lg="8">
  10. <el-form-item label="工程订单" prop="orderNum">
  11. <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" disabled></el-input>
  12. </el-form-item>
  13. </el-col>
  14. <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
  15. <el-form-item label="单据日期" prop="orderDate">
  16. <el-date-picker
  17. v-model="mainForm.orderDate"
  18. disabled
  19. type="date"
  20. value-format="yyyy-MM-dd"
  21. style="width: 100%;"
  22. placeholder="系统自动生成">
  23. </el-date-picker>
  24. </el-form-item>
  25. </el-col>
  26. <!-- <el-col :xs="24" :sm="12" :lg="8">
  27. <el-form-item label="产品大类" prop="type">
  28. <el-input v-model="mainForm.type" disabled v-if="listItem"></el-input>
  29. <el-select v-model="mainForm.type" placeholder="选择产品大类" style="width: 100%" disabled v-else>
  30. <el-option v-for="item in typeList" :key="item.dictCode" :label="item.dictValue" :value="item.dictCode"></el-option>
  31. </el-select>
  32. </el-form-item>
  33. </el-col> -->
  34. <el-col :xs="24" :sm="12" :lg="8">
  35. <el-form-item label="销售类型" prop="saleType">
  36. <el-select v-model="mainForm.saleType" placeholder="选择销售类型" style="width: 100%" clearable @change="changeSaleType">
  37. <el-option v-for="item in salesTypeList" :key="item.id" :label="item.saleName" :value="item.id"></el-option>
  38. </el-select>
  39. </el-form-item>
  40. </el-col>
  41. <el-col :xs="24" :sm="12" :lg="8">
  42. <el-form-item label="经销商编码" prop="jxsNum">
  43. <el-input v-model="mainForm.jxsNum" placeholder="请输入经销商编码" disabled></el-input>
  44. </el-form-item>
  45. </el-col>
  46. <el-col :xs="24" :sm="12" :lg="16">
  47. <el-form-item label="经销商名称" prop="jxsName">
  48. <el-input v-model="mainForm.jxsName" placeholder="请输入经销商名称" disabled></el-input>
  49. </el-form-item>
  50. </el-col>
  51. <el-col :xs="24" :sm="12" :lg="8">
  52. <el-form-item label="工程登录编号" prop="loginNum">
  53. <div style="display: flex;">
  54. <el-input v-model="mainForm.loginNum" placeholder="请引用工程登录" disabled></el-input>
  55. <el-button style="margin-left: 10px;" @click="openShareDetail">引用</el-button>
  56. </div>
  57. </el-form-item>
  58. </el-col>
  59. <el-col :xs="24" :sm="12" :lg="8">
  60. <el-form-item label="项目类别" prop="enginName">
  61. <el-input v-model="mainForm.enginName" placeholder="请输入项目类别" :disabled="isDealer"></el-input>
  62. </el-form-item>
  63. </el-col>
  64. <el-col :xs="24" :sm="12" :lg="8">
  65. <el-form-item label="行业类别" prop="loginType">
  66. <el-input v-model="mainForm.loginType" placeholder="请输入行业类别" :disabled="isDealer"></el-input>
  67. </el-form-item>
  68. </el-col>
  69. <el-col :xs="24" :sm="12" :lg="8">
  70. <el-form-item label="跨区厂编号" prop="factoryNum">
  71. <el-input v-model="mainForm.factoryNum" placeholder="请输入跨区厂编号"></el-input>
  72. </el-form-item>
  73. </el-col>
  74. <el-col :xs="24" :sm="12" :lg="8">
  75. <el-form-item label="使用单位" prop="company">
  76. <el-input v-model="mainForm.company" placeholder="请输入使用单位" :disabled="isDealer"></el-input>
  77. </el-form-item>
  78. </el-col>
  79. <el-col :xs="24" :sm="12" :lg="8">
  80. <el-form-item label="业务员" prop="salesMan">
  81. <el-select v-model="mainForm.salesMan" placeholder="选择业务员" size="small" filterable clearable style="width: 100%">
  82. <el-option
  83. v-for="item in salesmanList"
  84. :key="item.adminUserId"
  85. :label="item.nickName"
  86. :value="item.adminUserId">
  87. </el-option>
  88. </el-select>
  89. </el-form-item>
  90. </el-col>
  91. <el-col :xs="24" :sm="12" :lg="8">
  92. <el-form-item label="联系人" prop="contactMan">
  93. <el-input v-model="mainForm.contactMan" placeholder="请输入联系人" :disabled="isDealer"></el-input>
  94. </el-form-item>
  95. </el-col>
  96. <el-col :xs="24" :sm="12" :lg="8">
  97. <el-form-item label="固定电话" prop="tel">
  98. <el-input v-model="mainForm.tel" placeholder="请输入固定电话" :disabled="isDealer"></el-input>
  99. </el-form-item>
  100. </el-col>
  101. <el-col :xs="24" :sm="12" :lg="8">
  102. <el-form-item label="移动电话" prop="phone">
  103. <el-input v-model="mainForm.phone" placeholder="请输入移动电话" :disabled="isDealer"></el-input>
  104. </el-form-item>
  105. </el-col>
  106. <el-col :xs="24" :sm="12" :lg="16">
  107. <el-form-item label="安装地址" prop="address">
  108. <el-input v-model="mainForm.address" placeholder="请输入安装地址" :disabled="isDealer"></el-input>
  109. </el-form-item>
  110. </el-col>
  111. <el-col :xs="24" :sm="12" :lg="8">
  112. <el-form-item label="第几次申报" prop="declareNo">
  113. <el-input v-model="mainForm.declareNo" placeholder="请输入第几次申报"></el-input>
  114. </el-form-item>
  115. </el-col>
  116. <el-col :xs="24" :sm="12" :lg="16">
  117. <el-form-item label="项目说明" prop="projectRemark">
  118. <el-input v-model="mainForm.projectRemark" placeholder="请输入项目说明"></el-input>
  119. </el-form-item>
  120. </el-col>
  121. <el-col :xs="24" :sm="12" :lg="8">
  122. <el-form-item label="项目类型" prop="projectType">
  123. <el-input v-model="mainForm.projectType" placeholder="请输入项目类型"></el-input>
  124. </el-form-item>
  125. </el-col>
  126. <el-col :xs="24" :sm="24" :lg="24" v-if="!isDealer">
  127. <el-form-item label="格力内部备注" prop="greeRemark">
  128. <el-input v-model="mainForm.greeRemark" placeholder="请输入格力内部备注"></el-input>
  129. </el-form-item>
  130. </el-col>
  131. <!-- <el-col :xs="24" :sm="24" :lg="24">
  132. <el-form-item label="格力回复" prop="greeReply">
  133. <el-input v-model="mainForm.greeReply" placeholder="请输入格力回复"></el-input>
  134. </el-form-item>
  135. </el-col> -->
  136. <el-col :xs="24" :sm="24" :lg="24">
  137. <el-form-item label="备注" prop="remark">
  138. <el-input v-model="mainForm.remark" placeholder="请输入备注"></el-input>
  139. </el-form-item>
  140. </el-col>
  141. <el-col :xs="24" :sm="12" :lg="8">
  142. <el-form-item label="制单人" prop="createMan">
  143. <el-input v-model="mainForm.createMan" placeholder="请输入制单人" disabled></el-input>
  144. </el-form-item>
  145. </el-col>
  146. <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
  147. <el-form-item label="制单日期" prop="createDate">
  148. <el-date-picker
  149. v-model="mainForm.createDate"
  150. disabled
  151. type="date"
  152. value-format="yyyy-MM-dd"
  153. style="width: 100%;"
  154. placeholder="选择日期">
  155. </el-date-picker>
  156. </el-form-item>
  157. </el-col>
  158. <el-col :xs="24" :sm="12" :lg="8">
  159. <el-form-item label="文件编号" prop="fileNum">
  160. <el-input v-model="mainForm.fileNum" placeholder="请输入文件编号"></el-input>
  161. </el-form-item>
  162. </el-col>
  163. </el-row>
  164. </el-form>
  165. <div class="main-title">
  166. <div class="title">货品信息</div>
  167. <div>
  168. <el-select v-model="warehouseValue" placeholder="请选择发货仓库" size="small" style="margin-right: 10px">
  169. <el-option :label="item.name" :value="item.id" v-for="(item, index) in warehouseList" :key="index"></el-option>
  170. </el-select>
  171. <el-button type="primary" size="small" icon="el-icon-search" @click="checkStock">检查库存</el-button>
  172. <el-divider direction="vertical"></el-divider>
  173. <el-button type="primary" size="small" icon="el-icon-plus" @click="openDialog">添加货品</el-button>
  174. </div>
  175. </div>
  176. <div class="table" style="margin-top: 20px">
  177. <el-table :data="goodsList" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
  178. <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
  179. <el-table-column align="center" label="引用记录" prop="useRefCount" min-width="160" show-overflow-tooltip></el-table-column>
  180. <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="120" show-overflow-tooltip></el-table-column>
  181. <el-table-column align="center" label="物料编码" prop="materialNumber" min-width="120" show-overflow-tooltip></el-table-column>
  182. <el-table-column align="center" label="产品编码" prop="materialOldNumber" min-width="120" show-overflow-tooltip></el-table-column>
  183. <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
  184. <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip>
  185. <template slot-scope="scope">
  186. <el-input v-model="scope.row.specification" size="small" v-if="listItem"></el-input>
  187. <div v-else>{{scope.row.specification}}</div>
  188. </template>
  189. </el-table-column>
  190. <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  191. <el-table-column align="center" label="单价" prop="price" min-width="100" show-overflow-tooltip>
  192. <template slot-scope="scope">
  193. <el-input v-model="scope.row.price" size="small" type="number"></el-input>
  194. </template>
  195. </el-table-column>
  196. <el-table-column align="center" label="工程登录数量" prop="enginNum" min-width="120" show-overflow-tooltip></el-table-column>
  197. <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip>
  198. <template slot-scope="scope">
  199. <el-input v-model="scope.row.qty" size="small" type="number"></el-input>
  200. </template>
  201. </el-table-column>
  202. <el-table-column align="center" label="订单金额" min-width="100" show-overflow-tooltip>
  203. <template slot-scope="scope">
  204. {{scope.row.price * scope.row.qty}}
  205. </template>
  206. </el-table-column>
  207. <el-table-column align="center" label="返利类型" prop="customerWalletId2" min-width="160" show-overflow-tooltip>
  208. <template slot-scope="scope">
  209. <el-select v-model="scope.row.customerWalletId2" placeholder="选择返利类型" size="small" clearable @change="changeFlWallet(scope.$index)">
  210. <el-option
  211. v-for="item in scope.row.rebateWallets"
  212. :key="item.customerWalletId"
  213. :label="item.customerWalletName"
  214. :value="item.customerWalletId">
  215. </el-option>
  216. </el-select>
  217. </template>
  218. </el-table-column>
  219. <el-table-column align="center" label="返利金额" min-width="100" show-overflow-tooltip>
  220. <template slot-scope="scope">
  221. {{(scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) / 100}}
  222. </template>
  223. </el-table-column>
  224. <el-table-column align="center" label="格力折扣" min-width="100" show-overflow-tooltip>
  225. <template slot-scope="scope">
  226. {{scope.row.qty * scope.row.discAmount}}
  227. </template>
  228. </el-table-column>
  229. <el-table-column align="center" label="现金钱包" prop="customerWalletId" min-width="160" show-overflow-tooltip>
  230. <template slot-scope="scope">
  231. <el-select v-model="scope.row.customerWalletId" placeholder="选择现金钱包" size="small" clearable @change="changeXjWallet(scope.$index)">
  232. <el-option
  233. v-for="item in scope.row.wallets"
  234. :key="item.customerWalletId"
  235. :label="item.customerWalletName"
  236. :value="item.customerWalletId">
  237. </el-option>
  238. </el-select>
  239. </template>
  240. </el-table-column>
  241. <el-table-column align="center" label="实付金额" prop="qty" min-width="100" show-overflow-tooltip>
  242. <template slot-scope="scope">
  243. {{((scope.row.price * scope.row.qty) * 100 - ((scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) / 100) * 100 - ((scope.row.qty * (scope.row.discAmount * 100)) / 100) * 100) / 100}}
  244. </template>
  245. </el-table-column>
  246. <el-table-column align="center" label="是否直调" prop="isDirectTransfer" min-width="100">
  247. <template slot-scope="scope">
  248. <el-checkbox v-model="scope.row.isDirectTransfer"></el-checkbox>
  249. </template>
  250. </el-table-column>
  251. <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100"></el-table-column>
  252. <el-table-column align="center" label="已发货数量" prop="hasSendQty" min-width="100" show-overflow-tooltip></el-table-column>
  253. <el-table-column align="center" label="已退数量" prop="retiredQty" min-width="100" show-overflow-tooltip></el-table-column>
  254. <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip>
  255. <template slot-scope="scope">
  256. <el-input v-model="scope.row.remark" size="small"></el-input>
  257. </template>
  258. </el-table-column>
  259. <el-table-column align="center" label="税率" prop="tax" min-width="100" show-overflow-tooltip></el-table-column>
  260. <!-- <el-table-column align="center" label="总仓库" prop="status1" min-width="100" show-overflow-tooltip>
  261. <template slot-scope="scope">
  262. <div>{{ scope.row.status1 | status1Filter }}</div>
  263. </template>
  264. </el-table-column> -->
  265. <el-table-column align="center" label="仓库状态" prop="status2" min-width="100" show-overflow-tooltip>
  266. <template slot-scope="scope">
  267. <div>{{ status2Filter(scope.row) }}</div>
  268. </template>
  269. </el-table-column>
  270. <!-- <el-table-column align="center" label="业务员" prop="serviceId" min-width="160" show-overflow-tooltip>
  271. <template slot-scope="scope">
  272. <el-select v-model="scope.row.serviceId" placeholder="选择业务员" size="small" clearable disabled>
  273. <el-option
  274. v-for="item in salesmanList"
  275. :key="item.adminUserId"
  276. :label="item.nickName"
  277. :value="item.adminUserId">
  278. </el-option>
  279. </el-select>
  280. </template>
  281. </el-table-column> -->
  282. <el-table-column align="center" label="操作" width="100" fixed="right">
  283. <template slot-scope="scope">
  284. <el-button type="text" @click="deleteItem(scope.$index)">删除</el-button>
  285. </template>
  286. </el-table-column>
  287. </el-table>
  288. </div>
  289. <div class="page-footer">
  290. <div class="footer">
  291. <el-button type="primary" @click="clickSubmitForm(1)" :loading="formLoading">保 存</el-button>
  292. <el-button type="primary" @click="clickSubmitForm(2)" :loading="formLoading">提交审核</el-button>
  293. <el-popconfirm title="确定关闭吗?" @onConfirm="goBack" style="margin-left: 10px;">
  294. <el-button slot="reference">关 闭</el-button>
  295. </el-popconfirm>
  296. </div>
  297. </div>
  298. <!-- 工程登录列表 -->
  299. <el-dialog title="工程登录列表" :visible.sync="isShowDialog" width="70%" :close-on-click-modal="false">
  300. <el-form ref="screenForm" :model="screenForm" label-width="0" size="small" label-position="left">
  301. <el-row :gutter="20">
  302. <el-col :xs="24" :sm="12" :lg="6">
  303. <el-form-item prop="loginNum">
  304. <el-input v-model="screenForm.loginNum" placeholder="工程登录编号"></el-input>
  305. </el-form-item>
  306. </el-col>
  307. <el-col :xs="24" :sm="12" :lg="6">
  308. <el-form-item prop="enginName">
  309. <el-input v-model="screenForm.enginName" placeholder="工程项目"></el-input>
  310. </el-form-item>
  311. </el-col>
  312. <el-col :xs="24" :sm="12" :lg="6">
  313. <el-form-item prop="company">
  314. <el-input v-model="screenForm.company" placeholder="使用单位"></el-input>
  315. </el-form-item>
  316. </el-col>
  317. <el-col :xs="24" :sm="12" :lg="6" class="tr">
  318. <el-form-item label="">
  319. <el-button size="small" @click="resetScreenForm">清空</el-button>
  320. <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
  321. </el-form-item>
  322. </el-col>
  323. </el-row>
  324. </el-form>
  325. <div class="table" style="margin: 10px 0 20px;">
  326. <el-table
  327. v-loading="dialogTable_listLoading"
  328. :data="dialogTable_dataList"
  329. element-loading-text="Loading"
  330. tooltip-effect="dark"
  331. style="width: 100%"
  332. max-height="270">
  333. <el-table-column align="center" label="" width="100">
  334. <template slot-scope="scope">
  335. <el-button type="primary" size="small" @click="chooseItem(scope.row.recordNo, scope.row.userid)">选择</el-button>
  336. </template>
  337. </el-table-column>
  338. <el-table-column align="center" prop="checkTime" label="工程登录日期" show-overflow-tooltip></el-table-column>
  339. <el-table-column align="center" prop="recordNo" label="工程登录编号" show-overflow-tooltip></el-table-column>
  340. <el-table-column align="center" prop="projectName" label="工程项目" show-overflow-tooltip></el-table-column>
  341. <el-table-column align="center" prop="useUnit" label="使用单位" show-overflow-tooltip></el-table-column>
  342. <el-table-column align="center" prop="organizationName" label="经销商" show-overflow-tooltip></el-table-column>
  343. </el-table>
  344. </div>
  345. <div class="pagination clearfix">
  346. <div class="fr">
  347. <el-pagination
  348. @current-change="dialogTableCurrentChange"
  349. :current-page="dialogTable_currentPage"
  350. :page-size="dialogTable_pageSize"
  351. background
  352. layout="prev, pager, next"
  353. :total="dialogTable_listTotal">
  354. </el-pagination>
  355. </div>
  356. </div>
  357. <div slot="footer" class="dialog-footer">
  358. <el-button @click="isShowDialog = false">关 闭</el-button>
  359. </div>
  360. </el-dialog>
  361. <el-dialog title="添加产品" :visible.sync="isShowGoodsDialog" width="80%">
  362. <el-form ref="goodsScreenForm" :model="goodsScreenForm" size="small" label-position="left">
  363. <el-row :gutter="20">
  364. <el-col :xs="12" :sm="6" :lg="6">
  365. <el-form-item prop="proNum">
  366. <el-input v-model="goodsScreenForm.proNum" placeholder="请输入产品编码"></el-input>
  367. </el-form-item>
  368. </el-col>
  369. <el-col :xs="12" :sm="6" :lg="6">
  370. <el-form-item prop="proName">
  371. <el-input v-model="goodsScreenForm.proName" placeholder="请输入产品名称"></el-input>
  372. </el-form-item>
  373. </el-col>
  374. <el-col :xs="12" :sm="6" :lg="6">
  375. <el-form-item prop="proModel">
  376. <el-input v-model="goodsScreenForm.proModel" placeholder="请输入产品型号"></el-input>
  377. </el-form-item>
  378. </el-col>
  379. <el-col :xs="12" :sm="6" :lg="6">
  380. <el-form-item prop="price1" style="display: flex">
  381. <el-input v-model="goodsScreenForm.price1" placeholder="请输入价格" style="width: 46%"></el-input>
  382. <span> - </span>
  383. <el-input v-model="goodsScreenForm.price2" placeholder="请输入价格" style="width: 46%"></el-input>
  384. </el-form-item>
  385. </el-col>
  386. <el-col :xs="24" :sm="24" :lg="24" class="tr">
  387. <el-form-item label="">
  388. <el-button size="small" @click="resetGoodsScreenForm">清空</el-button>
  389. <el-button size="small" type="primary" @click="submitGoodsScreenForm">搜索</el-button>
  390. </el-form-item>
  391. </el-col>
  392. </el-row>
  393. </el-form>
  394. <div class="tables">
  395. <div class="table">
  396. <el-table :data="leftGoodsList" element-loading-text="Loading" border fit highlight-current-row stripe height="400" @selection-change="leftSelectionChange">
  397. <el-table-column align="center" type="selection" width="55" :selectable='checkboxSelect'></el-table-column>
  398. <el-table-column align="center" label="产品编码" prop="number" min-width="100" show-overflow-tooltip></el-table-column>
  399. <el-table-column align="center" label="产品名称" prop="name" min-width="160" show-overflow-tooltip></el-table-column>
  400. <el-table-column align="center" label="产品型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  401. <el-table-column align="center" label="产品价格" prop="batchPrice" min-width="80" show-overflow-tooltip></el-table-column>
  402. </el-table>
  403. <div class="pagination clearfix" style="margin-top: 10px">
  404. <div class="fr">
  405. <el-pagination
  406. @current-change="handleTableCurrentChange"
  407. :current-page="currentPage"
  408. :page-size="10"
  409. background
  410. layout="prev, pager, next"
  411. :total="listTotal">
  412. </el-pagination>
  413. </div>
  414. </div>
  415. </div>
  416. <div class="buttons">
  417. <el-button size="small" type="primary" @click="addAllGoods">全部添加</el-button>
  418. <el-button size="small" type="primary" @click="addGoods">添&emsp;加</el-button>
  419. <el-button size="small" type="danger" @click="deleteGoods">删&emsp;除</el-button>
  420. <el-button size="small" type="danger" @click="deleteAllGoods">全部删除</el-button>
  421. </div>
  422. <div class="table">
  423. <el-table :data="rightGoodsList" element-loading-text="Loading" border fit highlight-current-row stripe height="400" @selection-change="rightSelectionChange">
  424. <el-table-column align="center" type="selection" width="55"></el-table-column>
  425. <el-table-column align="center" label="产品编码" prop="number" min-width="100" show-overflow-tooltip></el-table-column>
  426. <el-table-column align="center" label="产品名称" prop="name" min-width="160" show-overflow-tooltip></el-table-column>
  427. <el-table-column align="center" label="产品型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  428. <el-table-column align="center" label="产品价格" prop="batchPrice" min-width="80" show-overflow-tooltip></el-table-column>
  429. </el-table>
  430. </div>
  431. </div>
  432. <span slot="footer" class="dialog-footer">
  433. <el-button @click="closeDialog">取 消</el-button>
  434. <el-button type="primary" @click="submitAddGoods">确 定</el-button>
  435. </span>
  436. </el-dialog>
  437. </div>
  438. </template>
  439. <script>
  440. import { getOrderDetail, getHomeLoginList, getHomeLoginDetail, getWarehouseList, addHome, editHome, submitHome, checkStock, getRetailProductList } from "@/api/supply/engin";
  441. import { getDictList, getTypeList, getSalesmanList } from '@/api/common'
  442. import { findElem } from '@/utils/util'
  443. let that
  444. export default {
  445. name: 'HomeForm',
  446. componentName: 'HomeForm',
  447. props: ['listItem'],
  448. filters: {
  449. status1Filter(val) {
  450. let STOCK_ORDER_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_START').dictValue;
  451. let STOCK_ORDER_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_END').dictValue;
  452. let STOCK_ORDER_HAVE_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_START').dictValue;
  453. let STOCK_ORDER_HAVE_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_END').dictValue;
  454. let STOCK_ORDER_ALL_NUM = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_ALL_NUM').dictValue;
  455. if (val === '' || val === null || val === undefined) return '未检查';
  456. else if (val <= 0) return '无货';
  457. else if (val > STOCK_ORDER_START && val <= STOCK_ORDER_END) return val;
  458. else if (val >= STOCK_ORDER_HAVE_START && val <= STOCK_ORDER_HAVE_END) return '有货';
  459. else if (val > STOCK_ORDER_ALL_NUM) return '充足';
  460. },
  461. },
  462. data() {
  463. return {
  464. editId: '',
  465. mainForm: {
  466. orderNum: '',
  467. orderDate: '',
  468. type: '',
  469. jxsNum: '',
  470. jxsName: '',
  471. loginNum: '',
  472. enginName: '',
  473. loginType: '',
  474. promiseStatus: '',
  475. factoryNum: '',
  476. company: '',
  477. saleType: '',
  478. contactMan: '',
  479. tel: '',
  480. phone: '',
  481. address: '',
  482. declareNo: '',
  483. greeRemark: '',
  484. greeReply: '',
  485. remark: '',
  486. createMan: '',
  487. createDate: '',
  488. fileNum: '',
  489. loginUserId: '',
  490. salesMan: '',
  491. projectRemark: '',
  492. projectType: '',
  493. },
  494. mainFormRules: {
  495. // orderDate: [{ required: true, message: '请选择单据日期', trigger: 'change' }],
  496. jxsNum: [{ required: true, message: '请输入经销商编码', trigger: 'blur' }],
  497. jxsName: [{ required: true, message: '请输入经销商名称', trigger: 'blur' }],
  498. loginNum: [{ required: true, message: '请输入工程登录编号', trigger: 'blur' }],
  499. // enginName: [{ required: true, message: '请输入项目类别', trigger: 'blur' }],
  500. // loginType: [{ required: true, message: '请输入行业类别', trigger: 'blur' }],
  501. company: [{ required: true, message: '请输入使用单位', trigger: 'blur' }],
  502. saleType: [{ required: true, message: '请选择销售类型', trigger: 'change' }],
  503. // contactMan: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
  504. // tel: [{ required: true, message: '请输入固定电话', trigger: 'blur' }],
  505. // phone: [{ required: true, message: '请输入移动电话', trigger: 'blur' }],
  506. address: [{ required: true, message: '请输入安装地址', trigger: 'blur' }],
  507. },
  508. salesTypeList: [],
  509. // typeList: [],
  510. stockList: [],
  511. goodsList: [],
  512. isShowDialog: false, // 工程登录列表 - 弹窗
  513. screenForm: {
  514. loginNum: '',
  515. enginName: '',
  516. company: '',
  517. },
  518. dialogTable_dataList: null, // 工程登录列表 - 列表数据
  519. dialogTable_listLoading: true, // 工程登录列表 - 列表加载loading
  520. dialogTable_currentPage: 1, // 工程登录列表 - 当前页码
  521. dialogTable_pageSize: 10, // 工程登录列表 - 每页数量
  522. dialogTable_listTotal: 0, // 工程登录列表 - 列表总数
  523. warehouseList: [],
  524. warehouseValue: '',
  525. isShowGoodsDialog: false,
  526. goodsScreenForm: {
  527. proNum: '',
  528. proName: '',
  529. proModel: '',
  530. price1: '',
  531. price2: '',
  532. },
  533. currentPage: 1,
  534. listTotal: 0,
  535. leftGoodsList: [],
  536. rightGoodsList: [],
  537. leftSelection: [],
  538. rightSelection: [],
  539. formLoading: false,
  540. isFirst: false,
  541. salesmanList: [],
  542. }
  543. },
  544. computed: {
  545. isDealer() {
  546. return JSON.parse(localStorage.getItem("supply_user")).isCustomer
  547. },
  548. outSalesmanList() {
  549. let list = [];
  550. if(this.goodsList && this.goodsList.length) {
  551. this.goodsList.forEach(item => {
  552. if(item.serviceId) {
  553. let hasItem = findElem(list, 'adminUserId', item.serviceId);
  554. if(hasItem < 0) {
  555. let obj = this.salesmanList.find(o => o.adminUserId == item.serviceId);
  556. if(obj) {
  557. list.push(obj);
  558. }
  559. }
  560. }
  561. })
  562. if(this.isFirst) {
  563. this.isFirst = false;
  564. }else {
  565. this.mainForm.salesMan = this.goodsList[0].serviceId;
  566. }
  567. }
  568. return list
  569. }
  570. },
  571. watch: {
  572. goodsList: {
  573. handler(newValue, oldValue) {
  574. if(this.goodsList && this.goodsList.length) {
  575. if(this.isFirst) {
  576. this.isFirst = false;
  577. }else {
  578. this.mainForm.salesMan = this.goodsList[0].serviceId;
  579. }
  580. }else {
  581. this.mainForm.salesMan = '';
  582. }
  583. },
  584. immediate: true,
  585. deep: true
  586. }
  587. },
  588. beforeCreate() {
  589. that = this;
  590. },
  591. async created() {
  592. await this.getSalesmanList();
  593. this.getDictList();
  594. this.getSalesTypeList();
  595. this.getWarehouseList();
  596. if(this.listItem) {
  597. this.isFirst = true;
  598. this.editId = this.listItem.parentId;
  599. this.getDetail();
  600. }else {
  601. this.mainForm.jxsNum = JSON.parse(localStorage.getItem("supply_user")).customerNumber;
  602. this.mainForm.jxsName = JSON.parse(localStorage.getItem("supply_user")).customerName;
  603. this.mainForm.createMan = JSON.parse(localStorage.getItem("supply_user")).nickName;
  604. this.mainForm.createDate = this.getDate();
  605. }
  606. },
  607. methods: {
  608. // 返回列表
  609. goBack() {
  610. this.$emit('backListFormDetail');
  611. },
  612. getDate() {
  613. var date = new Date();
  614. var seperator1 = "-";
  615. var year = date.getFullYear();
  616. var month = date.getMonth() + 1;
  617. var strDate = date.getDate();
  618. if (month >= 1 && month <= 9) {
  619. month = "0" + month;
  620. }
  621. if (strDate >= 0 && strDate <= 9) {
  622. strDate = "0" + strDate;
  623. }
  624. var currentdate = year + seperator1 + month + seperator1 + strDate;
  625. return currentdate;
  626. },
  627. // 获取产品大类列表
  628. getDictList() {
  629. // getDictList({sysDictEnum: 'PRODUCT_TYPE'}).then(res => {
  630. // this.typeList = res.data;
  631. // })
  632. getDictList({sysDictEnum: 'STOCK_ORDER'}).then(res => {
  633. this.stockList = res.data;
  634. })
  635. },
  636. // 获取销售类型列表
  637. getSalesTypeList() {
  638. getTypeList({
  639. pageNum: 1,
  640. pageSize: -1
  641. }).then((res) => {
  642. this.salesTypeList = res.data.records;
  643. })
  644. },
  645. // 获取仓库列表
  646. getWarehouseList() {
  647. getWarehouseList({
  648. pageNum: 1,
  649. pageSize: -1
  650. }).then((res) => {
  651. this.warehouseList = res.data.records;
  652. })
  653. },
  654. async getSalesmanList() {
  655. const res = await getSalesmanList({
  656. pageNum: 1,
  657. pageSize: -1,
  658. isCustomer: 0,
  659. status: true,
  660. });
  661. this.salesmanList = res.data.records;
  662. },
  663. // 工程登录列表 - 获取列表
  664. getHomeLoginList() {
  665. getHomeLoginList({
  666. pageNum: this.dialogTable_currentPage,
  667. pageSize: this.dialogTable_pageSize,
  668. recordNo: this.screenForm.loginNum,
  669. projectName: this.screenForm.enginName,
  670. useUnit: this.screenForm.company,
  671. examineStatus: 'OK'
  672. }).then(res => {
  673. this.dialogTable_dataList = res.data.records;
  674. this.dialogTable_listTotal = res.data.total;
  675. this.dialogTable_listLoading = false;
  676. })
  677. },
  678. // 工程登录列表 - 打开弹窗
  679. openShareDetail() {
  680. if(!this.mainForm.saleType) {
  681. return this.$errorMsg('请先选择销售类型');
  682. }
  683. this.isShowDialog = true;
  684. this.dialogTable_currentPage = 1;
  685. this.screenForm.loginNum = this.mainForm.loginNum;
  686. this.getHomeLoginList();
  687. },
  688. // 工程登录列表 - 更改列表当前页
  689. dialogTableCurrentChange(val) {
  690. this.dialogTable_currentPage = val;
  691. this.getHomeLoginList();
  692. },
  693. // 提交筛选表单
  694. submitScreenForm() {
  695. this.dialogTable_currentPage = 1;
  696. this.getHomeLoginList();
  697. },
  698. // 重置筛选表单
  699. resetScreenForm() {
  700. this.$refs.screenForm.resetFields();
  701. this.dialogTable_currentPage = 1;
  702. this.getHomeLoginList();
  703. },
  704. // 选择工程登录
  705. chooseItem(id, uid) {
  706. getHomeLoginDetail({
  707. recordNo: id,
  708. saleTypeId: this.mainForm.saleType,
  709. userId: uid,
  710. enginOrderId: this.mainForm.orderNum
  711. }).then(res => {
  712. this.isShowDialog = false;
  713. let data = res.data;
  714. this.mainForm.type = data.productCategory;
  715. this.mainForm.loginUserId = data.userid;
  716. // this.mainForm.saleType = '';
  717. this.mainForm.loginNum = data.recordNo;
  718. this.mainForm.enginName = data.projectName;
  719. this.mainForm.loginType = data.tradeCategory;
  720. this.mainForm.factoryNum = data.factoryNo;
  721. this.mainForm.promiseStatus = data.promiseStatus;
  722. this.mainForm.company = data.useUnit;
  723. this.mainForm.contactMan = data.buyUnitCallMen;
  724. this.mainForm.tel = data.buyUnitTel;
  725. this.mainForm.phone = data.buyUnitPhone;
  726. this.mainForm.address = data.installAddress;
  727. this.mainForm.declareNo = data.declareNo;
  728. this.mainForm.projectRemark = data.buChonShuoMing;
  729. this.mainForm.projectType = data.govBuyType;
  730. let saleTypeItem = this.salesTypeList.find(o => o.id == this.mainForm.saleType);
  731. this.goodsList = data.items.map(item => {
  732. return {
  733. useRefCount: item.useRefCount,
  734. saleTypeId: saleTypeItem.id,
  735. saleTypeCode: saleTypeItem.saleCode,
  736. saleTypeName: saleTypeItem.saleName,
  737. materialId: item.materialId,
  738. materialNumber: item.materialNumber,
  739. materialOldNumber: item.materialOldNumber,
  740. materialName: item.materialName,
  741. specification: item.machine,
  742. enginNum: item.num,
  743. enginPrice: item.price,
  744. enginTotality: item.totality,
  745. historyHasDeliverQty: item.hasDeliverQty,
  746. unit: item.unit,
  747. price: item.price,
  748. qty: item.num,
  749. customerWalletId2: '',
  750. rebateRate: '',
  751. discAmount: '',
  752. customerWalletId: '',
  753. isDirectTransfer: false,
  754. directTransferQty: '',
  755. hasSendQty: '',
  756. remark: item.discri,
  757. tax: '',
  758. status1: '',
  759. status2: '',
  760. rebateWallets: item.customerWalletList.filter(item => {
  761. return item.type === 'REBATE';
  762. }),
  763. wallets: item.customerWalletList.filter(item => {
  764. return item.type === 'COMMONLY';
  765. }),
  766. }
  767. })
  768. this.goodsList.forEach(item => {
  769. item.customerWalletId = (item.wallets && item.wallets.length) ? item.wallets[0].customerWalletId : '';
  770. item.serviceId = (item.wallets && item.wallets.length) ? item.wallets[0].serviceId : '';
  771. item.serviceName = (item.wallets && item.wallets.length) ? item.wallets[0].serviceName : '';
  772. })
  773. })
  774. },
  775. // 选择销售类型
  776. changeSaleType() {
  777. if(this.mainForm.loginNum) {
  778. this.chooseItem(this.mainForm.loginNum, this.mainForm.loginUserId);
  779. }
  780. },
  781. // 删除产品
  782. deleteItem(index) {
  783. this.goodsList.splice(index, 1);
  784. },
  785. // 修改返利钱包
  786. changeFlWallet(index) {
  787. if(this.goodsList[index].customerWalletId2) {
  788. let obj = this.goodsList[index].rebateWallets.find(o => o.customerWalletId == this.goodsList[index].customerWalletId2);
  789. this.goodsList[index].rebateRate = obj.rebateRate;
  790. this.goodsList[index].customerWalletName2 = obj.customerWalletName;
  791. }else {
  792. this.goodsList[index].rebateRate = '';
  793. this.goodsList[index].customerWalletName2 = '';
  794. }
  795. },
  796. // 修改现金钱包
  797. changeXjWallet(index) {
  798. if(this.goodsList[index].customerWalletId) {
  799. let obj = this.goodsList[index].wallets.find(o => o.customerWalletId == this.goodsList[index].customerWalletId);
  800. this.goodsList[index].customerWalletName = obj.customerWalletName;
  801. }else {
  802. this.goodsList[index].customerWalletName = '';
  803. }
  804. },
  805. // 获取详情
  806. getDetail() {
  807. getOrderDetail({id: this.editId}).then(res => {
  808. let data = res.data;
  809. this.mainForm.orderNum = data.enginOrderId;
  810. this.mainForm.orderDate = data.orderDate;
  811. this.mainForm.type = data.mainId;
  812. this.mainForm.jxsNum = data.customerNumber;
  813. this.mainForm.jxsName = data.customerName;
  814. this.mainForm.loginNum = data.refEnginRecordNo;
  815. this.mainForm.enginName = data.refProjectName;
  816. this.mainForm.loginType = data.refTradeCategory;
  817. this.mainForm.promiseStatus = data.refPromiseStatus;
  818. this.mainForm.factoryNum = data.refFactoryNo;
  819. this.mainForm.company = data.refUseUnit;
  820. this.mainForm.saleType = data.saleTypeId;
  821. this.mainForm.contactMan = data.refLinkman;
  822. this.mainForm.tel = data.refTel;
  823. this.mainForm.phone = data.refPhone;
  824. this.mainForm.address = data.refInstallAddress;
  825. this.mainForm.declareNo = data.refDeclareNo;
  826. this.mainForm.greeRemark = data.geLiInerNote;
  827. this.mainForm.greeReply = data.note1;
  828. this.mainForm.remark = data.remark;
  829. this.mainForm.createMan = data.createBy;
  830. this.mainForm.createDate = data.createTime;
  831. this.mainForm.fileNum = data.fileNo;
  832. this.mainForm.salesMan = data.serviceId;
  833. this.mainForm.projectRemark = data.refProjectNote;
  834. this.mainForm.projectType = data.refProjectType;
  835. data.items.forEach(item => {
  836. item.status1 = '';
  837. item.status2 = '';
  838. item.rebateWallets = item.customerWalletList.filter(item => {
  839. return item.type === 'REBATE';
  840. });
  841. item.wallets = item.customerWalletList.filter(item => {
  842. return item.type === 'COMMONLY';
  843. });
  844. })
  845. this.goodsList = data.items;
  846. })
  847. },
  848. // 获取商品列表
  849. getGoodsList() {
  850. getRetailProductList({
  851. pageNum: this.currentPage,
  852. pageSize: 10,
  853. saleId: this.mainForm.saleType,
  854. materialCode: this.goodsScreenForm.proNum,
  855. materialName: this.goodsScreenForm.proName,
  856. specification: this.goodsScreenForm.proModel,
  857. price1: this.goodsScreenForm.price1,
  858. price2: this.goodsScreenForm.price2,
  859. }).then(res => {
  860. let oldGoodsList = this.goodsList;
  861. let newGoodsList = res.data.records;
  862. for(let i = 0; i < oldGoodsList.length; i++) {
  863. let oldItem = oldGoodsList[i]
  864. for(let j = 0; j < newGoodsList.length; j++) {
  865. let newItem = newGoodsList[j]
  866. if(newItem.id === oldItem.id){
  867. newGoodsList[j].selected = true;
  868. break;
  869. }
  870. }
  871. }
  872. res.data.records.forEach(item => {
  873. item.materialName = item.name;
  874. item.materialCode = item.number;
  875. item.saleTypeName = item.saleName;
  876. item.unit = item.baseUnit;
  877. item.price = item.batchPrice;
  878. item.tax = item.taxRate;
  879. item.isDirectTransfer = false;
  880. item.directTransferQty = '';
  881. item.status1 = '';
  882. item.status2 = '';
  883. item.rebateAmount = '';
  884. item.rebateRate = '';
  885. item.productPriceId = item.id;
  886. item.customerWalletId = (item.wallets && item.wallets.length) ? item.wallets[0].customerWalletId : '';
  887. });
  888. this.leftGoodsList = res.data.records;
  889. this.listTotal = res.data.total;
  890. })
  891. },
  892. // 查询重复值并禁选
  893. checkboxSelect(row, rowIndex) {
  894. if (row.selected) {
  895. return false // 禁用
  896. }else{
  897. return true // 不禁用
  898. }
  899. },
  900. // 点击 选择商品
  901. openDialog() {
  902. if(!this.mainForm.saleType) {
  903. return this.$errorMsg('请先选择销售类型');
  904. }
  905. this.isShowGoodsDialog = true;
  906. this.getGoodsList();
  907. },
  908. // 提交筛选表单
  909. submitGoodsScreenForm() {
  910. this.currentPage = 1;
  911. this.getGoodsList();
  912. },
  913. // 重置筛选表单
  914. resetGoodsScreenForm() {
  915. this.$refs.goodsScreenForm.resetFields();
  916. this.currentPage = 1;
  917. this.getGoodsList();
  918. },
  919. // 更改列表当前页
  920. handleTableCurrentChange(val) {
  921. this.currentPage = val;
  922. this.getGoodsList();
  923. },
  924. // 关闭 弹窗
  925. closeDialog() {
  926. this.isShowGoodsDialog = false;
  927. },
  928. // 左侧列表选择
  929. leftSelectionChange(val) {
  930. this.leftSelection = val;
  931. },
  932. // 右侧列表选择
  933. rightSelectionChange(val) {
  934. this.rightSelection = val;
  935. },
  936. // 数组去重
  937. delRepeat(arr1, arr2) {
  938. let allArr = arr1.concat(arr2); // 两个数组对象合并
  939. let newArr = []; // 存放去重后数据的新数组
  940. for(let i=0; i<allArr.length; i++){ // 循环allArr数组对象的内容
  941. let flag = true; // 建立标记,判断数据是否重复,true为不重复
  942. for(let j=0; j<newArr.length; j++){ // 循环新数组的内容
  943. if(allArr[i].id == newArr[j].id){ // 让allArr数组对象的内容与新数组的内容作比较,相同的话,改变标记为false
  944. flag = false;
  945. }
  946. }
  947. if(flag){ // 判断是否重复
  948. newArr.push(allArr[i]); // 不重复的放入新数组。 新数组的内容会继续进行上边的循环。
  949. }
  950. }
  951. return newArr;
  952. },
  953. // 全部添加
  954. addAllGoods() {
  955. this.rightGoodsList = this.delRepeat(this.leftGoodsList, this.rightGoodsList);
  956. },
  957. // 添加
  958. addGoods() {
  959. this.rightGoodsList = this.delRepeat(this.leftSelection, this.rightGoodsList);
  960. },
  961. // 删除
  962. deleteGoods() {
  963. let rightGoodsList = this.rightGoodsList;
  964. let rightSelection = this.rightSelection;
  965. for(let i = 0; i < rightGoodsList.length; i++) {
  966. for(let j = 0; j < rightSelection.length; j++) {
  967. if(rightSelection[j].materialId == rightGoodsList[i].materialId){
  968. this.rightGoodsList.splice(i, 1);
  969. }
  970. }
  971. }
  972. },
  973. // 全部删除
  974. deleteAllGoods() {
  975. this.rightGoodsList = [];
  976. },
  977. // 确定 添加产品
  978. submitAddGoods() {
  979. // this.goodsList = this.delRepeat(this.rightGoodsList, this.goodsList);
  980. this.goodsList = this.goodsList.concat(this.rightGoodsList);
  981. this.isShowGoodsDialog = false;
  982. this.leftGoodsList = [];
  983. this.rightGoodsList = [];
  984. },
  985. // 检查库存
  986. checkStock() {
  987. if(!this.warehouseValue) {
  988. return this.$errorMsg('请选择仓库');
  989. }
  990. if(!this.goodsList) {
  991. return this.$errorMsg('请添加货品');
  992. }
  993. let ids = [];
  994. this.goodsList.forEach(item => {
  995. ids.push(item.materialId);
  996. })
  997. checkStock({
  998. correspondId: this.warehouseValue,
  999. materialId: ids.join(',')
  1000. }).then(res => {
  1001. if(res.data) {
  1002. this.goodsList.forEach((item, index) => {
  1003. item.status1 = res.data[index].allStockNum;
  1004. item.status2 = res.data[index].stockNum;
  1005. })
  1006. }
  1007. })
  1008. },
  1009. status2Filter(item) {
  1010. if (item.status2 === '' || item.status2 === null || item.status2 === undefined) return '未检查';
  1011. else if (item.status2 <= 0) return '无货';
  1012. else if (item.status2 >= item.qty) return '可用';
  1013. else return '短缺';
  1014. },
  1015. // 保存 / 提交审核
  1016. clickSubmitForm(type) {
  1017. this.$refs.mainForm.validate((valid) => {
  1018. if (valid) {
  1019. for(let i=0; i<this.goodsList.length; i++) {
  1020. if(!this.goodsList[i].customerWalletId) {
  1021. this.$errorMsg('请选择现金钱包');
  1022. return;
  1023. }
  1024. }
  1025. let goodsList = JSON.parse(JSON.stringify(this.goodsList));
  1026. goodsList.forEach(item => {
  1027. delete item.rebateWallets;
  1028. delete item.wallets;
  1029. })
  1030. let saleTypeItem = this.salesTypeList.find(o => o.id == this.mainForm.saleType);
  1031. let saleManItem = this.mainForm.salesMan ? this.salesmanList.find(o => o.adminUserId == this.mainForm.salesMan) : '';
  1032. let params = {
  1033. enginOrderId: this.mainForm.orderNum,
  1034. // orderDate: this.mainForm.orderDate,
  1035. // mainId: this.mainForm.type || '',
  1036. loginUserId: this.mainForm.loginUserId,
  1037. refEnginRecordNo: this.mainForm.loginNum || '',
  1038. refProjectName: this.mainForm.enginName || '',
  1039. refTradeCategory: this.mainForm.loginType || '',
  1040. refPromiseStatus: this.mainForm.promiseStatus || '',
  1041. refFactoryNo: this.mainForm.factoryNum || '',
  1042. refUseUnit: this.mainForm.company || '',
  1043. refLinkman: this.mainForm.contactMan || '',
  1044. refTel: this.mainForm.tel || '',
  1045. refPhone: this.mainForm.phone || '',
  1046. refInstallAddress: this.mainForm.address || '',
  1047. refDeclareNo: this.mainForm.declareNo || '',
  1048. saleTypeId: this.mainForm.saleType,
  1049. saleTypeCode: saleTypeItem.saleCode,
  1050. saleTypeName: saleTypeItem.saleName,
  1051. geLiInerNote: this.mainForm.greeRemark || '',
  1052. geLiNote: this.mainForm.greeReply || '',
  1053. remark: this.mainForm.remark || '',
  1054. fileNo: this.mainForm.fileNum || '',
  1055. serviceId: this.mainForm.salesMan,
  1056. serviceName: saleManItem.nickName,
  1057. refProjectNote: this.mainForm.projectRemark,
  1058. refProjectType: this.mainForm.projectType,
  1059. items: goodsList,
  1060. }
  1061. this.formLoading = true;
  1062. if(type === 1) {
  1063. if(this.listItem) {
  1064. editHome(params).then(res => {
  1065. this.$successMsg('编辑成功');
  1066. this.goBack();
  1067. this.$parent.getList();
  1068. }).finally(res => {
  1069. this.formLoading = false;
  1070. })
  1071. }else {
  1072. addHome(params).then(res => {
  1073. this.$successMsg('新增成功');
  1074. this.goBack();
  1075. this.$parent.getList();
  1076. }).finally(res => {
  1077. this.formLoading = false;
  1078. })
  1079. }
  1080. }else if(type === 2) {
  1081. submitHome(params).then(res => {
  1082. this.$successMsg('提交审核成功');
  1083. this.goBack();
  1084. this.$parent.getList();
  1085. }).finally(res => {
  1086. this.formLoading = false;
  1087. })
  1088. }
  1089. }
  1090. })
  1091. },
  1092. }
  1093. }
  1094. </script>
  1095. <style scoped lang="scss">
  1096. .detail-container {
  1097. width: 100%;
  1098. height: 100%;
  1099. }
  1100. .main-title {
  1101. display: flex;
  1102. justify-content: space-between;
  1103. align-items: center;
  1104. margin-top: 20px;
  1105. height: 60px;
  1106. border-bottom: 1px solid #DCDFE6;
  1107. margin-bottom: 20px;
  1108. .title {
  1109. font-size: 16px;
  1110. font-weight: 600;
  1111. padding-left: 10px;
  1112. }
  1113. }
  1114. .tables {
  1115. display: flex;
  1116. margin-top: 10px;
  1117. .table {
  1118. width: 45%;
  1119. }
  1120. .buttons {
  1121. display: flex;
  1122. flex-direction: column;
  1123. justify-content: center;
  1124. align-items: center;
  1125. padding: 0 10px;
  1126. button {
  1127. margin: 0;
  1128. margin-top: 10px;
  1129. }
  1130. }
  1131. }
  1132. ::v-deep input::-webkit-outer-spin-button,
  1133. ::v-deep input::-webkit-inner-spin-button {
  1134. -webkit-appearance: none;
  1135. }
  1136. ::v-deep input[type='number'] {
  1137. -moz-appearance: textfield;
  1138. }
  1139. </style>