home_form.vue 68 KB

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