home_form.vue 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212
  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. },
  493. mainFormRules: {
  494. // orderDate: [{ required: true, message: '请选择单据日期', trigger: 'change' }],
  495. jxsNum: [{ required: true, message: '请输入经销商编码', trigger: 'blur' }],
  496. jxsName: [{ required: true, message: '请输入经销商名称', trigger: 'blur' }],
  497. loginNum: [{ required: true, message: '请输入工程登录编号', trigger: 'blur' }],
  498. // enginName: [{ required: true, message: '请输入项目类别', trigger: 'blur' }],
  499. // loginType: [{ required: true, message: '请输入行业类别', trigger: 'blur' }],
  500. company: [{ required: true, message: '请输入使用单位', trigger: 'blur' }],
  501. saleType: [{ required: true, message: '请选择销售类型', trigger: 'change' }],
  502. // contactMan: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
  503. // tel: [{ required: true, message: '请输入固定电话', trigger: 'blur' }],
  504. // phone: [{ required: true, message: '请输入移动电话', trigger: 'blur' }],
  505. address: [{ required: true, message: '请输入安装地址', trigger: 'blur' }],
  506. },
  507. salesTypeList: [],
  508. // typeList: [],
  509. stockList: [],
  510. goodsList: [],
  511. isShowDialog: false, // 工程登录列表 - 弹窗
  512. screenForm: {
  513. loginNum: '',
  514. enginName: '',
  515. company: '',
  516. },
  517. dialogTable_dataList: null, // 工程登录列表 - 列表数据
  518. dialogTable_listLoading: true, // 工程登录列表 - 列表加载loading
  519. dialogTable_currentPage: 1, // 工程登录列表 - 当前页码
  520. dialogTable_pageSize: 10, // 工程登录列表 - 每页数量
  521. dialogTable_listTotal: 0, // 工程登录列表 - 列表总数
  522. warehouseList: [],
  523. warehouseValue: '',
  524. isShowGoodsDialog: false,
  525. goodsScreenForm: {
  526. proNum: '',
  527. proName: '',
  528. proModel: '',
  529. price1: '',
  530. price2: '',
  531. },
  532. currentPage: 1,
  533. listTotal: 0,
  534. leftGoodsList: [],
  535. rightGoodsList: [],
  536. leftSelection: [],
  537. rightSelection: [],
  538. formLoading: false,
  539. isFirst: false,
  540. salesmanList: [],
  541. }
  542. },
  543. computed: {
  544. isDealer() {
  545. return JSON.parse(localStorage.getItem("supply_user")).isCustomer
  546. },
  547. outSalesmanList() {
  548. let list = [];
  549. if(this.goodsList && this.goodsList.length) {
  550. this.goodsList.forEach(item => {
  551. if(item.serviceId) {
  552. let hasItem = findElem(list, 'adminUserId', item.serviceId);
  553. if(hasItem < 0) {
  554. let obj = this.salesmanList.find(o => o.adminUserId == item.serviceId);
  555. if(obj) {
  556. list.push(obj);
  557. }
  558. }
  559. }
  560. })
  561. if(this.isFirst) {
  562. this.isFirst = false;
  563. }else {
  564. this.mainForm.salesMan = this.goodsList[0].serviceId;
  565. }
  566. }
  567. return list
  568. }
  569. },
  570. watch: {
  571. goodsList: {
  572. handler(newValue, oldValue) {
  573. if(this.goodsList && this.goodsList.length) {
  574. if(this.isFirst) {
  575. this.isFirst = false;
  576. }else {
  577. this.mainForm.salesMan = this.goodsList[0].serviceId;
  578. }
  579. }else {
  580. this.mainForm.salesMan = '';
  581. }
  582. },
  583. immediate: true,
  584. deep: true
  585. }
  586. },
  587. beforeCreate() {
  588. that = this;
  589. },
  590. async created() {
  591. await this.getSalesmanList();
  592. this.getDictList();
  593. this.getSalesTypeList();
  594. this.getWarehouseList();
  595. if(this.listItem) {
  596. this.isFirst = true;
  597. this.editId = this.listItem.parentId;
  598. this.getDetail();
  599. }else {
  600. this.mainForm.jxsNum = JSON.parse(localStorage.getItem("supply_user")).customerNumber;
  601. this.mainForm.jxsName = JSON.parse(localStorage.getItem("supply_user")).customerName;
  602. this.mainForm.createMan = JSON.parse(localStorage.getItem("supply_user")).nickName;
  603. this.mainForm.createDate = this.getDate();
  604. }
  605. },
  606. methods: {
  607. // 返回列表
  608. goBack() {
  609. this.$emit('backListFormDetail');
  610. },
  611. getDate() {
  612. var date = new Date();
  613. var seperator1 = "-";
  614. var year = date.getFullYear();
  615. var month = date.getMonth() + 1;
  616. var strDate = date.getDate();
  617. if (month >= 1 && month <= 9) {
  618. month = "0" + month;
  619. }
  620. if (strDate >= 0 && strDate <= 9) {
  621. strDate = "0" + strDate;
  622. }
  623. var currentdate = year + seperator1 + month + seperator1 + strDate;
  624. return currentdate;
  625. },
  626. // 获取产品大类列表
  627. getDictList() {
  628. // getDictList({sysDictEnum: 'PRODUCT_TYPE'}).then(res => {
  629. // this.typeList = res.data;
  630. // })
  631. getDictList({sysDictEnum: 'STOCK_ORDER'}).then(res => {
  632. this.stockList = res.data;
  633. })
  634. },
  635. // 获取销售类型列表
  636. getSalesTypeList() {
  637. getTypeList({
  638. pageNum: 1,
  639. pageSize: -1
  640. }).then((res) => {
  641. this.salesTypeList = res.data.records;
  642. })
  643. },
  644. // 获取仓库列表
  645. getWarehouseList() {
  646. getWarehouseList({
  647. pageNum: 1,
  648. pageSize: -1
  649. }).then((res) => {
  650. this.warehouseList = res.data.records;
  651. })
  652. },
  653. async getSalesmanList() {
  654. const res = await getSalesmanList({
  655. pageNum: 1,
  656. pageSize: -1,
  657. isCustomer: 0,
  658. status: true,
  659. });
  660. this.salesmanList = res.data.records;
  661. },
  662. // 工程登录列表 - 获取列表
  663. getHomeLoginList() {
  664. getHomeLoginList({
  665. pageNum: this.dialogTable_currentPage,
  666. pageSize: this.dialogTable_pageSize,
  667. recordNo: this.screenForm.loginNum,
  668. projectName: this.screenForm.enginName,
  669. useUnit: this.screenForm.company,
  670. examineStatus: 'OK'
  671. }).then(res => {
  672. this.dialogTable_dataList = res.data.records;
  673. this.dialogTable_listTotal = res.data.total;
  674. this.dialogTable_listLoading = false;
  675. })
  676. },
  677. // 工程登录列表 - 打开弹窗
  678. openShareDetail() {
  679. if(!this.mainForm.saleType) {
  680. return this.$errorMsg('请先选择销售类型');
  681. }
  682. this.isShowDialog = true;
  683. this.dialogTable_currentPage = 1;
  684. this.screenForm.loginNum = this.mainForm.loginNum;
  685. this.getHomeLoginList();
  686. },
  687. // 工程登录列表 - 更改列表当前页
  688. dialogTableCurrentChange(val) {
  689. this.dialogTable_currentPage = val;
  690. this.getHomeLoginList();
  691. },
  692. // 提交筛选表单
  693. submitScreenForm() {
  694. this.dialogTable_currentPage = 1;
  695. this.getHomeLoginList();
  696. },
  697. // 重置筛选表单
  698. resetScreenForm() {
  699. this.$refs.screenForm.resetFields();
  700. this.dialogTable_currentPage = 1;
  701. this.getHomeLoginList();
  702. },
  703. // 选择工程登录
  704. chooseItem(id, uid) {
  705. getHomeLoginDetail({
  706. recordNo: id,
  707. saleTypeId: this.mainForm.saleType,
  708. userId: uid,
  709. enginOrderId: this.mainForm.orderNum
  710. }).then(res => {
  711. this.isShowDialog = false;
  712. let data = res.data;
  713. this.mainForm.type = data.productCategory;
  714. this.mainForm.loginUserId = data.userid;
  715. // this.mainForm.saleType = '';
  716. this.mainForm.loginNum = data.recordNo;
  717. this.mainForm.enginName = data.projectName;
  718. this.mainForm.loginType = data.promiseStatus;
  719. this.mainForm.company = data.useUnit;
  720. this.mainForm.contactMan = data.buyUnitCallMen;
  721. this.mainForm.tel = data.buyUnitTel;
  722. this.mainForm.phone = data.buyUnitPhone;
  723. this.mainForm.address = data.installAddress;
  724. this.mainForm.declareNo = data.declareNo;
  725. this.mainForm.projectRemark = data.buChonShuoMing;
  726. this.mainForm.projectType = data.govBuyType;
  727. let saleTypeItem = this.salesTypeList.find(o => o.id == this.mainForm.saleType);
  728. this.goodsList = data.items.map(item => {
  729. return {
  730. useRefCount: item.useRefCount,
  731. saleTypeId: saleTypeItem.id,
  732. saleTypeCode: saleTypeItem.saleCode,
  733. saleTypeName: saleTypeItem.saleName,
  734. materialId: item.materialId,
  735. materialNumber: item.materialNumber,
  736. materialOldNumber: item.materialOldNumber,
  737. materialName: item.materialName,
  738. specification: item.machine,
  739. enginNum: item.num,
  740. enginPrice: item.price,
  741. enginTotality: item.totality,
  742. historyHasDeliverQty: item.hasDeliverQty,
  743. unit: item.unit,
  744. price: item.price,
  745. qty: item.num,
  746. customerWalletId2: '',
  747. rebateRate: '',
  748. discAmount: '',
  749. customerWalletId: '',
  750. isDirectTransfer: false,
  751. directTransferQty: '',
  752. hasSendQty: '',
  753. remark: item.discri,
  754. tax: '',
  755. status1: '',
  756. status2: '',
  757. rebateWallets: item.customerWalletList.filter(item => {
  758. return item.type === 'REBATE';
  759. }),
  760. wallets: item.customerWalletList.filter(item => {
  761. return item.type === 'COMMONLY';
  762. }),
  763. }
  764. })
  765. this.goodsList.forEach(item => {
  766. item.customerWalletId = (item.wallets && item.wallets.length) ? item.wallets[0].customerWalletId : '';
  767. item.serviceId = (item.wallets && item.wallets.length) ? item.wallets[0].serviceId : '';
  768. item.serviceName = (item.wallets && item.wallets.length) ? item.wallets[0].serviceName : '';
  769. })
  770. })
  771. },
  772. // 选择销售类型
  773. changeSaleType() {
  774. if(this.mainForm.loginNum) {
  775. this.chooseItem(this.mainForm.loginNum, this.mainForm.loginUserId);
  776. }
  777. },
  778. // 删除产品
  779. deleteItem(index) {
  780. this.goodsList.splice(index, 1);
  781. },
  782. // 修改返利钱包
  783. changeFlWallet(index) {
  784. if(this.goodsList[index].customerWalletId2) {
  785. let obj = this.goodsList[index].rebateWallets.find(o => o.customerWalletId == this.goodsList[index].customerWalletId2);
  786. this.goodsList[index].rebateRate = obj.rebateRate;
  787. this.goodsList[index].customerWalletName2 = obj.customerWalletName;
  788. }else {
  789. this.goodsList[index].rebateRate = '';
  790. this.goodsList[index].customerWalletName2 = '';
  791. }
  792. },
  793. // 修改现金钱包
  794. changeXjWallet(index) {
  795. if(this.goodsList[index].customerWalletId) {
  796. let obj = this.goodsList[index].wallets.find(o => o.customerWalletId == this.goodsList[index].customerWalletId);
  797. this.goodsList[index].customerWalletName = obj.customerWalletName;
  798. }else {
  799. this.goodsList[index].customerWalletName = '';
  800. }
  801. },
  802. // 获取详情
  803. getDetail() {
  804. getOrderDetail({id: this.editId}).then(res => {
  805. let data = res.data;
  806. this.mainForm.orderNum = data.enginOrderId;
  807. this.mainForm.orderDate = data.orderDate;
  808. this.mainForm.type = data.mainId;
  809. this.mainForm.jxsNum = data.customerNumber;
  810. this.mainForm.jxsName = data.customerName;
  811. this.mainForm.loginNum = data.refEnginRecordNo;
  812. this.mainForm.enginName = data.refProjectName;
  813. this.mainForm.loginType = data.refPromiseStatus;
  814. this.mainForm.factoryNum = data.refFactoryNo;
  815. this.mainForm.company = data.refUseUnit;
  816. this.mainForm.saleType = data.saleTypeId;
  817. this.mainForm.contactMan = data.refLinkman;
  818. this.mainForm.tel = data.refTel;
  819. this.mainForm.phone = data.refPhone;
  820. this.mainForm.address = data.refInstallAddress;
  821. this.mainForm.declareNo = data.refDeclareNo;
  822. this.mainForm.greeRemark = data.geLiInerNote;
  823. this.mainForm.greeReply = data.note1;
  824. this.mainForm.remark = data.remark;
  825. this.mainForm.createMan = data.createName;
  826. this.mainForm.createDate = data.createTime;
  827. this.mainForm.fileNum = data.fileNo;
  828. this.mainForm.salesMan = data.serviceId;
  829. this.mainForm.projectRemark = data.refProjectNote;
  830. this.mainForm.projectType = data.refProjectType;
  831. data.items.forEach(item => {
  832. item.status1 = '';
  833. item.status2 = '';
  834. item.rebateWallets = item.customerWalletList.filter(item => {
  835. return item.type === 'REBATE';
  836. });
  837. item.wallets = item.customerWalletList.filter(item => {
  838. return item.type === 'COMMONLY';
  839. });
  840. })
  841. this.goodsList = data.items;
  842. })
  843. },
  844. // 获取商品列表
  845. getGoodsList() {
  846. getRetailProductList({
  847. pageNum: this.currentPage,
  848. pageSize: 10,
  849. saleId: this.mainForm.saleType,
  850. materialCode: this.goodsScreenForm.proNum,
  851. materialName: this.goodsScreenForm.proName,
  852. specification: this.goodsScreenForm.proModel,
  853. price1: this.goodsScreenForm.price1,
  854. price2: this.goodsScreenForm.price2,
  855. }).then(res => {
  856. let oldGoodsList = this.goodsList;
  857. let newGoodsList = res.data.records;
  858. for(let i = 0; i < oldGoodsList.length; i++) {
  859. let oldItem = oldGoodsList[i]
  860. for(let j = 0; j < newGoodsList.length; j++) {
  861. let newItem = newGoodsList[j]
  862. if(newItem.id === oldItem.id){
  863. newGoodsList[j].selected = true;
  864. break;
  865. }
  866. }
  867. }
  868. res.data.records.forEach(item => {
  869. item.materialName = item.name;
  870. item.materialCode = item.number;
  871. item.saleTypeName = item.saleName;
  872. item.unit = item.baseUnit;
  873. item.price = item.batchPrice;
  874. item.tax = item.taxRate;
  875. item.isDirectTransfer = false;
  876. item.directTransferQty = '';
  877. item.status1 = '';
  878. item.status2 = '';
  879. item.rebateAmount = '';
  880. item.rebateRate = '';
  881. item.productPriceId = item.id;
  882. item.customerWalletId = (item.wallets && item.wallets.length) ? item.wallets[0].customerWalletId : '';
  883. });
  884. this.leftGoodsList = res.data.records;
  885. this.listTotal = res.data.total;
  886. })
  887. },
  888. // 查询重复值并禁选
  889. checkboxSelect(row, rowIndex) {
  890. if (row.selected) {
  891. return false // 禁用
  892. }else{
  893. return true // 不禁用
  894. }
  895. },
  896. // 点击 选择商品
  897. openDialog() {
  898. if(!this.mainForm.saleType) {
  899. return this.$errorMsg('请先选择销售类型');
  900. }
  901. this.isShowGoodsDialog = true;
  902. this.getGoodsList();
  903. },
  904. // 提交筛选表单
  905. submitGoodsScreenForm() {
  906. this.currentPage = 1;
  907. this.getGoodsList();
  908. },
  909. // 重置筛选表单
  910. resetGoodsScreenForm() {
  911. this.$refs.goodsScreenForm.resetFields();
  912. this.currentPage = 1;
  913. this.getGoodsList();
  914. },
  915. // 更改列表当前页
  916. handleTableCurrentChange(val) {
  917. this.currentPage = val;
  918. this.getGoodsList();
  919. },
  920. // 关闭 弹窗
  921. closeDialog() {
  922. this.isShowGoodsDialog = false;
  923. },
  924. // 左侧列表选择
  925. leftSelectionChange(val) {
  926. this.leftSelection = val;
  927. },
  928. // 右侧列表选择
  929. rightSelectionChange(val) {
  930. this.rightSelection = val;
  931. },
  932. // 数组去重
  933. delRepeat(arr1, arr2) {
  934. let allArr = arr1.concat(arr2); // 两个数组对象合并
  935. let newArr = []; // 存放去重后数据的新数组
  936. for(let i=0; i<allArr.length; i++){ // 循环allArr数组对象的内容
  937. let flag = true; // 建立标记,判断数据是否重复,true为不重复
  938. for(let j=0; j<newArr.length; j++){ // 循环新数组的内容
  939. if(allArr[i].id == newArr[j].id){ // 让allArr数组对象的内容与新数组的内容作比较,相同的话,改变标记为false
  940. flag = false;
  941. }
  942. }
  943. if(flag){ // 判断是否重复
  944. newArr.push(allArr[i]); // 不重复的放入新数组。 新数组的内容会继续进行上边的循环。
  945. }
  946. }
  947. return newArr;
  948. },
  949. // 全部添加
  950. addAllGoods() {
  951. this.rightGoodsList = this.delRepeat(this.leftGoodsList, this.rightGoodsList);
  952. },
  953. // 添加
  954. addGoods() {
  955. this.rightGoodsList = this.delRepeat(this.leftSelection, this.rightGoodsList);
  956. },
  957. // 删除
  958. deleteGoods() {
  959. let rightGoodsList = this.rightGoodsList;
  960. let rightSelection = this.rightSelection;
  961. for(let i = 0; i < rightGoodsList.length; i++) {
  962. for(let j = 0; j < rightSelection.length; j++) {
  963. if(rightSelection[j].materialId == rightGoodsList[i].materialId){
  964. this.rightGoodsList.splice(i, 1);
  965. }
  966. }
  967. }
  968. },
  969. // 全部删除
  970. deleteAllGoods() {
  971. this.rightGoodsList = [];
  972. },
  973. // 确定 添加产品
  974. submitAddGoods() {
  975. // this.goodsList = this.delRepeat(this.rightGoodsList, this.goodsList);
  976. this.goodsList = this.goodsList.concat(this.rightGoodsList);
  977. this.isShowGoodsDialog = false;
  978. this.leftGoodsList = [];
  979. this.rightGoodsList = [];
  980. },
  981. // 检查库存
  982. checkStock() {
  983. if(!this.warehouseValue) {
  984. return this.$errorMsg('请选择仓库');
  985. }
  986. if(!this.goodsList) {
  987. return this.$errorMsg('请添加货品');
  988. }
  989. let ids = [];
  990. this.goodsList.forEach(item => {
  991. ids.push(item.materialId);
  992. })
  993. checkStock({
  994. correspondId: this.warehouseValue,
  995. materialId: ids.join(',')
  996. }).then(res => {
  997. if(res.data) {
  998. this.goodsList.forEach((item, index) => {
  999. item.status1 = res.data[index].allStockNum;
  1000. item.status2 = res.data[index].stockNum;
  1001. })
  1002. }
  1003. })
  1004. },
  1005. status2Filter(item) {
  1006. if (item.status2 === '' || item.status2 === null || item.status2 === undefined) return '未检查';
  1007. else if (item.status2 <= 0) return '无货';
  1008. else if (item.status2 >= item.qty) return '可用';
  1009. else return '短缺';
  1010. },
  1011. // 保存 / 提交审核
  1012. clickSubmitForm(type) {
  1013. this.$refs.mainForm.validate((valid) => {
  1014. if (valid) {
  1015. for(let i=0; i<this.goodsList.length; i++) {
  1016. if(!this.goodsList[i].customerWalletId) {
  1017. this.$errorMsg('请选择现金钱包');
  1018. return;
  1019. }
  1020. }
  1021. let goodsList = JSON.parse(JSON.stringify(this.goodsList));
  1022. goodsList.forEach(item => {
  1023. delete item.rebateWallets;
  1024. delete item.wallets;
  1025. })
  1026. let saleTypeItem = this.salesTypeList.find(o => o.id == this.mainForm.saleType);
  1027. let saleManItem = this.mainForm.salesMan ? this.salesmanList.find(o => o.adminUserId == this.mainForm.salesMan) : '';
  1028. let params = {
  1029. enginOrderId: this.mainForm.orderNum,
  1030. // orderDate: this.mainForm.orderDate,
  1031. // mainId: this.mainForm.type || '',
  1032. loginUserId: this.mainForm.loginUserId,
  1033. refEnginRecordNo: this.mainForm.loginNum || '',
  1034. refProjectName: this.mainForm.enginName || '',
  1035. refPromiseStatus: this.mainForm.loginType || '',
  1036. refFactoryNo: this.mainForm.factoryNum || '',
  1037. refUseUnit: this.mainForm.company || '',
  1038. refLinkman: this.mainForm.contactMan || '',
  1039. refTel: this.mainForm.tel || '',
  1040. refPhone: this.mainForm.phone || '',
  1041. refInstallAddress: this.mainForm.address || '',
  1042. refDeclareNo: this.mainForm.declareNo || '',
  1043. saleTypeId: this.mainForm.saleType,
  1044. saleTypeCode: saleTypeItem.saleCode,
  1045. saleTypeName: saleTypeItem.saleName,
  1046. geLiInerNote: this.mainForm.greeRemark || '',
  1047. note1: this.mainForm.greeReply || '',
  1048. remark: this.mainForm.remark || '',
  1049. fileNo: this.mainForm.fileNum || '',
  1050. serviceId: this.mainForm.salesMan,
  1051. serviceName: saleManItem.nickName,
  1052. refProjectNote: this.mainForm.projectRemark,
  1053. refProjectType: this.mainForm.projectType,
  1054. items: goodsList,
  1055. }
  1056. this.formLoading = true;
  1057. if(type === 1) {
  1058. if(this.listItem) {
  1059. editHome(params).then(res => {
  1060. this.$successMsg('编辑成功');
  1061. this.goBack();
  1062. this.$parent.getList();
  1063. }).finally(res => {
  1064. this.formLoading = false;
  1065. })
  1066. }else {
  1067. addHome(params).then(res => {
  1068. this.$successMsg('新增成功');
  1069. this.goBack();
  1070. this.$parent.getList();
  1071. }).finally(res => {
  1072. this.formLoading = false;
  1073. })
  1074. }
  1075. }else if(type === 2) {
  1076. submitHome(params).then(res => {
  1077. this.$successMsg('提交审核成功');
  1078. this.goBack();
  1079. this.$parent.getList();
  1080. }).finally(res => {
  1081. this.formLoading = false;
  1082. })
  1083. }
  1084. }
  1085. })
  1086. },
  1087. }
  1088. }
  1089. </script>
  1090. <style scoped lang="scss">
  1091. .detail-container {
  1092. width: 100%;
  1093. height: 100%;
  1094. }
  1095. .main-title {
  1096. display: flex;
  1097. justify-content: space-between;
  1098. align-items: center;
  1099. margin-top: 20px;
  1100. height: 60px;
  1101. border-bottom: 1px solid #DCDFE6;
  1102. margin-bottom: 20px;
  1103. .title {
  1104. font-size: 16px;
  1105. font-weight: 600;
  1106. padding-left: 10px;
  1107. }
  1108. }
  1109. .tables {
  1110. display: flex;
  1111. margin-top: 10px;
  1112. .table {
  1113. width: 45%;
  1114. }
  1115. .buttons {
  1116. display: flex;
  1117. flex-direction: column;
  1118. justify-content: center;
  1119. align-items: center;
  1120. padding: 0 10px;
  1121. button {
  1122. margin: 0;
  1123. margin-top: 10px;
  1124. }
  1125. }
  1126. }
  1127. ::v-deep input::-webkit-outer-spin-button,
  1128. ::v-deep input::-webkit-inner-spin-button {
  1129. -webkit-appearance: none;
  1130. }
  1131. ::v-deep input[type='number'] {
  1132. -moz-appearance: textfield;
  1133. }
  1134. </style>