home_form.vue 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215
  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. factoryNum: '',
  475. company: '',
  476. saleType: '',
  477. contactMan: '',
  478. tel: '',
  479. phone: '',
  480. address: '',
  481. declareNo: '',
  482. greeRemark: '',
  483. greeReply: '',
  484. remark: '',
  485. createMan: '',
  486. createDate: '',
  487. fileNum: '',
  488. loginUserId: '',
  489. salesMan: '',
  490. projectRemark: '',
  491. projectType: '',
  492. tradeCategory: ''
  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.promiseStatus;
  720. this.mainForm.company = data.useUnit;
  721. this.mainForm.contactMan = data.buyUnitCallMen;
  722. this.mainForm.tel = data.buyUnitTel;
  723. this.mainForm.phone = data.buyUnitPhone;
  724. this.mainForm.address = data.installAddress;
  725. this.mainForm.declareNo = data.declareNo;
  726. this.mainForm.projectRemark = data.buChonShuoMing;
  727. this.mainForm.projectType = data.govBuyType;
  728. this.mainForm.tradeCategory = data.tradeCategory;
  729. let saleTypeItem = this.salesTypeList.find(o => o.id == this.mainForm.saleType);
  730. this.goodsList = data.items.map(item => {
  731. return {
  732. useRefCount: item.useRefCount,
  733. saleTypeId: saleTypeItem.id,
  734. saleTypeCode: saleTypeItem.saleCode,
  735. saleTypeName: saleTypeItem.saleName,
  736. materialId: item.materialId,
  737. materialNumber: item.materialNumber,
  738. materialOldNumber: item.materialOldNumber,
  739. materialName: item.materialName,
  740. specification: item.machine,
  741. enginNum: item.num,
  742. enginPrice: item.price,
  743. enginTotality: item.totality,
  744. historyHasDeliverQty: item.hasDeliverQty,
  745. unit: item.unit,
  746. price: item.price,
  747. qty: item.num,
  748. customerWalletId2: '',
  749. rebateRate: '',
  750. discAmount: '',
  751. customerWalletId: '',
  752. isDirectTransfer: false,
  753. directTransferQty: '',
  754. hasSendQty: '',
  755. remark: item.discri,
  756. tax: '',
  757. status1: '',
  758. status2: '',
  759. rebateWallets: item.customerWalletList.filter(item => {
  760. return item.type === 'REBATE';
  761. }),
  762. wallets: item.customerWalletList.filter(item => {
  763. return item.type === 'COMMONLY';
  764. }),
  765. }
  766. })
  767. this.goodsList.forEach(item => {
  768. item.customerWalletId = (item.wallets && item.wallets.length) ? item.wallets[0].customerWalletId : '';
  769. item.serviceId = (item.wallets && item.wallets.length) ? item.wallets[0].serviceId : '';
  770. item.serviceName = (item.wallets && item.wallets.length) ? item.wallets[0].serviceName : '';
  771. })
  772. })
  773. },
  774. // 选择销售类型
  775. changeSaleType() {
  776. if(this.mainForm.loginNum) {
  777. this.chooseItem(this.mainForm.loginNum, this.mainForm.loginUserId);
  778. }
  779. },
  780. // 删除产品
  781. deleteItem(index) {
  782. this.goodsList.splice(index, 1);
  783. },
  784. // 修改返利钱包
  785. changeFlWallet(index) {
  786. if(this.goodsList[index].customerWalletId2) {
  787. let obj = this.goodsList[index].rebateWallets.find(o => o.customerWalletId == this.goodsList[index].customerWalletId2);
  788. this.goodsList[index].rebateRate = obj.rebateRate;
  789. this.goodsList[index].customerWalletName2 = obj.customerWalletName;
  790. }else {
  791. this.goodsList[index].rebateRate = '';
  792. this.goodsList[index].customerWalletName2 = '';
  793. }
  794. },
  795. // 修改现金钱包
  796. changeXjWallet(index) {
  797. if(this.goodsList[index].customerWalletId) {
  798. let obj = this.goodsList[index].wallets.find(o => o.customerWalletId == this.goodsList[index].customerWalletId);
  799. this.goodsList[index].customerWalletName = obj.customerWalletName;
  800. }else {
  801. this.goodsList[index].customerWalletName = '';
  802. }
  803. },
  804. // 获取详情
  805. getDetail() {
  806. getOrderDetail({id: this.editId}).then(res => {
  807. let data = res.data;
  808. this.mainForm.orderNum = data.enginOrderId;
  809. this.mainForm.orderDate = data.orderDate;
  810. this.mainForm.type = data.mainId;
  811. this.mainForm.jxsNum = data.customerNumber;
  812. this.mainForm.jxsName = data.customerName;
  813. this.mainForm.loginNum = data.refEnginRecordNo;
  814. this.mainForm.enginName = data.refProjectName;
  815. this.mainForm.loginType = data.refPromiseStatus;
  816. this.mainForm.factoryNum = data.refFactoryNo;
  817. this.mainForm.company = data.refUseUnit;
  818. this.mainForm.saleType = data.saleTypeId;
  819. this.mainForm.contactMan = data.refLinkman;
  820. this.mainForm.tel = data.refTel;
  821. this.mainForm.phone = data.refPhone;
  822. this.mainForm.address = data.refInstallAddress;
  823. this.mainForm.declareNo = data.refDeclareNo;
  824. this.mainForm.greeRemark = data.geLiInerNote;
  825. this.mainForm.greeReply = data.note1;
  826. this.mainForm.remark = data.remark;
  827. this.mainForm.createMan = data.createBy;
  828. this.mainForm.createDate = data.createTime;
  829. this.mainForm.fileNum = data.fileNo;
  830. this.mainForm.salesMan = data.serviceId;
  831. this.mainForm.projectRemark = data.refProjectNote;
  832. this.mainForm.projectType = data.refProjectType;
  833. data.items.forEach(item => {
  834. item.status1 = '';
  835. item.status2 = '';
  836. item.rebateWallets = item.customerWalletList.filter(item => {
  837. return item.type === 'REBATE';
  838. });
  839. item.wallets = item.customerWalletList.filter(item => {
  840. return item.type === 'COMMONLY';
  841. });
  842. })
  843. this.goodsList = data.items;
  844. })
  845. },
  846. // 获取商品列表
  847. getGoodsList() {
  848. getRetailProductList({
  849. pageNum: this.currentPage,
  850. pageSize: 10,
  851. saleId: this.mainForm.saleType,
  852. materialCode: this.goodsScreenForm.proNum,
  853. materialName: this.goodsScreenForm.proName,
  854. specification: this.goodsScreenForm.proModel,
  855. price1: this.goodsScreenForm.price1,
  856. price2: this.goodsScreenForm.price2,
  857. }).then(res => {
  858. let oldGoodsList = this.goodsList;
  859. let newGoodsList = res.data.records;
  860. for(let i = 0; i < oldGoodsList.length; i++) {
  861. let oldItem = oldGoodsList[i]
  862. for(let j = 0; j < newGoodsList.length; j++) {
  863. let newItem = newGoodsList[j]
  864. if(newItem.id === oldItem.id){
  865. newGoodsList[j].selected = true;
  866. break;
  867. }
  868. }
  869. }
  870. res.data.records.forEach(item => {
  871. item.materialName = item.name;
  872. item.materialCode = item.number;
  873. item.saleTypeName = item.saleName;
  874. item.unit = item.baseUnit;
  875. item.price = item.batchPrice;
  876. item.tax = item.taxRate;
  877. item.isDirectTransfer = false;
  878. item.directTransferQty = '';
  879. item.status1 = '';
  880. item.status2 = '';
  881. item.rebateAmount = '';
  882. item.rebateRate = '';
  883. item.productPriceId = item.id;
  884. item.customerWalletId = (item.wallets && item.wallets.length) ? item.wallets[0].customerWalletId : '';
  885. });
  886. this.leftGoodsList = res.data.records;
  887. this.listTotal = res.data.total;
  888. })
  889. },
  890. // 查询重复值并禁选
  891. checkboxSelect(row, rowIndex) {
  892. if (row.selected) {
  893. return false // 禁用
  894. }else{
  895. return true // 不禁用
  896. }
  897. },
  898. // 点击 选择商品
  899. openDialog() {
  900. if(!this.mainForm.saleType) {
  901. return this.$errorMsg('请先选择销售类型');
  902. }
  903. this.isShowGoodsDialog = true;
  904. this.getGoodsList();
  905. },
  906. // 提交筛选表单
  907. submitGoodsScreenForm() {
  908. this.currentPage = 1;
  909. this.getGoodsList();
  910. },
  911. // 重置筛选表单
  912. resetGoodsScreenForm() {
  913. this.$refs.goodsScreenForm.resetFields();
  914. this.currentPage = 1;
  915. this.getGoodsList();
  916. },
  917. // 更改列表当前页
  918. handleTableCurrentChange(val) {
  919. this.currentPage = val;
  920. this.getGoodsList();
  921. },
  922. // 关闭 弹窗
  923. closeDialog() {
  924. this.isShowGoodsDialog = false;
  925. },
  926. // 左侧列表选择
  927. leftSelectionChange(val) {
  928. this.leftSelection = val;
  929. },
  930. // 右侧列表选择
  931. rightSelectionChange(val) {
  932. this.rightSelection = val;
  933. },
  934. // 数组去重
  935. delRepeat(arr1, arr2) {
  936. let allArr = arr1.concat(arr2); // 两个数组对象合并
  937. let newArr = []; // 存放去重后数据的新数组
  938. for(let i=0; i<allArr.length; i++){ // 循环allArr数组对象的内容
  939. let flag = true; // 建立标记,判断数据是否重复,true为不重复
  940. for(let j=0; j<newArr.length; j++){ // 循环新数组的内容
  941. if(allArr[i].id == newArr[j].id){ // 让allArr数组对象的内容与新数组的内容作比较,相同的话,改变标记为false
  942. flag = false;
  943. }
  944. }
  945. if(flag){ // 判断是否重复
  946. newArr.push(allArr[i]); // 不重复的放入新数组。 新数组的内容会继续进行上边的循环。
  947. }
  948. }
  949. return newArr;
  950. },
  951. // 全部添加
  952. addAllGoods() {
  953. this.rightGoodsList = this.delRepeat(this.leftGoodsList, this.rightGoodsList);
  954. },
  955. // 添加
  956. addGoods() {
  957. this.rightGoodsList = this.delRepeat(this.leftSelection, this.rightGoodsList);
  958. },
  959. // 删除
  960. deleteGoods() {
  961. let rightGoodsList = this.rightGoodsList;
  962. let rightSelection = this.rightSelection;
  963. for(let i = 0; i < rightGoodsList.length; i++) {
  964. for(let j = 0; j < rightSelection.length; j++) {
  965. if(rightSelection[j].materialId == rightGoodsList[i].materialId){
  966. this.rightGoodsList.splice(i, 1);
  967. }
  968. }
  969. }
  970. },
  971. // 全部删除
  972. deleteAllGoods() {
  973. this.rightGoodsList = [];
  974. },
  975. // 确定 添加产品
  976. submitAddGoods() {
  977. // this.goodsList = this.delRepeat(this.rightGoodsList, this.goodsList);
  978. this.goodsList = this.goodsList.concat(this.rightGoodsList);
  979. this.isShowGoodsDialog = false;
  980. this.leftGoodsList = [];
  981. this.rightGoodsList = [];
  982. },
  983. // 检查库存
  984. checkStock() {
  985. if(!this.warehouseValue) {
  986. return this.$errorMsg('请选择仓库');
  987. }
  988. if(!this.goodsList) {
  989. return this.$errorMsg('请添加货品');
  990. }
  991. let ids = [];
  992. this.goodsList.forEach(item => {
  993. ids.push(item.materialId);
  994. })
  995. checkStock({
  996. correspondId: this.warehouseValue,
  997. materialId: ids.join(',')
  998. }).then(res => {
  999. if(res.data) {
  1000. this.goodsList.forEach((item, index) => {
  1001. item.status1 = res.data[index].allStockNum;
  1002. item.status2 = res.data[index].stockNum;
  1003. })
  1004. }
  1005. })
  1006. },
  1007. status2Filter(item) {
  1008. if (item.status2 === '' || item.status2 === null || item.status2 === undefined) return '未检查';
  1009. else if (item.status2 <= 0) return '无货';
  1010. else if (item.status2 >= item.qty) return '可用';
  1011. else return '短缺';
  1012. },
  1013. // 保存 / 提交审核
  1014. clickSubmitForm(type) {
  1015. this.$refs.mainForm.validate((valid) => {
  1016. if (valid) {
  1017. for(let i=0; i<this.goodsList.length; i++) {
  1018. if(!this.goodsList[i].customerWalletId) {
  1019. this.$errorMsg('请选择现金钱包');
  1020. return;
  1021. }
  1022. }
  1023. let goodsList = JSON.parse(JSON.stringify(this.goodsList));
  1024. goodsList.forEach(item => {
  1025. delete item.rebateWallets;
  1026. delete item.wallets;
  1027. })
  1028. let saleTypeItem = this.salesTypeList.find(o => o.id == this.mainForm.saleType);
  1029. let saleManItem = this.mainForm.salesMan ? this.salesmanList.find(o => o.adminUserId == this.mainForm.salesMan) : '';
  1030. let params = {
  1031. enginOrderId: this.mainForm.orderNum,
  1032. // orderDate: this.mainForm.orderDate,
  1033. // mainId: this.mainForm.type || '',
  1034. loginUserId: this.mainForm.loginUserId,
  1035. refEnginRecordNo: this.mainForm.loginNum || '',
  1036. refProjectName: this.mainForm.enginName || '',
  1037. refPromiseStatus: this.mainForm.loginType || '',
  1038. refFactoryNo: this.mainForm.factoryNum || '',
  1039. refUseUnit: this.mainForm.company || '',
  1040. refLinkman: this.mainForm.contactMan || '',
  1041. refTel: this.mainForm.tel || '',
  1042. refPhone: this.mainForm.phone || '',
  1043. refInstallAddress: this.mainForm.address || '',
  1044. refDeclareNo: this.mainForm.declareNo || '',
  1045. saleTypeId: this.mainForm.saleType,
  1046. saleTypeCode: saleTypeItem.saleCode,
  1047. saleTypeName: saleTypeItem.saleName,
  1048. geLiInerNote: this.mainForm.greeRemark || '',
  1049. geLiNote: this.mainForm.greeReply || '',
  1050. remark: this.mainForm.remark || '',
  1051. fileNo: this.mainForm.fileNum || '',
  1052. serviceId: this.mainForm.salesMan,
  1053. serviceName: saleManItem.nickName,
  1054. refProjectNote: this.mainForm.projectRemark,
  1055. refProjectType: this.mainForm.projectType,
  1056. refTradeCategory: this.mainForm.tradeCategory,
  1057. items: goodsList,
  1058. }
  1059. this.formLoading = true;
  1060. if(type === 1) {
  1061. if(this.listItem) {
  1062. editHome(params).then(res => {
  1063. this.$successMsg('编辑成功');
  1064. this.goBack();
  1065. this.$parent.getList();
  1066. }).finally(res => {
  1067. this.formLoading = false;
  1068. })
  1069. }else {
  1070. addHome(params).then(res => {
  1071. this.$successMsg('新增成功');
  1072. this.goBack();
  1073. this.$parent.getList();
  1074. }).finally(res => {
  1075. this.formLoading = false;
  1076. })
  1077. }
  1078. }else if(type === 2) {
  1079. submitHome(params).then(res => {
  1080. this.$successMsg('提交审核成功');
  1081. this.goBack();
  1082. this.$parent.getList();
  1083. }).finally(res => {
  1084. this.formLoading = false;
  1085. })
  1086. }
  1087. }
  1088. })
  1089. },
  1090. }
  1091. }
  1092. </script>
  1093. <style scoped lang="scss">
  1094. .detail-container {
  1095. width: 100%;
  1096. height: 100%;
  1097. }
  1098. .main-title {
  1099. display: flex;
  1100. justify-content: space-between;
  1101. align-items: center;
  1102. margin-top: 20px;
  1103. height: 60px;
  1104. border-bottom: 1px solid #DCDFE6;
  1105. margin-bottom: 20px;
  1106. .title {
  1107. font-size: 16px;
  1108. font-weight: 600;
  1109. padding-left: 10px;
  1110. }
  1111. }
  1112. .tables {
  1113. display: flex;
  1114. margin-top: 10px;
  1115. .table {
  1116. width: 45%;
  1117. }
  1118. .buttons {
  1119. display: flex;
  1120. flex-direction: column;
  1121. justify-content: center;
  1122. align-items: center;
  1123. padding: 0 10px;
  1124. button {
  1125. margin: 0;
  1126. margin-top: 10px;
  1127. }
  1128. }
  1129. }
  1130. ::v-deep input::-webkit-outer-spin-button,
  1131. ::v-deep input::-webkit-inner-spin-button {
  1132. -webkit-appearance: none;
  1133. }
  1134. ::v-deep input[type='number'] {
  1135. -moz-appearance: textfield;
  1136. }
  1137. </style>