home_form.vue 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830
  1. <template>
  2. <div class="detail-container">
  3. <el-page-header :content="listItem ? '编辑' : '新增'" @back="goBack" />
  4. <div class="main-title">
  5. <div class="title">工程订单</div>
  6. </div>
  7. <el-form
  8. ref="mainForm"
  9. :model="mainForm"
  10. :rules="mainFormRules"
  11. label-width="125px"
  12. size="small"
  13. label-position="right"
  14. >
  15. <el-row :gutter="20">
  16. <el-col :xs="24" :sm="12" :lg="8">
  17. <el-form-item label="工程订单" prop="orderNum">
  18. <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" disabled />
  19. </el-form-item>
  20. </el-col>
  21. <el-col :xs="24" :sm="12" :lg="8" style="height: 51px">
  22. <el-form-item label="单据日期" prop="orderDate">
  23. <el-date-picker
  24. v-model="mainForm.orderDate"
  25. disabled
  26. type="date"
  27. value-format="yyyy-MM-dd"
  28. style="width: 100%"
  29. placeholder="系统自动生成"
  30. />
  31. </el-form-item>
  32. </el-col>
  33. <el-col :xs="24" :sm="12" :lg="8">
  34. <el-form-item label="销售类型" prop="saleType">
  35. <el-select
  36. v-model="mainForm.saleType"
  37. placeholder="选择销售类型"
  38. style="width: 100%"
  39. filterable
  40. clearable
  41. @change="changeSaleType"
  42. >
  43. <el-option v-for="item in salesTypeList" :key="item.id" :label="item.saleName" :value="item.id">
  44. <span>{{ item.saleName }}</span> <span style="color: #f00">{{ item.saleCode }}</span>
  45. </el-option>
  46. </el-select>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :xs="24" :sm="12" :lg="8">
  50. <el-form-item label="经销商编码" prop="jxsNum">
  51. <el-input v-model="mainForm.jxsNum" placeholder="请输入经销商编码" disabled />
  52. </el-form-item>
  53. </el-col>
  54. <el-col :xs="24" :sm="12" :lg="16">
  55. <el-form-item label="经销商名称" prop="jxsName">
  56. <el-input v-model="mainForm.jxsName" placeholder="请输入经销商名称" disabled />
  57. </el-form-item>
  58. </el-col>
  59. <el-col :xs="24" :sm="12" :lg="8">
  60. <el-form-item label="工程登录编号" prop="loginNum">
  61. <div style="display: flex">
  62. <el-input v-model="mainForm.loginNum" placeholder="请引用工程登录" disabled />
  63. <el-button style="margin-left: 10px" @click="openShareDetail">引用</el-button>
  64. </div>
  65. </el-form-item>
  66. </el-col>
  67. <el-col :xs="24" :sm="12" :lg="8">
  68. <el-form-item label="项目类别" prop="enginName">
  69. <el-input v-model="mainForm.enginName" placeholder="请输入项目类别" :disabled="isDealer" />
  70. </el-form-item>
  71. </el-col>
  72. <el-col :xs="24" :sm="12" :lg="8">
  73. <el-form-item label="行业类别" prop="loginType">
  74. <el-input v-model="mainForm.loginType" :disabled="isDealer" placeholder="请输入行业类别" />
  75. </el-form-item>
  76. </el-col>
  77. <el-col :xs="24" :sm="12" :lg="8">
  78. <el-form-item label="跨区厂编号" prop="factoryNum">
  79. <el-input v-model="mainForm.factoryNum" placeholder="请输入跨区厂编号" :disabled="isDealer" />
  80. </el-form-item>
  81. </el-col>
  82. <el-col :xs="24" :sm="12" :lg="8">
  83. <el-form-item label="使用单位" prop="company">
  84. <el-input v-model="mainForm.company" placeholder="请输入使用单位" :disabled="isDealer" />
  85. </el-form-item>
  86. </el-col>
  87. <el-col :xs="24" :sm="12" :lg="8">
  88. <el-form-item label="业务员" prop="salesMan">
  89. <el-select
  90. v-model="mainForm.salesMan"
  91. placeholder="选择业务员"
  92. size="small"
  93. filterable
  94. clearable
  95. style="width: 100%"
  96. >
  97. <el-option
  98. v-for="item in salesmanList"
  99. :key="item.adminUserId"
  100. :label="item.nickName"
  101. :value="item.adminUserId"
  102. />
  103. </el-select>
  104. </el-form-item>
  105. </el-col>
  106. <el-col :xs="24" :sm="12" :lg="8">
  107. <el-form-item label="引用记录" prop="refCount">
  108. <el-input v-model="mainForm.refCount" placeholder="请输入引用记录" :disabled="isDealer" />
  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="请输入第几申报" :disabled="isDealer" />
  114. </el-form-item>
  115. </el-col>
  116. <el-col :xs="24" :sm="12" :lg="8">
  117. <el-form-item label="项目类型" prop="projectType">
  118. <el-input v-model="mainForm.projectType" placeholder="请输入项目类型" :disabled="isDealer" />
  119. </el-form-item>
  120. </el-col>
  121. <el-col :xs="24" :sm="12" :lg="8">
  122. <el-form-item label="区域" prop="regionWork">
  123. <el-input v-model="mainForm.regionWork" placeholder="请输入区域" :disabled="isDealer" />
  124. </el-form-item>
  125. </el-col>
  126. <el-col :xs="24" :sm="12" :lg="8">
  127. <el-form-item label="文件编号" prop="fileNum">
  128. <el-input v-model="mainForm.fileNum" placeholder="请输入文件编号" :disabled="isDealer" />
  129. </el-form-item>
  130. </el-col>
  131. <el-col :xs="24" :sm="12" :lg="8">
  132. <el-form-item label="购买单位" prop="refBuyUnitName">
  133. <el-input v-model="mainForm.refBuyUnitName" placeholder="请输入购买单位" :disabled="isDealer" />
  134. </el-form-item>
  135. </el-col>
  136. <el-col :xs="24" :sm="12" :lg="8">
  137. <el-form-item label="联系人" prop="contactMan">
  138. <el-input v-model="mainForm.contactMan" placeholder="请输入联系人" />
  139. </el-form-item>
  140. </el-col>
  141. <el-col :xs="24" :sm="12" :lg="8">
  142. <el-form-item label="固定电话" prop="tel">
  143. <el-input v-model="mainForm.tel" placeholder="请输入固定电话" />
  144. </el-form-item>
  145. </el-col>
  146. <el-col :xs="24" :sm="12" :lg="8">
  147. <el-form-item label="移动电话" prop="phone">
  148. <el-input v-model="mainForm.phone" placeholder="请输入移动电话" />
  149. </el-form-item>
  150. </el-col>
  151. <el-col :xs="24" :sm="16" :lg="16">
  152. <el-form-item label="安装地址" prop="address">
  153. <el-input v-model="mainForm.address" placeholder="请输入安装地址" :disabled="isDealer" />
  154. </el-form-item>
  155. </el-col>
  156. <el-col :xs="24" :sm="8" :lg="8">
  157. <el-form-item label="保证函" prop="refPromiseProvide">
  158. <el-select
  159. v-model="mainForm.refPromiseProvide"
  160. placeholder="选择保证函状态"
  161. :disabled="isDealer ? true : false"
  162. size="small"
  163. clearable
  164. style="width: 100%"
  165. >
  166. <el-option label="未保证" value="未保证" />
  167. <el-option label="已保证" value="已保证" />
  168. </el-select>
  169. </el-form-item>
  170. </el-col>
  171. <el-col :xs="24" :sm="24" :lg="24">
  172. <el-form-item label="项目说明" prop="projectRemark">
  173. <el-input v-model="mainForm.projectRemark" placeholder="请输入项目说明" :disabled="isDealer" />
  174. </el-form-item>
  175. </el-col>
  176. <el-col :xs="24" :sm="24" :lg="24">
  177. <el-form-item label="其他附件审批意见" prop="refOtherAnnexIdea">
  178. <el-input v-model="mainForm.refOtherAnnexIdea" placeholder="请输入其他附件审批意见" disabled />
  179. </el-form-item>
  180. </el-col>
  181. <el-col v-if="!isDealer" :xs="24" :sm="24" :lg="24">
  182. <el-form-item label="格力内部备注" prop="greeRemark">
  183. <el-input v-model="mainForm.greeRemark" placeholder="请输入格力内部备注" />
  184. </el-form-item>
  185. </el-col>
  186. <!-- <el-col :xs="24" :sm="24" :lg="24">
  187. <el-form-item label="格力回复" prop="greeReply">
  188. <el-input v-model="mainForm.greeReply" placeholder="请输入格力回复"></el-input>
  189. </el-form-item>
  190. </el-col> -->
  191. <el-col :xs="24" :sm="24" :lg="24">
  192. <el-form-item label="备注" prop="remark">
  193. <el-input v-model="mainForm.remark" placeholder="请输入备注" />
  194. </el-form-item>
  195. </el-col>
  196. <el-col :xs="24" :sm="12" :lg="8">
  197. <el-form-item label="制单人" prop="createMan">
  198. <el-input v-model="mainForm.createMan" placeholder="请输入制单人" disabled />
  199. </el-form-item>
  200. </el-col>
  201. <el-col :xs="24" :sm="12" :lg="8" style="height: 51px">
  202. <el-form-item label="制单日期" prop="createDate">
  203. <el-date-picker
  204. v-model="mainForm.createDate"
  205. disabled
  206. type="date"
  207. :default-value="getDate()"
  208. value-format="yyyy-MM-dd"
  209. style="width: 100%"
  210. placeholder="选择日期"
  211. />
  212. </el-form-item>
  213. </el-col>
  214. <el-col :span="24" :sm="12" :lg="8">
  215. <el-form-item label="计划单" prop="isPlanOrder">
  216. <el-radio-group v-model="mainForm.isPlanOrder">
  217. <el-radio :label="true">是</el-radio>
  218. <el-radio :label="false">否</el-radio>
  219. </el-radio-group>
  220. </el-form-item>
  221. </el-col>
  222. <el-col v-if="mainForm.examineRemark" :xs="24" :sm="24" :lg="24">
  223. <el-form-item label="审批说明" prop="examineRemark">
  224. <el-input v-model="mainForm.examineRemark" placeholder="请输入审批说明" disabled />
  225. </el-form-item>
  226. </el-col>
  227. </el-row>
  228. </el-form>
  229. <div class="main-title">
  230. <div class="title">货品信息</div>
  231. <div>
  232. <el-select v-model="warehouseValue" placeholder="请选择发货仓库" @change="handleWarehouseValue"
  233. size="small" style="margin-right: 10px"
  234. >
  235. <el-option v-for="(item, index) in warehouseList" :key="index" :label="item.name" :value="item.id" />
  236. </el-select>
  237. <el-button type="primary" size="small" icon="el-icon-search" @click="checkStock">检查库存</el-button>
  238. <el-divider direction="vertical" />
  239. <el-button type="primary" size="small" icon="el-icon-plus" @click="openDialog">添加货品</el-button>
  240. </div>
  241. </div>
  242. <div class="table" style="margin-top: 20px">
  243. <el-table
  244. :data="goodsList"
  245. element-loading-text="Loading"
  246. border
  247. fit
  248. highlight-current-row
  249. stripe
  250. max-height="400"
  251. show-summary
  252. :summary-method="$getSummaries"
  253. >
  254. <el-table-column align="center" label="序号" type="index" width="50" />
  255. <!-- <el-table-column align="center" label="引用记录" prop="useRefCount" min-width="160" show-overflow-tooltip></el-table-column> -->
  256. <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="120" show-overflow-tooltip />
  257. <el-table-column align="center" label="物料编码" prop="materialNumber" min-width="120" show-overflow-tooltip />
  258. <el-table-column
  259. align="center"
  260. label="产品编码"
  261. prop="materialOldNumber"
  262. min-width="120"
  263. show-overflow-tooltip
  264. />
  265. <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip />
  266. <el-table-column align="center" label="规格型号" prop="specification" min-width="300" show-overflow-tooltip>
  267. <template slot-scope="scope">
  268. <el-input v-if="listItem" v-model="scope.row.specification" size="small" />
  269. <div v-else>{{ scope.row.specification }}</div>
  270. </template>
  271. </el-table-column>
  272. <el-table-column
  273. align="center"
  274. label="实装规格型号"
  275. prop="realSpecification"
  276. min-width="300"
  277. show-overflow-tooltip
  278. >
  279. <template slot-scope="scope">
  280. <el-input
  281. v-model="scope.row.realSpecification"
  282. :class="scope.row.realSpecification !== scope.row.specification ? 'input' : ''"
  283. size="small"
  284. readonly
  285. @click.native="getRealMaterData(scope.$index)"
  286. />
  287. </template>
  288. </el-table-column>
  289. <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip>
  290. <template slot-scope="scope">
  291. <el-input v-model="scope.row.qty" size="small" type="number" @mousewheel.native.prevent />
  292. </template>
  293. </el-table-column>
  294. <el-table-column align="center" label="单价" prop="price" min-width="100" show-overflow-tooltip>
  295. <template slot-scope="scope">
  296. <el-input v-model="scope.row.price" size="small" type="number" @mousewheel.native.prevent />
  297. </template>
  298. </el-table-column>
  299. <el-table-column align="center" label="订单金额" prop="dida" min-width="100" show-overflow-tooltip>
  300. <template slot-scope="scope">
  301. {{ scope.row.price * scope.row.qty }}
  302. </template>
  303. </el-table-column>
  304. <el-table-column align="center" label="工程登录数量" prop="enginNum" min-width="120" show-overflow-tooltip />
  305. <el-table-column align="center" label="现金钱包" prop="customerWalletId" min-width="160" show-overflow-tooltip>
  306. <template slot-scope="scope">
  307. <el-select
  308. v-model="scope.row.customerWalletId"
  309. placeholder="选择现金钱包"
  310. size="small"
  311. clearable
  312. @change="changeXjWallet(scope.$index)"
  313. >
  314. <el-option
  315. v-for="item in scope.row.wallets"
  316. :key="item.customerWalletId"
  317. :label="item.customerWalletName"
  318. :value="item.customerWalletId"
  319. />
  320. </el-select>
  321. </template>
  322. </el-table-column>
  323. <el-table-column align="center" label="返利类型" prop="customerWalletId2" min-width="160" show-overflow-tooltip>
  324. <template slot-scope="scope">
  325. <el-select
  326. v-model="scope.row.customerWalletId2"
  327. placeholder="选择返利类型"
  328. size="small"
  329. clearable
  330. @change="changeFlWallet(scope.$index)"
  331. >
  332. <el-option
  333. v-for="item in scope.row.rebateWallets"
  334. :key="item.customerWalletId"
  335. :label="item.customerWalletName"
  336. :value="item.customerWalletId"
  337. />
  338. </el-select>
  339. </template>
  340. </el-table-column>
  341. <el-table-column align="center" label="返利金额" min-width="100" show-overflow-tooltip prop="compute_flAmount">
  342. <template slot-scope="scope">
  343. {{ (scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) / 100 }}
  344. </template>
  345. </el-table-column>
  346. <el-table-column align="center" label="格力折扣" prop="ko" min-width="100" show-overflow-tooltip>
  347. <template slot-scope="scope">
  348. {{ scope.row.qty * scope.row.discAmount }}
  349. </template>
  350. </el-table-column>
  351. <el-table-column align="center" label="实付金额" min-width="100" show-overflow-tooltip prop="compute_sfAmount">
  352. <template slot-scope="scope">
  353. {{
  354. (scope.row.price * scope.row.qty * 100 -
  355. ((scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) / 100) * 100 -
  356. ((scope.row.qty * (scope.row.discAmount * 100)) / 100) * 100) /
  357. 100
  358. }}
  359. </template>
  360. </el-table-column>
  361. <el-table-column align="center" label="是否直调" prop="isDirectTransfer" min-width="100">
  362. <template slot-scope="scope">
  363. <el-checkbox v-model="scope.row.isDirectTransfer" />
  364. </template>
  365. </el-table-column>
  366. <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100" />
  367. <el-table-column align="center" label="已发货数量" prop="hasSendQty" min-width="100" show-overflow-tooltip />
  368. <el-table-column align="center" label="已退数量" prop="retiredQty" min-width="100" show-overflow-tooltip />
  369. <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip>
  370. <template slot-scope="scope">
  371. <el-input v-model="scope.row.remark" size="small" />
  372. </template>
  373. </el-table-column>
  374. <el-table-column
  375. align="center"
  376. label="实装物料编号"
  377. prop="realMaterialNumber"
  378. min-width="150"
  379. show-overflow-tooltip
  380. >
  381. <template slot-scope="scope">
  382. <el-input
  383. v-model="scope.row.realMaterialNumber"
  384. :class="scope.row.realMaterialNumber !== scope.row.materialNumber ? 'input' : ''"
  385. size="small"
  386. readonly
  387. @click.native="getRealMaterData(scope.$index)"
  388. />
  389. </template>
  390. </el-table-column>
  391. <el-table-column
  392. align="center"
  393. label="实装厂产品编码"
  394. prop="realMaterialOldNumber"
  395. min-width="200"
  396. show-overflow-tooltip
  397. >
  398. <template slot-scope="scope">
  399. <el-input
  400. v-model="scope.row.realMaterialOldNumber"
  401. :class="scope.row.realMaterialOldNumber !== scope.row.materialOldNumber ? 'input' : ''"
  402. size="small"
  403. readonly
  404. @click.native="getRealMaterData(scope.$index)"
  405. />
  406. </template>
  407. </el-table-column>
  408. <el-table-column align="center" label="税率" prop="tax" min-width="100" show-overflow-tooltip />
  409. <!-- <el-table-column align="center" label="总仓库" prop="status1" min-width="100" show-overflow-tooltip>
  410. <template slot-scope="scope">
  411. <div>{{ scope.row.status1 | status1Filter }}</div>
  412. </template>
  413. </el-table-column> -->
  414. <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip />
  415. <el-table-column align="left" label="仓库" prop="correspondName" min-width="150" show-overflow-tooltip />
  416. <el-table-column align="center" label="仓库状态" prop="status2" min-width="100" show-overflow-tooltip>
  417. <template slot-scope="scope">
  418. <div>{{ status2Filter(scope.row) }}</div>
  419. </template>
  420. </el-table-column>
  421. <!-- <el-table-column align="center" label="业务员" prop="serviceId" min-width="160" show-overflow-tooltip>
  422. <template slot-scope="scope">
  423. <el-select v-model="scope.row.serviceId" placeholder="选择业务员" size="small" clearable disabled>
  424. <el-option
  425. v-for="item in salesmanList"
  426. :key="item.adminUserId"
  427. :label="item.nickName"
  428. :value="item.adminUserId">
  429. </el-option>
  430. </el-select>
  431. </template>
  432. </el-table-column> -->
  433. <el-table-column align="center" label="操作" width="100" fixed="right">
  434. <template slot-scope="scope">
  435. <el-button type="text" @click="deleteItem(scope.$index)">删除</el-button>
  436. </template>
  437. </el-table-column>
  438. </el-table>
  439. </div>
  440. <div class="page-footer">
  441. <div class="footer">
  442. <el-button type="primary" :loading="formLoading" @click="clickSubmitForm(1)">保 存</el-button>
  443. <el-button type="primary" :loading="formLoading" @click="clickSubmitForm(2)">提交审核</el-button>
  444. <el-popconfirm v-if="!isDealer" title="确定关闭吗?" style="margin-left: 10px" @onConfirm="goBack">
  445. <el-button slot="reference">返回列表</el-button>
  446. </el-popconfirm>
  447. </div>
  448. </div>
  449. <!-- 工程登录列表 -->
  450. <el-dialog title="工程登录列表" :visible.sync="isShowDialog" width="70%" :close-on-click-modal="false">
  451. <el-form
  452. ref="screenForm"
  453. :model="screenForm"
  454. label-width="0"
  455. size="small"
  456. label-position="left"
  457. v-if="mainForm.examineStatus !== 'SAVE'"
  458. >
  459. <el-row :gutter="20">
  460. <el-col :xs="24" :sm="12" :lg="6">
  461. <el-form-item prop="loginNum">
  462. <el-input v-model="screenForm.loginNum" placeholder="工程登录编号" />
  463. </el-form-item>
  464. </el-col>
  465. <el-col :xs="24" :sm="12" :lg="6">
  466. <el-form-item prop="enginName">
  467. <el-input v-model="screenForm.enginName" placeholder="工程类别" />
  468. </el-form-item>
  469. </el-col>
  470. <el-col :xs="24" :sm="12" :lg="6">
  471. <el-form-item prop="company">
  472. <el-input v-model="screenForm.company" placeholder="使用单位" />
  473. </el-form-item>
  474. </el-col>
  475. <el-col :xs="24" :sm="12" :lg="6" class="tr">
  476. <el-form-item label="">
  477. <el-button size="small" @click="resetScreenForm">清空</el-button>
  478. <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
  479. </el-form-item>
  480. </el-col>
  481. </el-row>
  482. </el-form>
  483. <div class="table" style="margin: 10px 0 20px">
  484. <el-table
  485. v-loading="dialogTable_listLoading"
  486. :data="dialogTable_dataList"
  487. element-loading-text="Loading"
  488. tooltip-effect="dark"
  489. style="width: 100%"
  490. max-height="270"
  491. >
  492. <el-table-column align="center" label="" width="100">
  493. <template slot-scope="scope">
  494. <el-button type="primary" size="small" @click="chooseItem(scope.row.recordNo, scope.row.userid)"
  495. >选择
  496. </el-button
  497. >
  498. </template>
  499. </el-table-column>
  500. <el-table-column align="center" prop="checkTime" label="工程登录日期" show-overflow-tooltip />
  501. <el-table-column align="center" prop="recordNo" label="工程登录编号" show-overflow-tooltip />
  502. <el-table-column align="center" prop="projectName" label="项目类别" show-overflow-tooltip />
  503. <el-table-column align="center" prop="useUnit" label="使用单位" show-overflow-tooltip />
  504. <el-table-column align="center" prop="organizationName" label="经销商" show-overflow-tooltip />
  505. </el-table>
  506. </div>
  507. <div class="pagination clearfix">
  508. <div class="fr">
  509. <el-pagination
  510. :current-page="dialogTable_currentPage"
  511. :page-size="dialogTable_pageSize"
  512. background
  513. layout="prev, pager, next"
  514. :total="dialogTable_listTotal"
  515. @current-change="dialogTableCurrentChange"
  516. />
  517. </div>
  518. </div>
  519. <div slot="footer" class="dialog-footer">
  520. <el-button @click="isShowDialog = false">关 闭</el-button>
  521. </div>
  522. </el-dialog>
  523. <el-dialog title="添加产品" :visible.sync="isShowGoodsDialog" width="80%">
  524. <el-form ref="goodsScreenForm" :model="goodsScreenForm" size="small" label-position="left">
  525. <el-row :gutter="20">
  526. <el-col :xs="12" :sm="6" :lg="6">
  527. <el-form-item prop="proNum">
  528. <el-input v-model="goodsScreenForm.proNum" placeholder="请输入物料编码" />
  529. </el-form-item>
  530. </el-col>
  531. <el-col :xs="12" :sm="6" :lg="6">
  532. <el-form-item prop="proName">
  533. <el-input v-model="goodsScreenForm.proName" placeholder="请输入产品名称" />
  534. </el-form-item>
  535. </el-col>
  536. <el-col :xs="12" :sm="6" :lg="6">
  537. <el-form-item prop="proModel">
  538. <el-input v-model="goodsScreenForm.proModel" placeholder="请输入产品型号" />
  539. </el-form-item>
  540. </el-col>
  541. <el-col :xs="12" :sm="6" :lg="6">
  542. <el-form-item prop="price1" style="display: flex">
  543. <el-input v-model="goodsScreenForm.price1" placeholder="请输入价格" style="width: 46%" />
  544. <span> - </span>
  545. <el-input v-model="goodsScreenForm.price2" placeholder="请输入价格" style="width: 46%" />
  546. </el-form-item>
  547. </el-col>
  548. <el-col :xs="24" :sm="24" :lg="24" class="tr">
  549. <el-form-item label="">
  550. <el-button size="small" @click="resetGoodsScreenForm">清空</el-button>
  551. <el-button size="small" type="primary" @click="submitGoodsScreenForm">搜索</el-button>
  552. </el-form-item>
  553. </el-col>
  554. </el-row>
  555. </el-form>
  556. <div class="tables">
  557. <div class="table">
  558. <el-table
  559. :data="leftGoodsList"
  560. element-loading-text="Loading"
  561. border
  562. fit
  563. highlight-current-row
  564. stripe
  565. height="400"
  566. @selection-change="leftSelectionChange"
  567. >
  568. <el-table-column align="center" type="selection" width="55" :selectable="checkboxSelect" />
  569. <el-table-column align="center" label="销售类型" prop="saleName" min-width="100" show-overflow-tooltip />
  570. <el-table-column align="center" label="物料编码" prop="number" min-width="100" show-overflow-tooltip />
  571. <el-table-column align="center" label="产品名称" prop="name" min-width="160" show-overflow-tooltip />
  572. <el-table-column
  573. align="center"
  574. label="产品型号"
  575. prop="specification"
  576. min-width="160"
  577. show-overflow-tooltip
  578. />
  579. <el-table-column align="center" label="产品价格" prop="batchPrice" min-width="80" show-overflow-tooltip />
  580. </el-table>
  581. <div class="pagination clearfix" style="margin-top: 10px">
  582. <div class="fr">
  583. <el-pagination
  584. :current-page="currentPage"
  585. :page-size="10"
  586. background
  587. layout="prev, pager, next"
  588. :total="listTotal"
  589. @current-change="handleTableCurrentChange"
  590. />
  591. </div>
  592. </div>
  593. </div>
  594. <div class="buttons">
  595. <el-button size="small" type="primary" @click="addAllGoods">全部添加</el-button>
  596. <el-button size="small" type="primary" @click="addGoods">添&emsp;加</el-button>
  597. <el-button size="small" type="danger" @click="deleteGoods">删&emsp;除</el-button>
  598. <el-button size="small" type="danger" @click="deleteAllGoods">全部删除</el-button>
  599. </div>
  600. <div class="table">
  601. <el-table
  602. :data="rightGoodsList"
  603. element-loading-text="Loading"
  604. border
  605. fit
  606. highlight-current-row
  607. stripe
  608. height="400"
  609. @selection-change="rightSelectionChange"
  610. >
  611. <el-table-column align="center" type="selection" width="55" />
  612. <el-table-column align="center" label="物料编码" prop="number" min-width="100" show-overflow-tooltip />
  613. <el-table-column align="center" label="产品名称" prop="name" min-width="160" show-overflow-tooltip />
  614. <el-table-column
  615. align="center"
  616. label="产品型号"
  617. prop="specification"
  618. min-width="160"
  619. show-overflow-tooltip
  620. />
  621. <el-table-column align="center" label="产品价格" prop="batchPrice" min-width="80" show-overflow-tooltip />
  622. </el-table>
  623. </div>
  624. </div>
  625. <span slot="footer" class="dialog-footer">
  626. <el-button @click="closeDialog">取 消</el-button>
  627. <el-button type="primary" @click="submitAddGoods">确 定</el-button>
  628. </span>
  629. </el-dialog>
  630. <el-dialog title="添加产品" :visible.sync="isSetMaterial" width="80%">
  631. <el-form ref="goodsScreenForm" :model="goodsScreenForm" size="small" label-position="left">
  632. <el-row :gutter="20">
  633. <el-col :xs="12" :sm="6" :lg="6">
  634. <el-form-item prop="proNum">
  635. <el-input v-model="goodsScreenForm.proNum" placeholder="请输入物料编码" />
  636. </el-form-item>
  637. </el-col>
  638. <el-col :xs="12" :sm="6" :lg="6">
  639. <el-form-item prop="proName">
  640. <el-input v-model="goodsScreenForm.proName" placeholder="请输入产品名称" />
  641. </el-form-item>
  642. </el-col>
  643. <el-col :xs="12" :sm="6" :lg="6">
  644. <el-form-item prop="proModel">
  645. <el-input v-model="goodsScreenForm.proModel" placeholder="请输入产品型号" />
  646. </el-form-item>
  647. </el-col>
  648. <el-col :xs="12" :sm="6" :lg="6">
  649. <el-form-item prop="price1" style="display: flex">
  650. <el-input v-model="goodsScreenForm.price1" placeholder="请输入价格" style="width: 46%" />
  651. <span> - </span>
  652. <el-input v-model="goodsScreenForm.price2" placeholder="请输入价格" style="width: 46%" />
  653. </el-form-item>
  654. </el-col>
  655. <el-col :xs="24" :sm="24" :lg="24" class="tr">
  656. <el-form-item label="">
  657. <el-button size="small" @click="resetGoodsScreenForm">清空</el-button>
  658. <el-button size="small" type="primary" @click="submitGoodsScreenForm">搜索</el-button>
  659. </el-form-item>
  660. </el-col>
  661. </el-row>
  662. </el-form>
  663. <div>
  664. <el-table :data="leftGoodsList" element-loading-text="Loading" border fit stripe height="400">
  665. <el-table-column align="center" width="55">
  666. <template slot-scope="scope">
  667. <el-radio v-model="currentRadio" :label="scope.row.id">{{ '' }}</el-radio>
  668. </template>
  669. </el-table-column>
  670. <el-table-column align="center" label="销售类型" prop="saleName" min-width="100" show-overflow-tooltip />
  671. <el-table-column align="center" label="物料编码" prop="number" min-width="100" show-overflow-tooltip />
  672. <el-table-column
  673. align="center"
  674. label="产品编码"
  675. prop="materialOldNumber"
  676. min-width="100"
  677. show-overflow-tooltip
  678. />
  679. <el-table-column align="center" label="产品名称" prop="name" min-width="160" show-overflow-tooltip />
  680. <el-table-column align="center" label="产品型号" prop="specification" min-width="160" show-overflow-tooltip />
  681. <el-table-column align="center" label="产品价格" prop="batchPrice" min-width="80" show-overflow-tooltip />
  682. </el-table>
  683. <div class="pagination clearfix" style="margin-top: 10px">
  684. <div class="fr">
  685. <el-pagination
  686. :current-page="currentPage"
  687. :page-size="10"
  688. background
  689. layout="prev, pager, next"
  690. :total="listTotal"
  691. @current-change="handleTableCurrentChange"
  692. />
  693. </div>
  694. </div>
  695. </div>
  696. <span slot="footer" class="dialog-footer">
  697. <el-button @click="closeDialog">取 消</el-button>
  698. <el-button type="primary" @click="submitPushGoods">确 定</el-button>
  699. </span>
  700. </el-dialog>
  701. </div>
  702. </template>
  703. <script>
  704. import {
  705. getOrderDetail,
  706. getHomeLoginList,
  707. getHomeLoginDetail,
  708. getWarehouseList,
  709. addHome,
  710. editHome,
  711. submitHome,
  712. checkStock,
  713. getRetailProductList
  714. } from '@/api/supply/engin'
  715. import { getDictList, getHomeTypeList, getSalesmanList } from '@/api/common'
  716. import { findElem } from '@/utils/util'
  717. let that
  718. export default {
  719. name: 'HomeForm',
  720. componentName: 'HomeForm',
  721. filters: {
  722. status1Filter(val) {
  723. const STOCK_ORDER_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_START').dictValue
  724. const STOCK_ORDER_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_END').dictValue
  725. const STOCK_ORDER_HAVE_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_START').dictValue
  726. const STOCK_ORDER_HAVE_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_END').dictValue
  727. const STOCK_ORDER_ALL_NUM = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_ALL_NUM').dictValue
  728. if (val === '' || val === null || val === undefined) {
  729. return '未检查'
  730. } else if (val <= 0) {
  731. return '无货'
  732. } else if (val > STOCK_ORDER_START && val <= STOCK_ORDER_END) {
  733. return val
  734. } else if (val >= STOCK_ORDER_HAVE_START && val <= STOCK_ORDER_HAVE_END) {
  735. return '有货'
  736. } else if (val > STOCK_ORDER_ALL_NUM) return '充足'
  737. }
  738. },
  739. props: ['listItem'],
  740. data() {
  741. return {
  742. editId: '',
  743. mainForm: {
  744. customerId: '',
  745. orderNum: '',
  746. orderDate: '',
  747. type: '',
  748. jxsNum: '',
  749. jxsName: '',
  750. loginNum: '',
  751. enginName: '',
  752. loginType: '',
  753. promiseStatus: '',
  754. factoryNum: '',
  755. company: '',
  756. saleType: '',
  757. contactMan: '',
  758. tel: '',
  759. phone: '',
  760. address: '',
  761. declareNo: '',
  762. greeRemark: '',
  763. greeReply: '',
  764. remark: '',
  765. createMan: '',
  766. createDate: '',
  767. fileNum: '',
  768. loginUserId: '',
  769. salesMan: '',
  770. projectRemark: '',
  771. projectType: '',
  772. examineRemark: '',
  773. refCount: '',
  774. regionWork: '',
  775. examineStatus: '',
  776. refBuyUnitName: '',
  777. refPromiseProvide: '',
  778. refOtherAnnexIdea: '',
  779. isPlanOrder: this.listItem ? '' : true
  780. },
  781. mainFormRules: {
  782. // orderDate: [{ required: true, message: '请选择单据日期', trigger: 'change' }],
  783. jxsNum: [{ required: true, message: '请输入经销商编码', trigger: 'blur' }],
  784. jxsName: [{ required: true, message: '请输入经销商名称', trigger: 'blur' }],
  785. loginNum: [{ required: true, message: '请输入工程登录编号', trigger: 'blur' }],
  786. // enginName: [{ required: true, message: '请输入项目类别', trigger: 'blur' }],
  787. // loginType: [{ required: true, message: '请输入行业类别', trigger: 'blur' }],
  788. company: [{ required: true, message: '请输入使用单位', trigger: 'blur' }],
  789. saleType: [{ required: true, message: '请选择销售类型', trigger: 'change' }],
  790. // contactMan: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
  791. // tel: [{ required: true, message: '请输入固定电话', trigger: 'blur' }],
  792. // phone: [{ required: true, message: '请输入移动电话', trigger: 'blur' }],
  793. address: [{ required: true, message: '请输入安装地址', trigger: 'blur' }]
  794. },
  795. salesTypeList: [],
  796. // typeList: [],
  797. stockList: [],
  798. goodsList: [],
  799. correspondName: '',
  800. correspondId: '',
  801. isShowDialog: false, // 工程登录列表 - 弹窗
  802. screenForm: {
  803. loginNum: '',
  804. enginName: '',
  805. company: ''
  806. },
  807. dialogTable_dataList: null, // 工程登录列表 - 列表数据
  808. dialogTable_listLoading: true, // 工程登录列表 - 列表加载loading
  809. dialogTable_currentPage: 1, // 工程登录列表 - 当前页码
  810. dialogTable_pageSize: 10, // 工程登录列表 - 每页数量
  811. dialogTable_listTotal: 0, // 工程登录列表 - 列表总数
  812. warehouseList: [],
  813. warehouseValue: '',
  814. isShowGoodsDialog: false,
  815. goodsScreenForm: {
  816. proNum: '',
  817. proName: '',
  818. proModel: '',
  819. price1: '',
  820. price2: ''
  821. },
  822. currentPage: 1,
  823. listTotal: 0,
  824. leftGoodsList: [],
  825. rightGoodsList: [],
  826. leftSelection: [],
  827. rightSelection: [],
  828. formLoading: false,
  829. isFirst: false,
  830. salesmanList: [],
  831. oldSaleType: '',
  832. notInRefQueryGoodsList: '',
  833. isSetMaterial: false,
  834. currentId: '',
  835. currentRadio: ''
  836. }
  837. },
  838. computed: {
  839. isDealer() {
  840. return JSON.parse(localStorage.getItem('supply_user')).isCustomer
  841. },
  842. outSalesmanList() {
  843. const list = []
  844. if (this.goodsList && this.goodsList.length) {
  845. this.goodsList.forEach(item => {
  846. if (item.serviceId) {
  847. const hasItem = findElem(list, 'adminUserId', item.serviceId)
  848. if (hasItem < 0) {
  849. const obj = this.salesmanList.find(o => o.adminUserId == item.serviceId)
  850. if (obj) {
  851. list.push(obj)
  852. }
  853. }
  854. }
  855. })
  856. if (this.isFirst) {
  857. this.isFirst = false
  858. } else {
  859. this.mainForm.salesMan = this.goodsList[0].serviceId
  860. }
  861. }
  862. return list
  863. }
  864. },
  865. watch: {
  866. goodsList: {
  867. handler(newValue, oldValue) {
  868. if (newValue && newValue.length) {
  869. newValue.forEach((item, index) => {
  870. if (this.correspondId) {
  871. this.goodsList[index].correspondName = this.correspondName
  872. this.goodsList[index].correspondId = this.correspondId
  873. }
  874. this.goodsList[index].compute_sfAmount =
  875. (item.price * item.qty * 100 -
  876. ((item.price * item.qty * (item.rebateRate * 100)) / 100) * 100 -
  877. ((item.qty * (item.discAmount * 100)) / 100) * 100) /
  878. 100
  879. this.goodsList[index].compute_flAmount = (item.price * item.qty * (item.rebateRate * 100)) / 100
  880. this.goodsList[index].ko = item.qty * item.discAmount
  881. this.goodsList[index].dida = item.price * item.qty
  882. })
  883. newValue.forEach(item => {
  884. // 'enginNum', 'directTransferQty', 'hasSendQty', 'retiredQty', 'ko'
  885. // 'price', 'compute_flAmount', 'compute_sfAmount'
  886. item.sums1 = ['qty']
  887. item.sums2 = ['dida']
  888. })
  889. }
  890. if (this.goodsList && this.goodsList.length) {
  891. if (this.isFirst) {
  892. this.isFirst = false
  893. } else {
  894. // this.mainForm.salesMan = this.goodsList[0].serviceId;
  895. }
  896. } else {
  897. this.mainForm.salesMan = ''
  898. }
  899. },
  900. immediate: true,
  901. deep: true
  902. },
  903. 'mainForm.saleType': function(newValue, oldValue) {
  904. this.oldSaleType = oldValue
  905. }
  906. },
  907. beforeCreate() {
  908. that = this
  909. },
  910. async created() {
  911. await this.getSalesmanList()
  912. this.getDictList()
  913. this.getHomeTypeList()
  914. this.getWarehouseList()
  915. if (this.listItem) {
  916. this.isFirst = true
  917. this.editId = this.listItem.parentId
  918. this.getDetail()
  919. } else {
  920. this.mainForm.jxsNum = JSON.parse(localStorage.getItem('supply_user')).customerNumber
  921. this.mainForm.jxsName = JSON.parse(localStorage.getItem('supply_user')).customerName
  922. this.mainForm.createMan = JSON.parse(localStorage.getItem('supply_user')).nickName
  923. this.mainForm.createDate = this.getDate()
  924. }
  925. },
  926. methods: {
  927. // 返回列表
  928. goBack() {
  929. this.$emit('backListFormDetail')
  930. },
  931. getDate() {
  932. var date = new Date()
  933. var seperator1 = '-'
  934. var year = date.getFullYear()
  935. var month = date.getMonth() + 1
  936. var strDate = date.getDate()
  937. if (month >= 1 && month <= 9) {
  938. month = '0' + month
  939. }
  940. if (strDate >= 0 && strDate <= 9) {
  941. strDate = '0' + strDate
  942. }
  943. var currentdate = year + seperator1 + month + seperator1 + strDate
  944. return currentdate
  945. },
  946. // 获取产品大类列表
  947. getDictList() {
  948. // getDictList({sysDictEnum: 'PRODUCT_TYPE'}).then(res => {
  949. // this.typeList = res.data;
  950. // })
  951. getDictList({ sysDictEnum: 'STOCK_ORDER' }).then(res => {
  952. this.stockList = res.data
  953. })
  954. },
  955. // 获取家用销售类型列表
  956. getHomeTypeList() {
  957. getHomeTypeList().then(res => {
  958. this.salesTypeList = res.data
  959. console.log(res.data)
  960. })
  961. },
  962. // 获取仓库列表
  963. getWarehouseList() {
  964. getWarehouseList({
  965. pageNum: 1,
  966. pageSize: -1
  967. }).then(res => {
  968. this.warehouseList = res.data.records
  969. })
  970. },
  971. async getSalesmanList() {
  972. const res = await getSalesmanList({
  973. pageNum: 1,
  974. pageSize: -1,
  975. isCustomer: 0,
  976. status: true
  977. })
  978. this.salesmanList = res.data.records
  979. },
  980. // 工程登录列表 - 获取列表
  981. getHomeLoginList() {
  982. getHomeLoginList({
  983. pageNum: this.dialogTable_currentPage,
  984. pageSize: this.dialogTable_pageSize,
  985. recordNo: this.screenForm.loginNum,
  986. projectName: this.screenForm.enginName,
  987. useUnit: this.screenForm.company,
  988. refEnginRecordNo: this.mainForm.loginNum,
  989. examineStatus: 'OK'
  990. }).then(res => {
  991. this.dialogTable_dataList = res.data.records
  992. this.dialogTable_listTotal = res.data.total
  993. this.dialogTable_listLoading = false
  994. })
  995. },
  996. // 工程登录列表 - 打开弹窗
  997. openShareDetail() {
  998. if (!this.mainForm.saleType) {
  999. return this.$errorMsg('请先选择销售类型')
  1000. }
  1001. this.isShowDialog = true
  1002. this.dialogTable_currentPage = 1
  1003. this.screenForm.loginNum = this.mainForm.loginNum
  1004. this.getHomeLoginList()
  1005. },
  1006. // 工程登录列表 - 更改列表当前页
  1007. dialogTableCurrentChange(val) {
  1008. this.dialogTable_currentPage = val
  1009. this.getHomeLoginList()
  1010. },
  1011. // 提交筛选表单
  1012. submitScreenForm() {
  1013. this.dialogTable_currentPage = 1
  1014. this.getHomeLoginList()
  1015. },
  1016. // 重置筛选表单
  1017. resetScreenForm() {
  1018. this.$refs.screenForm.resetFields()
  1019. this.dialogTable_currentPage = 1
  1020. this.getHomeLoginList()
  1021. },
  1022. // 选择工程登录
  1023. async chooseItem(id, uid, isChangeSaleType = false) {
  1024. const isCustomer = JSON.parse(localStorage.getItem('supply_user')).isCustomer
  1025. let customerId = JSON.parse(localStorage.getItem('supply_user')).customerId
  1026. if (!isCustomer) {
  1027. customerId = this.mainForm.customerId
  1028. }
  1029. getHomeLoginDetail({
  1030. recordNo: id,
  1031. saleTypeId: this.mainForm.saleType,
  1032. userId: uid,
  1033. enginOrderId: this.mainForm.orderNum,
  1034. customerId: customerId,
  1035. refEnginRecordNo: this.mainForm.loginNum
  1036. })
  1037. .then(async res => {
  1038. // 复制当前明细数据
  1039. const copyGoodsList = JSON.parse(JSON.stringify(this.goodsList))
  1040. console.log('未刷新前', copyGoodsList)
  1041. if (!isChangeSaleType) {
  1042. this.setMainAndItem(res.data)
  1043. } else {
  1044. // 找出不属于引用单上的产品
  1045. if (copyGoodsList && copyGoodsList.length > 0) {
  1046. const notInRefGoodsList = []
  1047. for (let i = 0; i < copyGoodsList.length; i++) {
  1048. const goods = copyGoodsList[i]
  1049. const index = res.data.items.findIndex(v => v.materialOldNumber === goods.materialOldNumber)
  1050. if (index < 0) {
  1051. notInRefGoodsList.push(goods)
  1052. }
  1053. }
  1054. if (notInRefGoodsList && notInRefGoodsList.length > 0) {
  1055. const oldNumbers = []
  1056. notInRefGoodsList.forEach(v => oldNumbers.push(v.materialOldNumber))
  1057. console.log('请求前可选机型接口', notInRefGoodsList, oldNumbers)
  1058. // 请求可选机型接口
  1059. await this.querySaleTypeGoods(oldNumbers)
  1060. console.log('返回新加明细', this.notInRefQueryGoodsList)
  1061. if (!this.notInRefQueryGoodsList) {
  1062. console.log('结束执行下去')
  1063. return
  1064. }
  1065. this.addRefItems(res.data.items, notInRefGoodsList)
  1066. }
  1067. // 数量和价格不变更
  1068. console.log('执行下去,数量和价格不变更')
  1069. }
  1070. console.log('替换前', res.data.items)
  1071. res.data.items = this.replaceHistoryItems(res.data.items, copyGoodsList)
  1072. console.log('替换后', res.data.items)
  1073. this.setMainAndItem(res.data)
  1074. }
  1075. })
  1076. .catch(() => {
  1077. this.mainForm.saleType = this.oldSaleType
  1078. })
  1079. },
  1080. // 选择销售类型
  1081. changeSaleType() {
  1082. if (this.mainForm.loginNum) {
  1083. this.chooseItem(this.mainForm.loginNum, this.mainForm.loginUserId, true)
  1084. }
  1085. },
  1086. // 删除产品
  1087. deleteItem(index) {
  1088. this.goodsList.splice(index, 1)
  1089. },
  1090. // 修改返利钱包
  1091. changeFlWallet(index) {
  1092. if (this.goodsList[index].customerWalletId2) {
  1093. const obj = this.goodsList[index].rebateWallets.find(
  1094. o => o.customerWalletId == this.goodsList[index].customerWalletId2
  1095. )
  1096. this.goodsList[index].rebateRate = obj.rebateRate
  1097. this.goodsList[index].customerWalletName2 = obj.customerWalletName
  1098. } else {
  1099. this.goodsList[index].rebateRate = ''
  1100. this.goodsList[index].customerWalletName2 = ''
  1101. }
  1102. },
  1103. // 修改现金钱包
  1104. changeXjWallet(index) {
  1105. if (this.goodsList[index].customerWalletId) {
  1106. const obj = this.goodsList[index].wallets.find(
  1107. o => o.customerWalletId == this.goodsList[index].customerWalletId
  1108. )
  1109. this.goodsList[index].customerWalletName = obj.customerWalletName
  1110. this.goodsList[index].serviceId = obj.serviceId
  1111. this.goodsList[index].serviceName = obj.serviceName
  1112. } else {
  1113. this.goodsList[index].customerWalletName = ''
  1114. this.goodsList[index].serviceId = ''
  1115. this.goodsList[index].serviceName = ''
  1116. }
  1117. },
  1118. handleWarehouseValue(e) {
  1119. this.correspondName = this.warehouseList.find(k => {
  1120. return k.id === e
  1121. }).name
  1122. this.correspondId = e
  1123. if (!this.goodsList.length) return
  1124. this.goodsList.forEach(k => {
  1125. this.$set(k, 'correspondName', this.correspondName)
  1126. this.$set(k, 'correspondId', this.correspondId)
  1127. })
  1128. console.log(this.goodsList)
  1129. },
  1130. // 获取详情
  1131. getDetail() {
  1132. getOrderDetail({ id: this.editId }).then(res => {
  1133. const data = res.data
  1134. this.mainForm.customerId = data.customerId
  1135. this.mainForm.orderNum = data.enginOrderId
  1136. this.mainForm.orderDate = data.orderDate
  1137. this.mainForm.type = data.mainId
  1138. this.mainForm.jxsNum = data.customerNumber
  1139. this.mainForm.jxsName = data.customerName
  1140. this.mainForm.loginNum = data.refEnginRecordNo
  1141. this.mainForm.enginName = data.refProjectCategory
  1142. this.mainForm.loginType = data.refTradeCategory
  1143. this.mainForm.promiseStatus = data.refPromiseStatus
  1144. this.mainForm.factoryNum = data.refFactoryNo
  1145. this.mainForm.company = data.refUseUnit
  1146. this.mainForm.saleType = data.saleTypeId
  1147. this.mainForm.contactMan = data.refLinkman
  1148. this.mainForm.tel = data.refTel
  1149. this.mainForm.phone = data.refPhone
  1150. this.mainForm.address = data.refInstallAddress
  1151. this.mainForm.declareNo = data.refDeclareNo
  1152. this.mainForm.refCount = data.refCount
  1153. this.mainForm.greeRemark = data.geLiInerNote
  1154. this.mainForm.greeReply = data.note1
  1155. this.mainForm.remark = data.remark
  1156. this.mainForm.createMan = data.createName
  1157. this.mainForm.createDate = data.createTime
  1158. this.mainForm.fileNum = data.fileNo
  1159. this.mainForm.salesMan = data.serviceId
  1160. this.mainForm.projectRemark = data.refProjectNote
  1161. this.mainForm.projectType = data.refProjectType
  1162. this.mainForm.examineRemark = data.examineNote
  1163. this.mainForm.loginUserId = data.loginUserId
  1164. this.mainForm.regionWork = data.refRegionWork
  1165. this.mainForm.examineStatus = data.examineStatus
  1166. this.mainForm.refBuyUnitName = data.refBuyUnitName
  1167. this.mainForm.refPromiseProvide = data.refPromiseProvide
  1168. this.correspondName = data.correspondName
  1169. this.warehouseValue = data.correspondId
  1170. this.mainForm.isPlanOrder = data.isPlanOrder
  1171. data.items.forEach(item => {
  1172. item.correspondName = data.correspondName
  1173. item.warehouseValue = data.correspondId
  1174. item.status1 = ''
  1175. item.status2 = ''
  1176. item.rebateWallets = item.customerWalletList.filter(item => {
  1177. return item.type === 'REBATE'
  1178. })
  1179. item.wallets = item.customerWalletList.filter(item => {
  1180. return item.type === 'COMMONLY'
  1181. })
  1182. })
  1183. this.goodsList = data.items
  1184. })
  1185. },
  1186. // 获取商品列表
  1187. getGoodsList() {
  1188. getRetailProductList({
  1189. pageNum: this.currentPage,
  1190. pageSize: 10,
  1191. saleId: this.mainForm.saleType,
  1192. billType: 'HOME',
  1193. materialCode: this.goodsScreenForm.proNum,
  1194. materialName: this.goodsScreenForm.proName,
  1195. specification: this.goodsScreenForm.proModel,
  1196. price1: this.goodsScreenForm.price1,
  1197. price2: this.goodsScreenForm.price2,
  1198. refEnginRecordNo: this.mainForm.loginNum,
  1199. customerId: this.listItem ? this.listItem.customerId : ''
  1200. }).then(res => {
  1201. const oldGoodsList = this.goodsList
  1202. const newGoodsList = res.data.records
  1203. for (let i = 0; i < oldGoodsList.length; i++) {
  1204. const oldItem = oldGoodsList[i]
  1205. for (let j = 0; j < newGoodsList.length; j++) {
  1206. const newItem = newGoodsList[j]
  1207. if (newItem.id === oldItem.id) {
  1208. newGoodsList[j].selected = true
  1209. break
  1210. }
  1211. }
  1212. }
  1213. res.data.records.forEach(item => {
  1214. item.materialName = item.name
  1215. item.materialCode = item.number
  1216. item.saleTypeName = item.saleName
  1217. item.unit = item.baseUnit
  1218. item.enginNum = 0
  1219. item.qty = 0
  1220. item.price = item.batchPrice
  1221. item.tax = item.taxRate
  1222. item.isDirectTransfer = false
  1223. item.directTransferQty = ''
  1224. item.status1 = ''
  1225. item.status2 = ''
  1226. item.rebateAmount = ''
  1227. item.rebateRate = ''
  1228. item.productPriceId = item.id
  1229. item.customerWalletId = item.wallets && item.wallets.length ? item.wallets[0].customerWalletId : ''
  1230. })
  1231. this.leftGoodsList = res.data.records
  1232. this.listTotal = res.data.total
  1233. })
  1234. },
  1235. // 查询重复值并禁选
  1236. checkboxSelect(row, rowIndex) {
  1237. if (row.selected) {
  1238. return false // 禁用
  1239. } else {
  1240. return true // 不禁用
  1241. }
  1242. },
  1243. // 点击 选择商品
  1244. openDialog() {
  1245. if (!this.mainForm.saleType) {
  1246. return this.$errorMsg('请先选择销售类型')
  1247. }
  1248. this.isShowGoodsDialog = true
  1249. this.getGoodsList()
  1250. },
  1251. // 提交筛选表单
  1252. submitGoodsScreenForm() {
  1253. this.currentPage = 1
  1254. this.getGoodsList()
  1255. },
  1256. // 重置筛选表单
  1257. resetGoodsScreenForm() {
  1258. this.$refs.goodsScreenForm.resetFields()
  1259. this.currentRadio = ''
  1260. this.currentPage = 1
  1261. this.getGoodsList()
  1262. },
  1263. // 更改列表当前页
  1264. handleTableCurrentChange(val) {
  1265. this.currentPage = val
  1266. this.getGoodsList()
  1267. },
  1268. // 关闭 弹窗
  1269. closeDialog() {
  1270. this.isShowGoodsDialog = false
  1271. this.isSetMaterial = false
  1272. },
  1273. // 左侧列表选择
  1274. leftSelectionChange(val) {
  1275. this.leftSelection = val
  1276. },
  1277. // 右侧列表选择
  1278. rightSelectionChange(val) {
  1279. this.rightSelection = val
  1280. },
  1281. // 数组去重
  1282. delRepeat(arr1, arr2) {
  1283. const allArr = arr1.concat(arr2) // 两个数组对象合并
  1284. const newArr = [] // 存放去重后数据的新数组
  1285. for (let i = 0; i < allArr.length; i++) {
  1286. // 循环allArr数组对象的内容
  1287. let flag = true // 建立标记,判断数据是否重复,true为不重复
  1288. for (let j = 0; j < newArr.length; j++) {
  1289. // 循环新数组的内容
  1290. if (allArr[i].id == newArr[j].id) {
  1291. // 让allArr数组对象的内容与新数组的内容作比较,相同的话,改变标记为false
  1292. flag = false
  1293. }
  1294. }
  1295. if (flag) {
  1296. // 判断是否重复
  1297. newArr.push(allArr[i]) // 不重复的放入新数组。 新数组的内容会继续进行上边的循环。
  1298. }
  1299. }
  1300. return newArr
  1301. },
  1302. // 全部添加
  1303. addAllGoods() {
  1304. this.rightGoodsList = this.delRepeat(this.leftGoodsList, this.rightGoodsList)
  1305. },
  1306. // 添加
  1307. addGoods() {
  1308. this.rightGoodsList = this.delRepeat(this.leftSelection, this.rightGoodsList)
  1309. },
  1310. // 删除
  1311. deleteGoods() {
  1312. const rightGoodsList = this.rightGoodsList
  1313. const rightSelection = this.rightSelection
  1314. for (let i = 0; i < rightGoodsList.length; i++) {
  1315. for (let j = 0; j < rightSelection.length; j++) {
  1316. if (rightSelection[j].materialId == rightGoodsList[i].materialId) {
  1317. this.rightGoodsList.splice(i, 1)
  1318. }
  1319. }
  1320. }
  1321. },
  1322. // 全部删除
  1323. deleteAllGoods() {
  1324. this.rightGoodsList = []
  1325. },
  1326. // 确定 添加产品
  1327. submitAddGoods() {
  1328. // this.goodsList = this.delRepeat(this.rightGoodsList, this.goodsList);
  1329. this.goodsList = this.goodsList.concat(this.rightGoodsList)
  1330. this.goodsList.forEach((k, i) => {
  1331. this.$set(this.goodsList[i], 'realMaterialId', k.materialId)
  1332. this.$set(this.goodsList[i], 'realMaterialName', k.materialName)
  1333. this.$set(this.goodsList[i], 'realMaterialNumber', k.materialNumber)
  1334. this.$set(this.goodsList[i], 'realMaterialOldNumber', k.materialOldNumber)
  1335. this.$set(this.goodsList[i], 'realSpecification', k.specification)
  1336. if (!this.listItem) {
  1337. const str = `实装物料编号:${k.materialNumber}实装厂产品编码:${k.materialOldNumber}`
  1338. let remark
  1339. if (!this.goodsList[i].remark) {
  1340. remark = str
  1341. } else {
  1342. remark = this.goodsList[i].remark.replace(/str/g, str)
  1343. }
  1344. this.$set(this.goodsList[i], 'remark', remark)
  1345. }
  1346. })
  1347. this.isShowGoodsDialog = false
  1348. this.leftGoodsList = []
  1349. this.rightGoodsList = []
  1350. },
  1351. getRealMaterData(id) {
  1352. this.currentId = id
  1353. this.isSetMaterial = true
  1354. this.getGoodsList()
  1355. },
  1356. submitPushGoods() {
  1357. // realMaterialId
  1358. // 实装金蝶物料id
  1359. // realMaterialName
  1360. // 实装金蝶物料名称
  1361. // realMaterialNumber
  1362. // 实装金蝶物料编码
  1363. // realMaterialOldNumber
  1364. // 实装金蝶物料旧编码
  1365. // realSpecification
  1366. // 实装规格型号
  1367. const currentData = this.leftGoodsList.find(e => e.id === this.currentRadio)
  1368. this.$set(this.goodsList[this.currentId], 'realMaterialId', currentData.materialId)
  1369. this.$set(this.goodsList[this.currentId], 'realMaterialName', currentData.materialName)
  1370. this.$set(this.goodsList[this.currentId], 'realMaterialNumber', currentData.materialNumber)
  1371. this.$set(this.goodsList[this.currentId], 'realMaterialOldNumber', currentData.materialOldNumber)
  1372. this.$set(this.goodsList[this.currentId], 'realSpecification', currentData.specification)
  1373. if (!this.listItem) {
  1374. const str = `实装物料编号:${currentData.materialNumber}实装厂产品编码:${currentData.materialOldNumber}`
  1375. let remark
  1376. if (!this.goodsList[this.currentId].remark) {
  1377. remark = str
  1378. } else {
  1379. remark = this.goodsList[this.currentId].remark.replace(/str/g, str)
  1380. }
  1381. this.$set(this.goodsList[this.currentId], 'remark', remark)
  1382. }
  1383. this.isSetMaterial = false
  1384. },
  1385. // 检查库存
  1386. checkStock() {
  1387. if (!this.warehouseValue) {
  1388. return this.$errorMsg('请选择仓库')
  1389. }
  1390. if (!this.goodsList) {
  1391. return this.$errorMsg('请添加货品')
  1392. }
  1393. const ids = []
  1394. this.goodsList.forEach(item => {
  1395. ids.push(item.materialId)
  1396. })
  1397. checkStock({
  1398. correspondId: this.warehouseValue,
  1399. materialId: ids.join(',')
  1400. }).then(res => {
  1401. if (res.data) {
  1402. this.goodsList.forEach((item, index) => {
  1403. item.status1 = res.data[index].allStockNum
  1404. item.status2 = res.data[index].stockNum
  1405. })
  1406. }
  1407. })
  1408. },
  1409. status2Filter(item) {
  1410. if (item.status2 === '' || item.status2 === null || item.status2 === undefined) {
  1411. return '未检查'
  1412. } else if (item.status2 <= 0) return '无货'
  1413. if (item.status2 <= 0) {
  1414. return '无货'
  1415. } else if (item.status2 >= 1 && item.status2 <= 30) {
  1416. return item.status2
  1417. } else if (item.status2 >= 31 && item.status2 <= 1000) {
  1418. return '有货'
  1419. } else {
  1420. return '充足'
  1421. }
  1422. },
  1423. // 保存 / 提交审核
  1424. clickSubmitForm(type) {
  1425. this.$refs.mainForm.validate(valid => {
  1426. if (valid) {
  1427. for (let i = 0; i < this.goodsList.length; i++) {
  1428. if (!this.goodsList[i].customerWalletId) {
  1429. this.$errorMsg('请选择现金钱包')
  1430. return
  1431. }
  1432. if (!Number(this.goodsList[i].qty)) {
  1433. this.$errorMsg('不允许数量为0')
  1434. return
  1435. }
  1436. }
  1437. if (!this.mainForm.isPlanOrder && !this.correspondId) {
  1438. this.$errorMsg(`仓库必选`)
  1439. return
  1440. }
  1441. const goodsList = JSON.parse(JSON.stringify(this.goodsList))
  1442. goodsList.forEach(item => {
  1443. delete item.rebateWallets
  1444. delete item.wallets
  1445. })
  1446. const saleTypeItem = this.salesTypeList.find(o => o.id == this.mainForm.saleType)
  1447. const saleManItem = this.mainForm.salesMan
  1448. ? this.salesmanList.find(o => o.adminUserId == this.mainForm.salesMan)
  1449. : ''
  1450. const params = {
  1451. isPlanOrder: this.mainForm.isPlanOrder,
  1452. correspondName: this.correspondName,
  1453. correspondId: this.correspondId,
  1454. enginOrderId: this.mainForm.orderNum,
  1455. loginUserId: this.mainForm.loginUserId,
  1456. refEnginRecordNo: this.mainForm.loginNum || '',
  1457. refProjectCategory: this.mainForm.enginName || '',
  1458. refTradeCategory: this.mainForm.loginType || '',
  1459. refPromiseStatus: this.mainForm.promiseStatus || '',
  1460. refFactoryNo: this.mainForm.factoryNum || '',
  1461. refUseUnit: this.mainForm.company || '',
  1462. refLinkman: this.mainForm.contactMan || '',
  1463. refTel: this.mainForm.tel || '',
  1464. refPhone: this.mainForm.phone || '',
  1465. refInstallAddress: this.mainForm.address || '',
  1466. refDeclareNo: this.mainForm.declareNo || '',
  1467. refCount: this.mainForm.refCount || '',
  1468. saleTypeId: this.mainForm.saleType,
  1469. saleTypeCode: saleTypeItem.saleCode,
  1470. saleTypeName: saleTypeItem.saleName,
  1471. geLiInerNote: this.mainForm.greeRemark || '',
  1472. geLiNote: this.mainForm.greeReply || '',
  1473. remark: this.mainForm.remark || '',
  1474. fileNo: this.mainForm.fileNum || '',
  1475. serviceId: this.mainForm.salesMan,
  1476. serviceName: saleManItem ? saleManItem.nickName : goodsList[0].serviceName,
  1477. refProjectNote: this.mainForm.projectRemark,
  1478. refProjectType: this.mainForm.projectType,
  1479. refRegionWork: this.mainForm.regionWork,
  1480. refBuyUnitName: this.mainForm.refBuyUnitName,
  1481. refPromiseProvide: this.mainForm.refPromiseProvide,
  1482. refOtherAnnexIdea: this.mainForm.refOtherAnnexIdea,
  1483. items: goodsList
  1484. }
  1485. if (this.mainForm.examineStatus === 'WAIT') {
  1486. params.takeDeposit = false
  1487. }
  1488. this.formLoading = true
  1489. if (type === 1) {
  1490. if (this.listItem) {
  1491. editHome(params)
  1492. .then(res => {
  1493. this.$successMsg('编辑成功')
  1494. this.goBack()
  1495. this.$parent.getList()
  1496. })
  1497. .finally(res => {
  1498. this.formLoading = false
  1499. })
  1500. } else {
  1501. addHome(params)
  1502. .then(res => {
  1503. this.$successMsg('新增成功')
  1504. this.goBack()
  1505. this.$parent.getList()
  1506. })
  1507. .finally(res => {
  1508. this.formLoading = false
  1509. })
  1510. }
  1511. } else if (type === 2) {
  1512. submitHome(params)
  1513. .then(res => {
  1514. this.$successMsg('提交审核成功')
  1515. this.goBack()
  1516. this.$parent.getList()
  1517. })
  1518. .finally(res => {
  1519. this.formLoading = false
  1520. })
  1521. }
  1522. }
  1523. })
  1524. },
  1525. setMainAndItem(data) {
  1526. this.isShowDialog = false
  1527. this.mainForm.type = data.productCategory
  1528. this.mainForm.loginUserId = data.userid
  1529. // this.mainForm.saleType = '';
  1530. this.mainForm.loginNum = data.recordNo
  1531. this.mainForm.enginName = data.projectName
  1532. this.mainForm.loginType = data.tradeCategory
  1533. this.mainForm.factoryNum = data.factoryNo
  1534. this.mainForm.promiseStatus = data.promiseStatus
  1535. this.mainForm.company = data.useUnit
  1536. this.mainForm.contactMan = data.buyUnitCallMen
  1537. this.mainForm.tel = data.buyUnitTel
  1538. this.mainForm.phone = data.buyUnitPhone
  1539. this.mainForm.address = data.installAddress
  1540. this.mainForm.declareNo = data.declareNo
  1541. this.mainForm.projectRemark = data.buChonShuoMing
  1542. this.mainForm.projectType = data.govBuyType
  1543. this.mainForm.refCount = data.refCount
  1544. this.mainForm.regionWork = data.regionWork
  1545. this.mainForm.refBuyUnitName = data.buyUnitName
  1546. this.mainForm.refPromiseProvide = data.promiseProvide === 1 ? '已保证' : '未保证'
  1547. this.mainForm.refOtherAnnexIdea = data.otherAnnexIdea
  1548. const saleTypeItem = this.salesTypeList.find(o => o.id === this.mainForm.saleType)
  1549. this.goodsList = data.items.map(item => {
  1550. return {
  1551. useRefCount: item.useRefCount,
  1552. saleTypeId: saleTypeItem.id,
  1553. saleTypeCode: saleTypeItem.saleCode,
  1554. saleTypeName: saleTypeItem.saleName,
  1555. materialId: item.materialId,
  1556. materialNumber: item.materialNumber,
  1557. materialOldNumber: item.materialOldNumber,
  1558. materialName: item.materialName,
  1559. specification: item.machine,
  1560. enginNum: item.num,
  1561. enginPrice: item.price,
  1562. enginTotality: item.totality,
  1563. historyHasDeliverQty: item.hasDeliverQty,
  1564. unit: item.unit,
  1565. price: item.price,
  1566. qty: item.num,
  1567. customerWalletId2: '',
  1568. rebateRate: '',
  1569. discAmount: '',
  1570. customerWalletId: '',
  1571. isDirectTransfer: false,
  1572. directTransferQty: '',
  1573. hasSendQty: '',
  1574. remark: item.discri,
  1575. tax: '',
  1576. status1: '',
  1577. status2: '',
  1578. rebateWallets: item.customerWalletList.filter(item => {
  1579. return item.type === 'REBATE'
  1580. }),
  1581. wallets: item.customerWalletList.filter(item => {
  1582. return item.type === 'COMMONLY'
  1583. })
  1584. }
  1585. })
  1586. this.goodsList.forEach((k, i) => {
  1587. this.$set(this.goodsList[i], 'realMaterialId', k.materialId)
  1588. this.$set(this.goodsList[i], 'realMaterialName', k.materialName)
  1589. this.$set(this.goodsList[i], 'realMaterialNumber', k.materialNumber)
  1590. this.$set(this.goodsList[i], 'realMaterialOldNumber', k.materialOldNumber)
  1591. this.$set(this.goodsList[i], 'realSpecification', k.specification)
  1592. if (!this.listItem) {
  1593. const str = `实装物料编号:${k.materialNumber}实装厂产品编码:${k.materialOldNumber}`
  1594. let remark
  1595. if (!this.goodsList[i].remark) {
  1596. remark = str
  1597. } else {
  1598. remark = this.goodsList[i].remark.replace(/str/g, str)
  1599. }
  1600. this.$set(this.goodsList[i], 'remark', remark)
  1601. }
  1602. })
  1603. this.goodsList.forEach(item => {
  1604. item.customerWalletId = item.wallets && item.wallets.length ? item.wallets[0].customerWalletId : ''
  1605. item.serviceId = item.wallets && item.wallets.length ? item.wallets[0].serviceId : ''
  1606. item.serviceName = item.wallets && item.wallets.length ? item.wallets[0].serviceName : ''
  1607. })
  1608. },
  1609. async querySaleTypeGoods(oldNumbers) {
  1610. await getRetailProductList({
  1611. pageNum: 1,
  1612. pageSize: -1,
  1613. saleId: this.mainForm.saleType,
  1614. billType: 'HOME',
  1615. oldNumbers: oldNumbers.join(','),
  1616. customerId: this.mainForm.customerId
  1617. }).then(res => {
  1618. console.log('请求后可选机型接口', res.data.records)
  1619. if (!res.data.records || res.data.records.length === 0) {
  1620. this.mainForm.saleType = this.oldSaleType
  1621. console.log(1)
  1622. this.$errorMsg(oldNumbers.join(',') + ' 产品无此销售类型')
  1623. this.notInRefQueryGoodsList = ''
  1624. return
  1625. }
  1626. if (res.data.records.length < oldNumbers.length) {
  1627. const notInOldNumbers = []
  1628. for (let i = 0; i < oldNumbers.length; i++) {
  1629. const oldNumber = oldNumbers[i]
  1630. const index = res.data.records.findIndex(v => v.materialOldNumber === oldNumber)
  1631. if (index < 0) {
  1632. notInOldNumbers.push(oldNumber)
  1633. }
  1634. }
  1635. this.mainForm.saleType = this.oldSaleType
  1636. console.log(2)
  1637. this.$errorMsg(notInOldNumbers.join(',') + ' 产品无此销售类型')
  1638. this.notInRefQueryGoodsList = ''
  1639. return
  1640. }
  1641. this.notInRefQueryGoodsList = res.data.records
  1642. })
  1643. },
  1644. replaceHistoryItems(items, copyGoodsList) {
  1645. if (items && copyGoodsList) {
  1646. for (let i = 0; i < items.length; i++) {
  1647. const index = copyGoodsList.findIndex(v => v.materialOldNumber === items[i].materialOldNumber)
  1648. if (index >= 0) {
  1649. items[i].price = copyGoodsList[index].price
  1650. items[i].num = copyGoodsList[index].qty
  1651. items[i].discri = copyGoodsList[index].remark
  1652. }
  1653. }
  1654. }
  1655. return items
  1656. },
  1657. addRefItems(items, notInRefGoodsList) {
  1658. if (notInRefGoodsList && this.notInRefQueryGoodsList) {
  1659. for (let i = 0; i < notInRefGoodsList.length; i++) {
  1660. const index = this.notInRefQueryGoodsList.findIndex(
  1661. v => v.materialOldNumber === notInRefGoodsList[i].materialOldNumber
  1662. )
  1663. if (index >= 0) {
  1664. this.notInRefQueryGoodsList[index].batchPrice = notInRefGoodsList[i].price
  1665. this.notInRefQueryGoodsList[index].qty = notInRefGoodsList[i].qty
  1666. this.notInRefQueryGoodsList[index].remark = notInRefGoodsList[i].remark
  1667. }
  1668. }
  1669. console.log('非引用单产品', this.notInRefQueryGoodsList)
  1670. for (let i = 0; i < this.notInRefQueryGoodsList.length; i++) {
  1671. const goods = this.notInRefQueryGoodsList[i]
  1672. const customerWalletList = [].concat(goods.rebateWallets).concat(goods.wallets)
  1673. items.push({
  1674. saleTypeId: goods.saleTypeId,
  1675. saleTypeCode: goods.saleTypeCode,
  1676. saleTypeName: goods.saleTypeName,
  1677. materialId: goods.materialId,
  1678. materialNumber: goods.materialNumber,
  1679. materialOldNumber: goods.materialOldNumber,
  1680. materialName: goods.materialName,
  1681. machine: goods.specification,
  1682. num: goods.qty,
  1683. batchPrice: goods.batchPrice,
  1684. discri: goods.remark,
  1685. customerWalletList: customerWalletList
  1686. })
  1687. }
  1688. }
  1689. }
  1690. }
  1691. }
  1692. </script>
  1693. <style scoped lang="scss">
  1694. ::v-deep .input .el-input__inner {
  1695. color: blue;
  1696. }
  1697. .detail-container {
  1698. width: 100%;
  1699. height: 100%;
  1700. }
  1701. .main-title {
  1702. display: flex;
  1703. justify-content: space-between;
  1704. align-items: center;
  1705. margin-top: 20px;
  1706. height: 60px;
  1707. border-bottom: 1px solid #dcdfe6;
  1708. margin-bottom: 20px;
  1709. .title {
  1710. font-size: 16px;
  1711. font-weight: 600;
  1712. padding-left: 10px;
  1713. }
  1714. }
  1715. .tables {
  1716. display: flex;
  1717. margin-top: 10px;
  1718. .table {
  1719. width: 45%;
  1720. }
  1721. .buttons {
  1722. display: flex;
  1723. flex-direction: column;
  1724. justify-content: center;
  1725. align-items: center;
  1726. padding: 0 10px;
  1727. button {
  1728. margin: 0;
  1729. margin-top: 10px;
  1730. }
  1731. }
  1732. }
  1733. ::v-deep input::-webkit-outer-spin-button,
  1734. ::v-deep input::-webkit-inner-spin-button {
  1735. -webkit-appearance: none;
  1736. }
  1737. ::v-deep input[type='number'] {
  1738. -moz-appearance: textfield;
  1739. }
  1740. </style>