retail_form.vue 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022
  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 ref="mainForm" :model="mainForm" label-width="120px" size="small" label-position="right">
  8. <el-row :gutter="20">
  9. <el-col :xs="24" :sm="12" :lg="12">
  10. <el-form-item label="销售政策编号" prop="policyCode">
  11. <div style="display: flex">
  12. <el-input v-model="policyId" placeholder="销售政策编号" disabled />
  13. <el-button style="margin-left: 10px" size="small" @click="handleShow">引用</el-button>
  14. </div>
  15. </el-form-item>
  16. </el-col>
  17. <!-- <el-col :xs="24" :sm="12" :lg="8" v-else>
  18. <el-form-item label="销售政策编号" prop="policyCode">
  19. <el-input
  20. disabled
  21. v-model="mainForm.policyId"
  22. placeholder="销售政策编号"
  23. ></el-input>
  24. </el-form-item>
  25. </el-col> -->
  26. <el-col :xs="24" :sm="12" :lg="12" style="height: 51px">
  27. <el-form-item label="单据日期" prop="date">
  28. <el-date-picker
  29. v-model="mainForm.date"
  30. type="datetime"
  31. disabled
  32. style="width: 100%"
  33. placeholder="选择日期"
  34. />
  35. </el-form-item>
  36. </el-col>
  37. <el-col :xs="24" :sm="12" :lg="12">
  38. <el-form-item label="表头备注" prop="remark">
  39. <el-input v-model="mainForm.remark" placeholder="请输入表头备注" />
  40. </el-form-item>
  41. </el-col>
  42. <el-col :xs="24" :sm="12" :lg="12">
  43. <el-form-item label="文件编号" prop="fileNum">
  44. <el-input v-model="mainForm.fileNum" placeholder="请输入文件编号" />
  45. </el-form-item>
  46. </el-col>
  47. <el-col :xs="24" :sm="12" :lg="12">
  48. <el-form-item label="业务员" prop="k3ServiceName">
  49. <el-select
  50. v-model="mainForm.k3ServiceName"
  51. placeholder="选择业务员"
  52. style="width: 100%"
  53. filterable
  54. @change="handleUser"
  55. >
  56. <el-option
  57. v-for="item in userList"
  58. :key="item.adminUserId"
  59. :label="item.nickName"
  60. :value="item.adminUserId"
  61. />
  62. </el-select>
  63. </el-form-item>
  64. </el-col>
  65. <el-col :span="24" :sm="12" :lg="12" v-if="goodsList.length && commercialType">
  66. <el-form-item label="计划单" prop="isPlanOrder">
  67. <el-radio-group v-model="mainForm.isPlanOrder">
  68. <el-radio :label="true">是</el-radio>
  69. <el-radio :label="false">否</el-radio>
  70. </el-radio-group>
  71. </el-form-item>
  72. </el-col>
  73. <!-- <el-col :span="24" :sm="12" :lg="12" >-->
  74. <!-- <el-form-item label="计划单" prop="isPlanOrder">-->
  75. <!-- <el-radio-group v-model="mainForm.isPlanOrder">-->
  76. <!-- <el-radio :label="true">是</el-radio>-->
  77. <!-- <el-radio :label="false">否</el-radio>-->
  78. <!-- </el-radio-group>-->
  79. <!-- <span style="color: #ff0000; margin-left: 20px">注:如需开直调单,请下计划单,不要下非计划单</span>-->
  80. <!-- </el-form-item>-->
  81. <!-- </el-col>-->
  82. </el-row>
  83. </el-form>
  84. <div class="main-title">
  85. <div class="title">货品信息</div>
  86. <div>
  87. <el-select
  88. v-model="warehouseValue"
  89. placeholder="请选择发货仓库"
  90. :disabled="!goodsList.length"
  91. size="small"
  92. style="margin-right: 10px"
  93. @change="handleWarehouseValue"
  94. >
  95. <el-option v-for="(item, index) in warehouseList" :key="index" :label="item.name" :value="item.id" />
  96. </el-select>
  97. <el-button type="primary" size="small" icon="el-icon-search" @click="checkStock">检查库存</el-button>
  98. <el-divider direction="vertical" />
  99. </div>
  100. </div>
  101. <div class="table">
  102. <el-table
  103. :data="goodsList"
  104. element-loading-text="Loading"
  105. border
  106. fit
  107. show-summary
  108. :summary-method="$getSummaries"
  109. highlight-current-row
  110. stripe
  111. max-height="400"
  112. >
  113. <el-table-column align="left" label="序号" type="index" width="50" />
  114. <el-table-column align="left" label="销售类型" prop="saleTypeName" min-width="100" show-overflow-tooltip />
  115. <el-table-column align="left" label="物料编码" prop="materialNumber" min-width="200" show-overflow-tooltip>
  116. <template slot-scope="scope">
  117. <CopyButton :copy-text="scope.row.materialNumber ? scope.row.materialNumber : scope.row.materialCode" />
  118. <span> {{ scope.row.materialNumber ? scope.row.materialNumber : scope.row.materialCode }}</span>
  119. </template>
  120. </el-table-column>
  121. <el-table-column align="left" label="产品名称" prop="materialName" min-width="200" show-overflow-tooltip>
  122. <template slot-scope="scope">
  123. <CopyButton :copy-text="scope.row.materialName" />
  124. <span> {{ scope.row.materialName }}</span>
  125. </template>
  126. </el-table-column>
  127. <el-table-column align="left" label="规格型号" prop="specification" min-width="200" show-overflow-tooltip>
  128. <template slot-scope="scope">
  129. <CopyButton :copy-text="scope.row.specification" />
  130. <span> {{ scope.row.specification }}</span>
  131. </template>
  132. </el-table-column>
  133. <el-table-column align="left" label="单位" prop="unit" min-width="100" show-overflow-tooltip />
  134. <el-table-column align="right" label="单价" prop="price" min-width="100" show-overflow-tooltip />
  135. <el-table-column align="right" label="总数量" prop="qty" min-width="100" show-overflow-tooltip>
  136. <template slot-scope="scope">
  137. <el-input v-model="scope.row.qty" class="yinput" size="small" />
  138. </template>
  139. </el-table-column>
  140. <el-table-column align="right" label="订单金额" min-width="100" prop="compute_amount" show-overflow-tooltip>
  141. <template slot-scope="scope">
  142. {{ (scope.row.price * scope.row.qty) | numToFixed }}
  143. </template>
  144. </el-table-column>
  145. <el-table-column align="left" label="返利钱包" prop="customerWalletId2" min-width="160" show-overflow-tooltip>
  146. <template slot-scope="scope">
  147. <el-select
  148. v-model="scope.row.customerWalletId2"
  149. placeholder="选择返利钱包"
  150. clearable
  151. size="small"
  152. @remove-tag="clearWallet($event, scope.row)"
  153. @change="changeWallet($event, scope.row)"
  154. >
  155. <el-option
  156. v-for="item in scope.row.rebateWallets"
  157. :key="item.customerWalletId"
  158. :label="item.name"
  159. :value="item.customerWalletId"
  160. />
  161. </el-select>
  162. </template>
  163. </el-table-column>
  164. <el-table-column align="right" label="返利金额" min-width="100" prop="compute_flAmount" show-overflow-tooltip>
  165. <template slot-scope="scope">
  166. {{ ((scope.row.price - scope.row.discAmount) * scope.row.qty * ((scope.row.rebateRate || 0) * 100)) / 100 }}
  167. </template>
  168. </el-table-column>
  169. <el-table-column align="right" label="格力折扣" min-width="100" prop="compute_zkAmount" show-overflow-tooltip>
  170. <template slot-scope="scope">
  171. {{ (scope.row.qty * scope.row.discAmount) | numToFixed }}
  172. </template>
  173. </el-table-column>
  174. <el-table-column align="left" label="现金钱包" prop="customerWalletId" min-width="160" show-overflow-tooltip>
  175. <template slot-scope="scope">
  176. <el-select
  177. v-model="scope.row.customerWalletId"
  178. placeholder="选择现金钱包"
  179. clearable
  180. size="small"
  181. @change="handleWallets($event, scope.row, scope.$index)"
  182. >
  183. <el-option
  184. v-for="item in scope.row.wallets"
  185. :key="item.customerWalletId"
  186. :label="item.name"
  187. :value="item.customerWalletId"
  188. />
  189. </el-select>
  190. </template>
  191. </el-table-column>
  192. <!-- <el-table-column-->
  193. <!-- align="left"-->
  194. <!-- label="业务员"-->
  195. <!-- prop="retiredQty"-->
  196. <!-- min-width="160"-->
  197. <!-- show-overflow-tooltip-->
  198. <!-- >-->
  199. <!-- <template slot-scope="scope">-->
  200. <!-- <el-select-->
  201. <!-- v-model="scope.row.serviceName"-->
  202. <!-- size="small"-->
  203. <!-- disabled-->
  204. <!-- placeholder="选择业务员"-->
  205. <!-- style="width: 100%"-->
  206. <!-- @change="handleUser2($event,scope.row)"-->
  207. <!-- >-->
  208. <!-- <el-option-->
  209. <!-- v-for="item in scope.row.userList"-->
  210. <!-- :key="item.adminUserId"-->
  211. <!-- :label="item.nickName"-->
  212. <!-- :value="item.adminUserId"-->
  213. <!-- />-->
  214. <!-- </el-select>-->
  215. <!-- </template>-->
  216. <!-- </el-table-column>-->
  217. <el-table-column align="right" label="可用返利" prop="amount" min-width="100" show-overflow-tooltip>
  218. <template slot-scope="scope">
  219. <div>{{ scope.row.amount | numToFixed }}</div>
  220. </template>
  221. </el-table-column>
  222. <el-table-column
  223. align="right"
  224. label="使用返利金额"
  225. prop="compute_flAmount"
  226. min-width="120"
  227. show-overflow-tooltip
  228. >
  229. <template slot-scope="scope">
  230. {{
  231. (((scope.row.price - scope.row.discAmount) * scope.row.qty * (scope.row.rebateRate * 100)) / 100)
  232. | numToFixed
  233. }}
  234. </template>
  235. </el-table-column>
  236. <el-table-column align="right" label="实付金额" min-width="100" prop="compute_sfAmount" show-overflow-tooltip>
  237. <template slot-scope="scope">
  238. {{ comTatol(scope.row) | numToFixed }}
  239. <!-- {{(scope.row.price - (scope.row.qty * scope.row.discAmount) -(((scope.row.price - scope.row.discAmount) * scope.row.qty * ((scope.row.rebateRate || 0) * 100)) / 100))*scope.row.qty | numToFixed }} -->
  240. <!-- {{ (((scope.row.price * scope.row.qty) * 100 - ((scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) / 100) * 100 - ((scope.row.qty * (scope.row.discAmount * 100)) / 100) * 100) / 100) | numToFixed }} -->
  241. </template>
  242. </el-table-column>
  243. <el-table-column align="left" label="是否直调" prop="isDirectTransfer" min-width="100">
  244. <template slot-scope="scope">
  245. <el-checkbox v-model="scope.row.isDirectTransfer" @change="hasRak($event, scope.row)" />
  246. </template>
  247. </el-table-column>
  248. <!-- <el-table-column
  249. align="left"
  250. label="直调数量"
  251. prop="directTransferQty"
  252. min-width="100"
  253. >
  254. <template slot-scope="scope">
  255. <el-input
  256. v-model="scope.row.directTransferQty"
  257. size="small"
  258. ></el-input>
  259. </template>
  260. </el-table-column> -->
  261. <el-table-column align="left" label="表体备注" prop="remark" min-width="160">
  262. <template slot-scope="scope">
  263. <el-input v-model="scope.row.remark" size="small" />
  264. </template>
  265. </el-table-column>
  266. <el-table-column align="right" label="税率" prop="tax" min-width="100" show-overflow-tooltip />
  267. <!-- <el-table-column-->
  268. <!-- v-if="!listItem"-->
  269. <!-- align="left"-->
  270. <!-- label="总仓库"-->
  271. <!-- prop="status1"-->
  272. <!-- min-width="100"-->
  273. <!-- show-overflow-tooltip-->
  274. <!-- >-->
  275. <!-- <template slot-scope="scope">-->
  276. <!-- <div>{{ scope.row.status1 | status1Filter }}</div>-->
  277. <!-- </template>-->
  278. <!-- </el-table-column>-->
  279. <el-table-column align="left" label="仓库" prop="correspondName" min-width="150" show-overflow-tooltip />
  280. <el-table-column
  281. v-if="!listItem"
  282. align="left"
  283. label="仓库状态"
  284. prop="status2"
  285. min-width="100"
  286. show-overflow-tooltip
  287. >
  288. <template slot-scope="scope">
  289. <div>{{ status2Filter(scope.row) }}</div>
  290. </template>
  291. </el-table-column>
  292. <el-table-column align="left" label="操作" width="100" fixed="right">
  293. <template slot-scope="scope">
  294. <!-- <el-button
  295. type="text"
  296. @click="(dialogVisible = true), (cid = scope.row.id)"
  297. >修改</el-button
  298. > -->
  299. <el-button type="text" @click="deleteItem(scope.$index, scope.row.id)">删除</el-button>
  300. </template>
  301. </el-table-column>
  302. </el-table>
  303. </div>
  304. <div class="page-footer">
  305. <div class="footer" :class="classObj">
  306. <el-button type="primary" @click="clickSubmitForm">保 存</el-button>
  307. <el-popconfirm title="确定关闭吗?" style="margin-left: 10px" @onConfirm="goBack">
  308. <el-button slot="reference">返回列表</el-button>
  309. </el-popconfirm>
  310. </div>
  311. </div>
  312. <el-dialog
  313. :visible.sync="isShowDialog"
  314. width="80%"
  315. :close-on-click-modal="false"
  316. title="引用销售政策"
  317. @close="handleClose"
  318. >
  319. <template>
  320. <el-form ref="screenForm" :model="screenForm" label-width="120px" label-position="left" size="small">
  321. <el-row v-if="factor.length && !dataList.length" style="margin: 0 0 20px 0; font-size: 20px">
  322. 引用销售政策表头备注:{{ !remark ? factor[0].name : remark }} 配提比例:{{ pop }}
  323. </el-row>
  324. <el-row
  325. v-if="factor.length && !dataList.length && factor[0].remark"
  326. style="margin: 0 0 20px 0; font-size: 20px"
  327. >
  328. 备注:{{ factor[0].remark }}
  329. </el-row>
  330. <el-row :gutter="20">
  331. <el-col :xs="24" :sm="12" :lg="12">
  332. <el-form-item label="规格型号">
  333. <div style="display: flex">
  334. <el-input v-model="screenForm.specification" placeholder="请输入规格型号" />
  335. <el-button style="margin-left: 10px" type="primary" size="mini" @click="handleGetPolicyList"
  336. >查询</el-button
  337. >
  338. </div>
  339. </el-form-item>
  340. </el-col>
  341. <el-col :xs="24" :sm="12" :lg="12">
  342. <el-form-item label="销售政策" class="myselect">
  343. <el-select
  344. v-model="screenForm.policyId"
  345. placeholder="选择销售政策"
  346. filterable
  347. :disabled="disabled"
  348. style="width: 100%"
  349. @change="handlePolicy"
  350. >
  351. <el-option v-for="item in policyList" :key="item.code" :label="item.title" :value="item.code">
  352. <span>{{ item.title }}</span>
  353. <span v-if="item.policyRemark" style="margin-left: 15px; color: #f00; font-size: 12px"
  354. >( {{ item.policyRemark }} )</span
  355. >
  356. </el-option>
  357. </el-select>
  358. </el-form-item>
  359. </el-col>
  360. <el-col :xs="24" :sm="12" :lg="12">
  361. <el-form-item label="规格型号">
  362. <div style="display: flex">
  363. <el-input v-model="screenForm.specifications" placeholder="请输入型号规格型号" />
  364. </div>
  365. </el-form-item>
  366. </el-col>
  367. <el-col :xs="24" :sm="12" :lg="12">
  368. <el-form-item label="销售类型">
  369. <el-select
  370. v-model="screenForm.saleTypeCode"
  371. filterable
  372. placeholder="选择销售类型"
  373. style="width: 100%"
  374. clearable
  375. >
  376. <el-option v-for="item in ztypeList" :key="item.id" :label="item.saleName" :value="item.saleCode" />
  377. </el-select>
  378. </el-form-item>
  379. </el-col>
  380. <el-col :xs="24" :sm="12" :lg="12">
  381. <el-form-item label="价格类型">
  382. <div style="display: flex">
  383. <el-input v-model="screenForm.priceType" placeholder="请输入价格类型" />
  384. </div>
  385. </el-form-item>
  386. </el-col>
  387. <el-col :xs="22" :sm="22" :lg="12" class="tr">
  388. <!-- <el-button
  389. type="primary"
  390. size="small"
  391. @click="handlePolicyTypeList"
  392. >查询</el-button> -->
  393. <el-button type="primary" size="small" @click="handlePolicyTypeList">查询</el-button>
  394. </el-col>
  395. </el-row>
  396. </el-form>
  397. <template v-if="!dataList.length">
  398. <div v-for="(item, index) in popDataArr" :key="index">
  399. <div style="padding: 20px 0">
  400. <div v-if="index == 0">限定机型</div>
  401. <div v-else>配提机型{{ index }}</div>
  402. </div>
  403. <el-table
  404. ref="singleTable"
  405. v-loading="listLoading"
  406. class="table"
  407. :data="item"
  408. element-loading-text="Loading"
  409. max-height="500"
  410. border
  411. fit
  412. highlight-current-row
  413. stripe
  414. @select-all="handleSelectionChange($event, 1, index)"
  415. @selection-change="handleSelectionChange($event, 1, index)"
  416. >
  417. <el-table-column align="left" type="selection" :selectable="selectable" width="55" />
  418. <template v-for="col in columns">
  419. <el-table-column
  420. v-if="col.num"
  421. :align="col.align"
  422. :label="col.lable"
  423. :prop="col.prop"
  424. :min-width="col.widht"
  425. show-overflow-tooltip
  426. >
  427. <template slot-scope="scope">
  428. <el-input
  429. v-model.lazy="scope.row.qty"
  430. type="number"
  431. size="small"
  432. class="yinput"
  433. @mousewheel.native.prevent
  434. @blur="blurQty(scope.row.qty, scope.row)"
  435. @input="funQty(scope.row.qty, scope.row, index)"
  436. />
  437. </template>
  438. </el-table-column>
  439. <el-table-column
  440. v-else-if="col.jie"
  441. :align="col.align"
  442. :label="col.lable"
  443. :prop="col.prop"
  444. :min-width="col.widht"
  445. show-overflow-tooltip
  446. >
  447. <template slot-scope="scope">
  448. {{ scope.row.qty * scope.row.price || 0 | numToFixed }}
  449. </template>
  450. </el-table-column>
  451. <el-table-column
  452. v-else
  453. :align="col.align"
  454. :label="col.lable"
  455. :prop="col.prop"
  456. :min-width="col.widht"
  457. show-overflow-tooltip
  458. >
  459. <template slot-scope="scope">
  460. <template v-if="col.lable == '产品名称' || col.lable == '规格型号' || col.lable == '价格类型'">
  461. <CopyButton :copy-text="scope.row[col.prop]" />
  462. <span> {{ scope.row[col.prop] }}</span>
  463. </template>
  464. <template v-else>
  465. {{ scope.row[col.prop] || 0 | numToFixed }}
  466. </template>
  467. </template>
  468. </el-table-column>
  469. </template>
  470. <template #append>
  471. <div class="mybox">
  472. <el-row class="mybox-row" type="flex">
  473. <el-col style="width: 55px">合计</el-col>
  474. <el-col />
  475. <el-col />
  476. <el-col />
  477. <el-col />
  478. <el-col>{{ totalArr[index].totalQty }}</el-col>
  479. <el-col>{{ totalArr[index].totalPrice | numToFixed }}</el-col>
  480. <el-col>{{ totalArr[index].totalAmount | numToFixed }}</el-col>
  481. </el-row>
  482. </div>
  483. </template>
  484. </el-table>
  485. <!-- <div style="margin: 10px 0">
  486. 分页
  487. <el-pagination
  488. @size-change="
  489. popfun['handleSizeChange' + (index + 1)]($event, index + 1)
  490. "
  491. @current-change="
  492. popfun['handleCurrentChange' + (index + 1)]($event, index + 1)
  493. "
  494. :current-page="popcun['cun' + (index + 1)]"
  495. :page-sizes="[10]"
  496. :page-size="10"
  497. layout="total, sizes, prev, pager, next, jumper"
  498. :total="poptotal['total' + (index + 1)]"
  499. >
  500. </el-pagination>
  501. </div> -->
  502. </div>
  503. <!-- <div v-if="factor.length">-->
  504. <!-- 引用销售政策说明:{{ factor.length ? factor[0].name : "" }} 配提比列:{{pop}}-->
  505. <!-- </div>-->
  506. <span slot="footer" class="dialog-footer">
  507. <el-button type="primary" @click="hanlePopData">完成</el-button>
  508. </span>
  509. </template>
  510. <template v-else>
  511. <el-table
  512. ref="singleTable"
  513. v-loading="listLoading2"
  514. class="table"
  515. :data="dataList"
  516. element-loading-text="Loading"
  517. border
  518. fit
  519. max-height="500"
  520. highlight-current-row
  521. stripe
  522. @select-all="handleSelectionChange"
  523. @selection-change="handleSelectionChange"
  524. >
  525. <el-table-column align="left" type="selection" :selectable="selectable2" width="55" />
  526. <template v-for="col in columns">
  527. <el-table-column
  528. v-if="col.num"
  529. :align="col.align"
  530. :label="col.lable"
  531. :prop="col.prop"
  532. :min-width="col.widht"
  533. show-overflow-tooltip
  534. >
  535. <template slot-scope="scope">
  536. <el-input
  537. v-model.lazy="scope.row.qty"
  538. type="number"
  539. class="yinput"
  540. size="small"
  541. @mousewheel.native.prevent
  542. @blur="blurQty(scope.row.qty, scope.row)"
  543. @input="funQty(scope.row.qty, scope.row)"
  544. />
  545. </template>
  546. </el-table-column>
  547. <el-table-column
  548. v-else-if="col.jie"
  549. :align="col.align"
  550. :label="col.lable"
  551. :prop="col.prop"
  552. :min-width="col.widht"
  553. show-overflow-tooltip
  554. >
  555. <template slot-scope="scope">
  556. {{ scope.row.qty * scope.row.price || 0 | numToFixed }}
  557. </template>
  558. </el-table-column>
  559. <el-table-column
  560. v-else
  561. :align="col.align"
  562. :label="col.lable"
  563. :prop="col.prop"
  564. :min-width="col.widht"
  565. show-overflow-tooltip
  566. >
  567. <template slot-scope="scope">
  568. <template v-if="col.lable == '产品名称' || col.lable == '规格型号' || col.lable == '价格类型'">
  569. <CopyButton :copy-text="scope.row[col.prop]" />
  570. <span> {{ scope.row[col.prop] }}</span>
  571. </template>
  572. <template v-else>
  573. {{ scope.row[col.prop] || 0 | numToFixed }}
  574. </template>
  575. </template>
  576. </el-table-column>
  577. </template>
  578. <template #append>
  579. <div class="mybox">
  580. <el-row class="mybox-row" type="flex">
  581. <el-col style="width: 55px">合计</el-col>
  582. <el-col />
  583. <el-col />
  584. <el-col />
  585. <el-col />
  586. <el-col>{{ totalQty }}</el-col>
  587. <el-col>{{ totalPrice | numToFixed }}</el-col>
  588. <el-col>{{ totalAmount | numToFixed }}</el-col>
  589. </el-row>
  590. </div>
  591. </template>
  592. </el-table>
  593. <!-- <div style="margin: 10px 0">
  594. <el-pagination
  595. @size-change="handleSizeChange"
  596. @current-change="handleCurrentChange"
  597. :current-page="currentPage"
  598. :page-sizes="[10]"
  599. :page-size="10"
  600. layout="total, sizes, prev, pager, next, jumper"
  601. :total="total"
  602. >
  603. </el-pagination>
  604. </div> -->
  605. <span slot="footer" class="dialog-footer">
  606. <el-button type="primary" @click="hanlePopData">完成</el-button>
  607. </span>
  608. </template>
  609. </template>
  610. </el-dialog>
  611. </div>
  612. </template>
  613. <script>
  614. import {
  615. addData,
  616. checkStock,
  617. editData,
  618. getConditionList,
  619. getDetail,
  620. getGoodsList,
  621. getMaterialTypeList,
  622. getPolicyConditionList,
  623. getpolicyList,
  624. getpolicyTypeList,
  625. getSalesTypeList,
  626. getUserList,
  627. getWalletList,
  628. getWarehouseList,
  629. policyList,
  630. typeList,
  631. hasRak
  632. } from '@/api/supply/policy'
  633. import { getDictList } from '@/api/common'
  634. import { mapGetters } from 'vuex'
  635. export default {
  636. name: 'RetailForm',
  637. componentName: 'RetailForm',
  638. filters: {
  639. status1Filter(val) {
  640. if (val === '' || val === null || val === undefined) return '未检查'
  641. else if (val === 0) return '无货'
  642. else if (val > 0 && val <= 30) return val
  643. else if (val > 30 && val <= 1000) return '有货'
  644. else if (val > 1000) return '充足'
  645. }
  646. },
  647. props: ['listItem'],
  648. data() {
  649. return {
  650. tableData: [],
  651. currentPage: 1, // 当前页码
  652. pageSize: 10, // 每页数量
  653. listTotal: 0, // 列表总数
  654. cusIndex: 0,
  655. total: 0,
  656. radio: '',
  657. pop: '',
  658. dialogVisible: false,
  659. factor: [],
  660. popArr: [],
  661. mainForm: {
  662. id: '',
  663. date: '',
  664. type: '',
  665. ztype: '',
  666. remark: '',
  667. fileNum: '',
  668. policyCode: '',
  669. isPlanOrder: true,
  670. policyRemark: '',
  671. policyId: '',
  672. k3ServiceId: '',
  673. k3ServiceName: ''
  674. },
  675. // mainFormRules: {
  676. // type: [{ required: true, message: "请选择品类", trigger: "change" }],
  677. // },
  678. goodsList: [],
  679. warehouseList: [],
  680. warehouseValue: '',
  681. isShowDialog: false,
  682. screenForm: {
  683. policyId: '',
  684. saleTypeCode: '',
  685. factorId: '',
  686. specification: '',
  687. priceType: '',
  688. specifications: ''
  689. },
  690. salesTypeList: [],
  691. typeList: [],
  692. ztypeList: [],
  693. leftGoodsList: [],
  694. rightGoodsList: [],
  695. leftSelection: [],
  696. rightSelection: [],
  697. policyList: [],
  698. xjWalletList: [],
  699. flWalletList: [],
  700. dataList: [],
  701. columns: [
  702. {
  703. prop: 'saleTypeName',
  704. lable: '销售类型',
  705. widht: 200,
  706. align: 'left'
  707. },
  708. {
  709. prop: 'materialName',
  710. lable: '产品名称',
  711. widht: 200,
  712. align: 'left'
  713. },
  714. {
  715. prop: 'specification',
  716. lable: '规格型号',
  717. widht: 350,
  718. align: 'left'
  719. },
  720. {
  721. prop: 'priceType',
  722. lable: '价格类型',
  723. widht: 200,
  724. align: 'left'
  725. },
  726. {
  727. prop: 'qty',
  728. lable: '数量',
  729. widht: 200,
  730. num: true,
  731. align: 'right'
  732. },
  733. {
  734. prop: 'price',
  735. lable: '单价',
  736. widht: 200,
  737. align: 'right'
  738. },
  739. {
  740. prop: 'zong',
  741. widht: 200,
  742. lable: '金额',
  743. jie: true,
  744. align: 'right'
  745. }
  746. ],
  747. listLoading: false,
  748. listLoading2: false,
  749. popDataArr: [],
  750. radioObj: {},
  751. step: 0,
  752. policyId: '',
  753. policyConditionId: '',
  754. multipleSelection: [],
  755. multipleSelections: [],
  756. multipleData: [],
  757. disabled: false,
  758. cid: '',
  759. newDataList: [],
  760. userList: [],
  761. fang: false,
  762. popfun: {},
  763. poptotal: {},
  764. popcun: {},
  765. totalQty: 0,
  766. totalPrice: 0,
  767. totalAmount: 0,
  768. totalArr: [],
  769. type: 1,
  770. newMultipleSelections: [],
  771. remark: '',
  772. commercialType: false,
  773. correspondName: '',
  774. correspondId: ''
  775. }
  776. },
  777. computed: {
  778. ...mapGetters(['websitNumber']),
  779. sidebar() {
  780. // console.log(11145454);
  781. return this.$store.state.app.sidebar
  782. },
  783. classObj() {
  784. return {
  785. hideSidebar: !this.sidebar.opened,
  786. openSidebar: this.sidebar.opened
  787. }
  788. },
  789. comxjWalletList() {
  790. return c => {
  791. // // consloe(c, "现金钱包");
  792. const walle = []
  793. const ovalVall = c == undefined || !c.length ? [] : c
  794. for (let i = 0; i < this.xjWalletList.length; i++) {
  795. for (let j = 0; j < ovalVall.length; j++) {
  796. if (this.xjWalletList[i].walletRebateId == ovalVall[j].walletId) {
  797. walle.push(this.xjWalletList[i])
  798. }
  799. }
  800. }
  801. return walle
  802. }
  803. },
  804. comText() {
  805. return val => {
  806. if (this.cusIndex - 1 == 0) {
  807. const params = this.radio.split('&')
  808. return this.dataList.filter(k => {
  809. return k.id == params[0]
  810. })[0][val]
  811. } else {
  812. const params = this.radioObj['radio' + (this.cusIndex - 1)].split('&')
  813. return this.popDataArr[this.cusIndex - 2].filter(k => {
  814. return k.id == params[0]
  815. })[0][val]
  816. }
  817. }
  818. },
  819. // pickerOptions({ $props }) {
  820. // return {
  821. // disabledDate: (time) => {
  822. // return time.getTime() < Date.now() - 1 * 24 * 60 * 60 * 1000;
  823. // },
  824. // };
  825. // },
  826. comTatol() {
  827. return row => {
  828. return (
  829. row.price * row.qty -
  830. row.qty * row.discAmount -
  831. ((row.price - row.discAmount) * row.qty * ((row.rebateRate || 0) * 100)) / 100
  832. )
  833. }
  834. }
  835. },
  836. watch: {
  837. goodsList: {
  838. handler(newValue, oldValue) {
  839. if (newValue && newValue.length) {
  840. newValue.forEach((item, index) => {
  841. this.goodsList[index].policyConditionId = this.policyConditionId
  842. if (this.correspondId) {
  843. this.goodsList[index].correspondName = this.correspondName
  844. this.goodsList[index].correspondId = this.correspondId
  845. }
  846. this.goodsList[index].compute_amount = item.price * item.qty
  847. this.goodsList[index].compute_flAmount =
  848. ((item.price - item.discAmount) * item.qty * (item.rebateRate * 100)) / 100
  849. this.goodsList[index].compute_zkAmount = item.qty * item.discAmount
  850. this.goodsList[index].compute_sfAmount =
  851. item.price * item.qty -
  852. item.qty * item.discAmount -
  853. ((item.price - item.discAmount) * item.qty * ((item.rebateRate || 0) * 100)) / 100
  854. })
  855. }
  856. this.goodsList = newValue
  857. },
  858. immediate: true,
  859. deep: true
  860. }
  861. },
  862. created() {
  863. this.getDictList()
  864. this.getWalletList()
  865. this.getWarehouseList()
  866. this.getTypeList()
  867. this.getUserList()
  868. if (this.listItem) {
  869. this.getDetail()
  870. }
  871. },
  872. methods: {
  873. blurQty(e, row) {
  874. if (!e) {
  875. this.$set(row, 'qty', 1)
  876. }
  877. },
  878. funQty(qty, row, index) {
  879. if (row.fang) {
  880. if (this.type == 1) {
  881. this.$set(this.totalArr, index, {
  882. totalQty: 0,
  883. totalPrice: 0,
  884. totalAmount: 0
  885. })
  886. let sum = 0
  887. for (let j = 0; j < this.multipleSelections[index].length; j++) {
  888. this.multipleSelections[index][j].fang = true
  889. sum += +this.multipleSelections[index][j].qty
  890. this.totalArr[index].totalPrice += +this.multipleSelections[index][j].price
  891. this.totalArr[index].totalAmount += +this.multipleSelections[index][j].price * +qty
  892. }
  893. this.totalArr[index].totalQty = sum
  894. } else {
  895. let sum = 0
  896. this.totalQty = this.totalPrice = this.totalAmount = 0
  897. for (let i = 0; i < this.multipleSelection.length; i++) {
  898. sum += +this.multipleSelection[i].qty
  899. this.totalPrice += +this.multipleSelection[i].price
  900. this.totalAmount += +this.multipleSelection[i].price * +qty
  901. }
  902. this.totalQty += sum
  903. }
  904. }
  905. },
  906. getUserList() {
  907. getUserList({
  908. pageNum: 1,
  909. pageSize: -1,
  910. adminWebsitId: '',
  911. isCustomer: 0,
  912. roleId: '',
  913. status: true,
  914. userName: ''
  915. }).then(res => {
  916. this.userList = res.data.records
  917. // // consloe(this.userList,'122');
  918. })
  919. },
  920. handleUser(e) {
  921. const user = this.userList.filter(k => {
  922. return k.adminUserId == e
  923. })[0]
  924. this.mainForm.k3ServiceId = user.adminUserId
  925. this.mainForm.k3ServiceName = user.nickName
  926. },
  927. handleUser2(e, row) {
  928. const user = this.userList.filter(k => {
  929. return k.adminUserId == e
  930. })[0]
  931. this.$set(row, 'serviceId', user.adminUserId)
  932. this.$set(row, 'serviceName', user.nickName)
  933. this.$set(this.mainForm, 'k3ServiceId', user.adminUserId)
  934. this.$set(this.mainForm, 'k3ServiceName', user.nickName)
  935. },
  936. hasRak(e) {
  937. const ids = this.goodsList.map(k => {
  938. return k.materialId
  939. })
  940. hasRak({ id: ids.join(',') }).then(res => {
  941. if (e) {
  942. if (res.data) {
  943. this.goodsList.forEach(i => {
  944. this.$set(i, 'isDirectTransfer', true)
  945. })
  946. }
  947. } else {
  948. if (res.data) {
  949. this.goodsList.forEach(i => {
  950. this.$set(i, 'isDirectTransfer', false)
  951. })
  952. }
  953. }
  954. })
  955. },
  956. // 返回列表
  957. goBack() {
  958. this.$emit('backListFormDetail')
  959. },
  960. handleWarehouseValue(e) {
  961. this.correspondName = this.warehouseList.find(k => {
  962. return k.id === e
  963. }).name
  964. this.correspondId = e
  965. if (!this.goodsList.length) return
  966. this.goodsList.forEach(k => {
  967. this.$set(k, 'correspondName', this.correspondName)
  968. this.$set(k, 'correspondId', this.correspondId)
  969. })
  970. console.log(this.goodsList)
  971. },
  972. handleWallets(e, row, index) {
  973. if (e) {
  974. const service = row.wallets.filter(k => {
  975. return e == k.customerWalletId
  976. })[0]
  977. if (index == 0 && !this.mainForm.k3ServiceId) {
  978. this.$set(this.mainForm, 'k3ServiceId', service.serviceId)
  979. this.$set(this.mainForm, 'k3ServiceName', service.serviceName)
  980. }
  981. this.$set(row, 'serviceId', service.serviceId)
  982. this.$set(row, 'serviceName', service.serviceName)
  983. // this.$set(row,'amount',service.amount || 0)
  984. } else {
  985. console.log(index)
  986. if (index === 0) {
  987. this.$set(this.mainForm, 'k3ServiceId', '')
  988. this.$set(this.mainForm, 'k3ServiceName', '')
  989. }
  990. this.$set(row, 'serviceId', '')
  991. this.$set(row, 'serviceName', '')
  992. // this.$set(row,'amount',0 )
  993. }
  994. },
  995. // 选择销售政策获取政策条件列表
  996. async handlePolicy(e) {
  997. console.log(e)
  998. this.totalArr = []
  999. this.multipleSelections = []
  1000. this.dataList = []
  1001. this.popDataArr = []
  1002. this.screenForm.saleTypeCode = ''
  1003. const policy = this.policyList.filter(k => {
  1004. return k.code === e
  1005. })[0]
  1006. this.commercialType = policy.commercialType
  1007. if (this.commercialType) {
  1008. if (this.websitNumber === 'GZ') {
  1009. this.mainForm.isPlanOrder = false
  1010. } else if (this.websitNumber === 'FS') {
  1011. this.mainForm.isPlanOrder = true
  1012. }
  1013. } else {
  1014. this.mainForm.isPlanOrder = true
  1015. }
  1016. console.log(policy.type)
  1017. if (policy.type == 'PROVISION') {
  1018. // PROVISION 配提
  1019. // 选择销售政策PolidcyId改变获取条件列表
  1020. const { data } = await getPolicyConditionList({ policyId: e })
  1021. this.factor = data
  1022. this.pop = data[0].pop
  1023. this.remark = data[0].remark || ''
  1024. this.popArr = data[0].pop.split(':')
  1025. if (this.policyId) {
  1026. this.screenForm.policyId = this.policyId
  1027. if (this.listItem) {
  1028. this.policyConditionId = data[0].id
  1029. }
  1030. } else {
  1031. this.screenForm.policyId = data[0].policyId
  1032. this.policyConditionId = data[0].id
  1033. }
  1034. for (let i = 0; i < this.popArr.length; i++) {
  1035. await this.getConditionList(this.policyConditionId, i + 1)
  1036. }
  1037. } else {
  1038. // LIMIT 限量
  1039. this.getMaterialTypeList('sProvision')
  1040. }
  1041. },
  1042. hendleEdit(val, index) {
  1043. this.dialogVisible = false
  1044. // let params = {
  1045. // id: this.cid,
  1046. // theTime: this.mainForm.date,
  1047. // mainId: this.mainForm.type,
  1048. // mainName: this.mainForm.mainName,
  1049. // remark: this.mainForm.remark,
  1050. // type: 2,
  1051. // retailOrderItemList: this.goodsList,
  1052. // policyId: this.policyId,
  1053. // };
  1054. // editData(params).then((res) => {
  1055. // this.$successMsg("编辑成功");
  1056. // this.getDetail();
  1057. // });
  1058. },
  1059. // 获取条件相对应的比列
  1060. handleFactor(e) {
  1061. const data = this.factor.filter(k => {
  1062. return k.id == e
  1063. })[0]
  1064. // // consloe(data, "kkkk");
  1065. this.pop = data.pop
  1066. this.popArr = data.pop.split(':')
  1067. this.screenForm.policyId = data.policyId
  1068. this.policyConditionId = data.id
  1069. },
  1070. async handleGetPolicyList() {
  1071. const { data } = await policyList({
  1072. pageNum: 1,
  1073. pageSize: -1,
  1074. status: 1,
  1075. customerId: JSON.parse(localStorage.getItem('supply_user')).customerId,
  1076. specification: this.screenForm.specification
  1077. })
  1078. this.policyList = data.records
  1079. if (data.records.length) {
  1080. this.handlePolicy(data.records[0].code)
  1081. }
  1082. },
  1083. // 获取某一个比例下的数据 ,查询popType 当前 this.cusIndex+1
  1084. async getConditionList(policyConditionId, popType, fang) {
  1085. this.listLoading = true
  1086. const { data } = await getConditionList({
  1087. pageNum: this.currentPage,
  1088. pageSize: -1,
  1089. policyConditionId,
  1090. popType,
  1091. status: true,
  1092. priceType: this.screenForm.priceType,
  1093. specification: this.screenForm.specifications,
  1094. saleTypeCode: this.screenForm.saleTypeCode,
  1095. customerId: JSON.parse(localStorage.getItem('supply_user')).customerId
  1096. })
  1097. if (!fang) {
  1098. this.poptotal['total' + popType] = data.total
  1099. this.popcun['cun' + popType] = 1
  1100. this.popfun['handleSizeChange' + popType] = (val, index) => {
  1101. this.popcun['cun' + index] = val
  1102. this.currentPage = 1
  1103. this.getConditionList(this.policyConditionId, index, true)
  1104. }
  1105. this.popfun['handleCurrentChange' + popType] = (val, index) => {
  1106. this.popcun['cun' + index] = val
  1107. this.getConditionList(this.policyConditionId, index, true)
  1108. }
  1109. }
  1110. const datas = data.records
  1111. if (this.listItem) {
  1112. for (let i = 0; i < this.goodsList.length; i++) {
  1113. for (let j = 0; j < datas.length; j++) {
  1114. if (datas[j].id == this.goodsList[i].policyMaterialId) {
  1115. this.$set(datas[j], 'disabled', true)
  1116. }
  1117. }
  1118. }
  1119. }
  1120. // this.total = data.total;
  1121. // console.log(this.goodsList,'4555');
  1122. if (this.goodsList.length) {
  1123. for (let p = 0; p < this.goodsList.length; p++) {
  1124. for (let q = 0; q < datas.length; q++) {
  1125. if ((this.goodsList[p].id || this.goodsList[p].policyMaterialId) == datas[q].id) {
  1126. this.$set(datas[q], 'disabled', true)
  1127. }
  1128. }
  1129. }
  1130. }
  1131. for (let i = 0; i < data.records.length; i++) {
  1132. data.records[i].qty = 1
  1133. data.records[i].policyMaterialId = data.records[i].id
  1134. this.$set(data.records[i], 'zong', data.records[i].qty * data.records[i].price)
  1135. data.records[i].sums1 = ['price', 'qty', 'zong']
  1136. // this.$set(data.records[i],'userList',this.userList)
  1137. }
  1138. if (fang) {
  1139. this.popDataArr[popType] = datas
  1140. } else {
  1141. console.log(datas, '89')
  1142. this.popDataArr.push(datas)
  1143. }
  1144. this.totalArr.push({
  1145. totalQty: 0,
  1146. totalPrice: 0,
  1147. totalAmount: 0
  1148. })
  1149. // this.$set(this.totalArr,[...this.totalArr])
  1150. this.listLoading = false
  1151. // consloe(this.popDataArr);
  1152. },
  1153. // 获取政策列表
  1154. getMaterialTypeList(val) {
  1155. this.listLoading2 = true
  1156. getMaterialTypeList({
  1157. pageNum: 1,
  1158. pageSize: -1,
  1159. policyId: this.screenForm.policyId,
  1160. saleTypeCode: this.screenForm.saleTypeCode,
  1161. priceType: this.screenForm.priceType,
  1162. specification: this.screenForm.specifications,
  1163. status: true,
  1164. customerId: JSON.parse(localStorage.getItem('supply_user')).customerId,
  1165. [val]: true
  1166. }).then(res => {
  1167. this.dataList = res.data.records
  1168. if (this.listItem) {
  1169. for (let i = 0; i < this.goodsList.length; i++) {
  1170. for (let j = 0; j < this.dataList.length; j++) {
  1171. if (this.dataList[j].id == this.goodsList[i].policyMaterialId) {
  1172. this.$set(this.dataList[i], 'disabled', true)
  1173. }
  1174. }
  1175. }
  1176. }
  1177. for (let i = 0; i < res.data.records.length; i++) {
  1178. this.$set(res.data.records[i], 'qty', 1)
  1179. res.data.records[i].sums1 = ['price', 'qty', 'zong']
  1180. res.data.records[i].userList = this.userList
  1181. res.data.records[i].policyMaterialId = res.data.records[i].id
  1182. for (let j = 0; j < this.goodsList.length; j++) {
  1183. if ((this.goodsList[j].id || this.goodsList[j].policyMaterialId) == res.data.records[i].id) {
  1184. res.data.records[i].disabled = false
  1185. }
  1186. }
  1187. }
  1188. this.dataList = res.data.records
  1189. this.total = res.data.total
  1190. this.listLoading2 = false
  1191. this.popDataArr = []
  1192. this.popArr = []
  1193. this.factor = []
  1194. // // consloe(this.dataList, "kkkk");
  1195. })
  1196. },
  1197. // 下一步获取某个政策条件比例数据
  1198. handleCondition() {
  1199. if (this.multipleSelection.length) {
  1200. this.cusIndex += 1
  1201. this.disabled = true
  1202. this.multipleData.push(this.multipleSelection)
  1203. this.getConditionList(this.policyConditionId, this.cusIndex + 1)
  1204. } else {
  1205. this.$errorMsg('请选择')
  1206. }
  1207. // // consloe(this.cusIndex,'下');
  1208. },
  1209. // 上一步
  1210. handleShang() {
  1211. this.cusIndex == 0 ? (this.disabled = false) : ''
  1212. this.multipleData.splice(this.cusIndex, 1)
  1213. this.popDataArr.splice(this.cusIndex, 1)
  1214. this.cusIndex -= 1
  1215. // // consloe(this.cusIndex,'上');
  1216. },
  1217. /**
  1218. * 根据条件禁用行复选框
  1219. * 函数返回值为false则禁用选择(反之亦然)
  1220. * @param {Object} row - 行数据
  1221. * @param {String} index - 索引值
  1222. * @return Boolean
  1223. */
  1224. selectable: function (row, index) {
  1225. // row.disabled == undefined 才能被选中
  1226. if (row.disabled == undefined) {
  1227. return true
  1228. }
  1229. // 函数必须有返回值且是布尔值
  1230. // 页面刷新后该函数会执行 N 次进行判断(N 为表格行数)
  1231. // 如果没有返回值则默认返回false(全部无法选中)
  1232. },
  1233. /**
  1234. * 根据条件禁用行复选框
  1235. * 函数返回值为false则禁用选择(反之亦然)
  1236. * @param {Object} row - 行数据
  1237. * @param {String} index - 索引值
  1238. * @return Boolean
  1239. */
  1240. selectable2: function (row, index) {
  1241. // row.disabled == undefined 才能被选中
  1242. if (row.disabled == undefined) {
  1243. return true
  1244. }
  1245. // 函数必须有返回值且是布尔值
  1246. // 页面刷新后该函数会执行 N 次进行判断(N 为表格行数)
  1247. // 如果没有返回值则默认返回false(全部无法选中)
  1248. },
  1249. // 条件数据多选
  1250. handleSelectionChange(val, type, index) {
  1251. if (type === 1) {
  1252. this.type = 1
  1253. if (!this.multipleSelections.length) {
  1254. this.multipleSelections = new Array(index).fill([])
  1255. } else {
  1256. for (let i = 0; i < this.multipleSelections.length; i++) {
  1257. if (!this.multipleSelections[i] || !this.multipleSelections[i].length) {
  1258. this.multipleSelections[i] = []
  1259. }
  1260. }
  1261. }
  1262. this.$set(this.multipleSelections, index, val)
  1263. this.$set(this.totalArr, index, {
  1264. totalQty: 0,
  1265. totalPrice: 0,
  1266. totalAmount: 0
  1267. })
  1268. for (let j = 0; j < this.multipleSelections[index].length; j++) {
  1269. this.multipleSelections[index][j].fang = true
  1270. this.totalArr[index].totalQty += +this.multipleSelections[index][j].qty
  1271. this.totalArr[index].totalPrice += +this.multipleSelections[index][j].price
  1272. this.totalArr[index].totalAmount +=
  1273. +this.multipleSelections[index][j].price * +this.multipleSelections[index][j].qty
  1274. }
  1275. // consloe(this.multipleSelections);
  1276. } else {
  1277. this.type = 2
  1278. this.multipleSelection = val
  1279. console.log(this.multipleSelection)
  1280. this.totalQty = this.totalPrice = this.totalAmount = 0
  1281. for (let i = 0; i < this.multipleSelection.length; i++) {
  1282. this.multipleSelection[i].fang = true
  1283. this.totalQty += +this.multipleSelection[i].qty
  1284. this.totalPrice += +this.multipleSelection[i].price
  1285. this.totalAmount += +this.multipleSelection[i].price * +this.multipleSelection[i].qty
  1286. }
  1287. }
  1288. },
  1289. hanlePopData() {
  1290. console.log(this.multipleSelections)
  1291. this.multipleData.push(this.multipleSelection)
  1292. if (this.multipleData.length && this.multipleSelection.length) {
  1293. let arrData = []
  1294. for (let i = 0; i < this.multipleData.length; i++) {
  1295. if (this.multipleData[i].wallets && this.multipleData[i].wallets.length) {
  1296. this.multipleData[i].id = null
  1297. this.$set(this.multipleData[i], 'customerWalletId', this.multipleData[i].wallets[0].customerWalletId)
  1298. this.$set(this.multipleData[i], 'serviceName', this.multipleData[i].wallets[0].serviceName)
  1299. this.$set(this.multipleData[i], 'serviceId', this.multipleData[i].wallets[0].serviceId)
  1300. this.$set(this.multipleData[i], 'amount', 0)
  1301. }
  1302. arrData = [...arrData, ...this.multipleData[i]]
  1303. }
  1304. if (this.goodsList.length) {
  1305. this.goodsList = [...this.goodsList, ...arrData]
  1306. } else {
  1307. this.goodsList = arrData
  1308. }
  1309. if (this.dataList.length) {
  1310. for (let u = 0; u < this.goodsList.length; u++) {
  1311. this.goodsList[u].disabled = true
  1312. }
  1313. this.newDataList = this.multipleSelection
  1314. this.disabled = true
  1315. }
  1316. this.goodsList.forEach(item => {
  1317. item.sums1 = ['qty', 'directTransferQty']
  1318. item.sums2 = [
  1319. 'price',
  1320. 'rebateAmount',
  1321. 'compute_amount',
  1322. 'compute_flAmount',
  1323. 'compute_zkAmount',
  1324. 'compute_sfAmount'
  1325. ]
  1326. this.$set(item, 'status1', '')
  1327. this.$set(item, 'status2', '')
  1328. this.$set(item, 'userList', this.userList)
  1329. })
  1330. if (this.goodsList.length && this.goodsList[0].wallets.length) {
  1331. console.log(555555)
  1332. this.mainForm.k3ServiceName = this.goodsList[0].wallets[0].serviceName || ''
  1333. this.mainForm.k3ServiceId = this.goodsList[0].wallets[0].serviceId || ''
  1334. }
  1335. // if (this.goodsList.length>4) {
  1336. // this.newGoodsList = this.goodsList
  1337. // this.newGoodsList.length = 4
  1338. // }
  1339. this.cusIndex = 0
  1340. this.total = 0
  1341. this.popDataArr = []
  1342. this.multipleData = []
  1343. this.multipleSelection = []
  1344. this.policyId = this.screenForm.policyId
  1345. this.totalQty = this.totalPrice = this.totalAmount = 0
  1346. this.isShowDialog = false
  1347. this.$refs.singleTable.clearSelection()
  1348. // consloe(this.goodsList, "kkkk");
  1349. } else if (this.multipleSelections.length) {
  1350. let arrData = []
  1351. this.newMultipleSelections = this.multipleSelections
  1352. for (let i = 0; i < this.multipleSelections.length; i++) {
  1353. for (let j = 0; j < this.multipleSelections[i].length; j++) {
  1354. this.multipleSelections[i][j].disabled = true
  1355. this.multipleSelections[i][j].id = null
  1356. if (this.multipleSelections[i][j].wallets.length) {
  1357. this.$set(
  1358. this.multipleSelections[i][j],
  1359. 'customerWalletId',
  1360. this.multipleSelections[i][j].wallets[0].customerWalletId
  1361. )
  1362. this.$set(
  1363. this.multipleSelections[i][j],
  1364. 'serviceName',
  1365. this.multipleSelections[i][j].wallets[0].serviceName
  1366. )
  1367. this.$set(this.multipleSelections[i][j], 'serviceId', this.multipleSelections[i][j].wallets[0].serviceId)
  1368. this.$set(this.multipleSelections[i][j], 'amount', 0)
  1369. }
  1370. arrData = [...arrData, this.multipleSelections[i][j]]
  1371. }
  1372. }
  1373. if (this.goodsList.length) {
  1374. this.goodsList = [...this.goodsList, ...arrData]
  1375. } else {
  1376. this.goodsList = arrData
  1377. }
  1378. if (this.goodsList.length && this.goodsList[0].wallets.length) {
  1379. this.mainForm.k3ServiceName = this.goodsList[0].wallets[0].serviceName || ''
  1380. this.mainForm.k3ServiceId = this.goodsList[0].wallets[0].serviceId || ''
  1381. }
  1382. this.goodsList.forEach(item => {
  1383. this.$set(item, 'status1', '')
  1384. this.$set(item, 'status2', '')
  1385. this.$set(item, 'userList', this.userList)
  1386. item.sums1 = ['qty', 'directTransferQty']
  1387. item.sums2 = [
  1388. 'price',
  1389. 'rebateAmount',
  1390. 'compute_amount',
  1391. 'compute_flAmount',
  1392. 'compute_zkAmount',
  1393. 'compute_sfAmount'
  1394. ]
  1395. })
  1396. this.disabled = true
  1397. // this.popDataArr = [];
  1398. this.multipleData = []
  1399. this.multipleSelection = []
  1400. this.policyId = this.screenForm.policyId
  1401. this.totalQty = this.totalPrice = this.totalAmount = 0
  1402. this.isShowDialog = false
  1403. this.$refs.singleTable.forEach(k => {
  1404. k.clearSelection()
  1405. })
  1406. // this.$refs.singleTable.clearSelection();
  1407. } else {
  1408. this.$errorMsg('请选择')
  1409. }
  1410. },
  1411. // 获取详情
  1412. getDetail() {
  1413. getUserList({
  1414. pageNum: 1,
  1415. pageSize: -1,
  1416. adminWebsitId: '',
  1417. isCustomer: 0,
  1418. roleId: '',
  1419. status: true,
  1420. userName: ''
  1421. }).then(res => {
  1422. this.userList = res.data.records
  1423. getDetail({ id: this.listItem.id }).then(res => {
  1424. const data = res.data
  1425. console.log(data,99);
  1426. this.mainForm.date = data.theTime
  1427. this.mainForm.type = data.mainId
  1428. this.mainForm.remark = data.remark
  1429. this.mainForm.policyId = data.policyId
  1430. this.mainForm.isPlanOrder = data.isPlanOrder
  1431. this.commercialType = data.commercialType
  1432. this.correspondId = data.correspondId
  1433. this.correspondName = data.correspondName
  1434. this.warehouseValue = data.correspondId
  1435. this.policyId = data.policyId
  1436. this.mainForm.k3ServiceName = data.k3ServiceName
  1437. ;(this.mainForm.k3ServiceId = data.k3ServiceId), (this.mainForm.fileNum = data.fileNum)
  1438. // this.mainForm.k3ServiceName = data.retailOrderItemList[0].wallets[0].serviceName
  1439. // this.mainForm.k3ServiceId = data.retailOrderItemList[0].wallets[0].serviceId
  1440. data.retailOrderItemList.forEach(item => {
  1441. item.correspondName = data.correspondName
  1442. item.warehouseValue = data.correspondId
  1443. item.status1 = ''
  1444. item.status2 = ''
  1445. item.sums1 = ['qty', 'directTransferQty']
  1446. item.sums2 = [
  1447. 'price',
  1448. 'rebateAmount',
  1449. 'compute_amount',
  1450. 'compute_flAmount',
  1451. 'compute_zkAmount',
  1452. 'compute_sfAmount'
  1453. ]
  1454. this.$set(item, 'userList', this.userList)
  1455. item.rebateWallets.forEach(j => {
  1456. if (j.customerWalletId2 === data.customerWalletId2) {
  1457. this.$set(item, 'amount', j.amount || 0)
  1458. }
  1459. })
  1460. item.wallets.forEach(k => {
  1461. if (k.customerWalletId === data.customerWalletId) {
  1462. this.$set(item, 'serviceId', k.serviceId)
  1463. this.$set(item, 'serviceName', k.serviceName)
  1464. }
  1465. })
  1466. })
  1467. this.goodsList = data.retailOrderItemList
  1468. console.log(this.goodsList);
  1469. })
  1470. })
  1471. },
  1472. // 获取销售政策
  1473. getPolicyList() {
  1474. policyList({
  1475. pageNum: 1,
  1476. pageSize: -1,
  1477. customerId: JSON.parse(localStorage.getItem('supply_user')).customerId,
  1478. status: true
  1479. }).then(res => {
  1480. if (this.policyId) {
  1481. this.screenForm.policyId = this.policyId
  1482. this.disabled = true
  1483. } else {
  1484. this.screenForm.policyId = res.data.records[0].code
  1485. }
  1486. this.policyList = res.data.records
  1487. console.log(res.data.records)
  1488. if (this.policyList.length) {
  1489. this.screenForm.saleTypeCode = ''
  1490. this.screenForm.specifications = ''
  1491. this.handlePolicy(this.screenForm.policyId)
  1492. // const type = this.policyList.find(e=>e.code==this.screenForm.policyId).type
  1493. // if (type === "PROVISION") {
  1494. // // this.handlePolicy( res.data.records[0].id);
  1495. // }else{
  1496. // }
  1497. }
  1498. })
  1499. },
  1500. // 引用销售政策搜索
  1501. async handlePolicyTypeList() {
  1502. if (!this.screenForm.policyId) {
  1503. this.$errorMsg('请选择销售政策')
  1504. return
  1505. }
  1506. if (this.popArr.length) {
  1507. this.popDataArr = []
  1508. this.dataList = []
  1509. for (let i = 0; i < this.popArr.length; i++) {
  1510. await this.getConditionList(this.policyConditionId, i + 1, false)
  1511. }
  1512. } else {
  1513. // sProvision = true
  1514. this.getMaterialTypeList('sProvision')
  1515. }
  1516. },
  1517. // 获取销售类型
  1518. getTypeList() {
  1519. const params = {
  1520. pageNum: 1,
  1521. pageSize: -1,
  1522. saleCode: '',
  1523. saleName: '',
  1524. status: ''
  1525. }
  1526. typeList(params).then(res => {
  1527. this.ztypeList = res.data.records
  1528. // // consloe(this.ztypeList, "type1111");
  1529. })
  1530. },
  1531. // 获取仓库列表
  1532. getWarehouseList() {
  1533. getWarehouseList({
  1534. pageNum: 1,
  1535. pageSize: -1
  1536. }).then(res => {
  1537. this.warehouseList = res.data.records
  1538. })
  1539. },
  1540. // 获取限定机型
  1541. getpolicyTypeList() {
  1542. getpolicyTypeList({
  1543. pageNum: 1,
  1544. pageSize: 10,
  1545. policyId: this.screenForm.policyId,
  1546. saleTypeCode: this.screenForm.saleTypeCode
  1547. }).then(res => {
  1548. for (let i = 0; i < res.data.records.length; i++) {
  1549. this.$set(res.data.records[i], 'qty', 1)
  1550. res.data.records[i].sums2 = ['price', 'qty', 'zong']
  1551. res.data.records[i].userList = this.userList
  1552. }
  1553. this.dataList = res.data.records
  1554. this.total = res.data.total
  1555. })
  1556. },
  1557. // 打开引用
  1558. handleShow() {
  1559. this.isShowDialog = true
  1560. this.getPolicyList()
  1561. },
  1562. // 获取钱包列表
  1563. getWalletList() {
  1564. getWalletList({
  1565. customerId: JSON.parse(localStorage.getItem('supply_user')).customerId,
  1566. type: 'COMMONLY'
  1567. }).then(res => {
  1568. this.xjWalletList = res.data
  1569. })
  1570. getWalletList({
  1571. customerId: JSON.parse(localStorage.getItem('supply_user')).customerId,
  1572. type: 'REBATE'
  1573. }).then(res => {
  1574. this.flWalletList = res.data
  1575. })
  1576. },
  1577. // 获取销售类型列表
  1578. getSalesTypeList() {
  1579. getSalesTypeList({
  1580. pageNum: 1,
  1581. pageSize: -1
  1582. }).then(res => {
  1583. this.salesTypeList = res.data.records
  1584. })
  1585. },
  1586. getDictList() {
  1587. getDictList({ sysDictEnum: 'PRODUCT_TYPE' }).then(res => {
  1588. this.typeList = res.data
  1589. })
  1590. },
  1591. // 获取商品列表
  1592. getGoodsList() {
  1593. getGoodsList({
  1594. pageNum: this.currentPage,
  1595. pageSize: 10,
  1596. mainId: this.screenForm.type,
  1597. saleId: this.screenForm.salesType,
  1598. materialCode: this.screenForm.proNum,
  1599. materialName: this.screenForm.proName,
  1600. specification: this.screenForm.proModel,
  1601. price1: this.screenForm.price1,
  1602. price2: this.screenForm.price2
  1603. }).then(res => {
  1604. const oldGoodsList = this.goodsList
  1605. const newGoodsList = res.data.records
  1606. for (let i = 0; i < oldGoodsList.length; i++) {
  1607. const oldItem = oldGoodsList[i]
  1608. for (let j = 0; j < newGoodsList.length; j++) {
  1609. const newItem = newGoodsList[j]
  1610. if (newItem.materialId === oldItem.materialId) {
  1611. newGoodsList[j].selected = true
  1612. break
  1613. }
  1614. }
  1615. }
  1616. res.data.records.forEach(item => {
  1617. item.materialName = item.name
  1618. item.materialCode = item.number
  1619. item.saleTypeName = item.saleName
  1620. item.unit = item.baseUnit
  1621. item.price = item.batchPrice
  1622. item.tax = item.taxRate
  1623. item.isDirectTransfer = false
  1624. item.directTransferQty = ''
  1625. item.status1 = ''
  1626. item.status2 = ''
  1627. item.rebateAmount = ''
  1628. item.rebateRate = ''
  1629. item.productPriceId = item.id
  1630. })
  1631. this.leftGoodsList = res.data.records
  1632. this.listTotal = res.data.total
  1633. })
  1634. },
  1635. // 查询重复值并禁选
  1636. checkboxSelect(row, rowIndex) {
  1637. if (row.selected) {
  1638. return false // 禁用
  1639. } else {
  1640. return true // 不禁用
  1641. }
  1642. },
  1643. // 点击 选择商品
  1644. openDialog() {
  1645. this.getSalesTypeList()
  1646. this.getGoodsList()
  1647. this.isShowDialog = true
  1648. },
  1649. // 提交筛选表单
  1650. submitScreenForm() {
  1651. this.currentPage = 1
  1652. this.getGoodsList()
  1653. },
  1654. // 重置筛选表单
  1655. resetScreenForm() {
  1656. this.$refs.screenForm.resetFields()
  1657. this.currentPage = 1
  1658. this.getGoodsList()
  1659. },
  1660. // 关闭 弹窗
  1661. closeDialog() {
  1662. this.isShowDialog = false
  1663. this.popDataArr = []
  1664. },
  1665. // 删除
  1666. deleteGoods() {
  1667. const rightGoodsList = this.rightGoodsList
  1668. const rightSelection = this.rightSelection
  1669. for (let i = 0; i < rightGoodsList.length; i++) {
  1670. for (let j = 0; j < rightSelection.length; j++) {
  1671. if (rightSelection[j].materialId == rightGoodsList[i].materialId) {
  1672. this.rightGoodsList.splice(i, 1)
  1673. }
  1674. }
  1675. }
  1676. },
  1677. // 确定 添加产品
  1678. submitAddGoods() {
  1679. if (this.radio) {
  1680. const params = this.radio.split('&')
  1681. this.screenForm.policyId = params[1]
  1682. this.mainForm.policyId = params[1]
  1683. this.cusIndex += 1
  1684. getpolicyList({
  1685. materialId: params[2],
  1686. policyId: params[1]
  1687. }).then(res => {
  1688. this.pop = res.data.pop
  1689. this.popArr = res.data.pop.split(':')
  1690. this.popArr.splice(0, 1)
  1691. for (let i = 0; i < this.popArr.length; i++) {
  1692. this.$set(this.radioObj, 'radio' + (i + 1), '')
  1693. }
  1694. this.step = this.cusIndex + 1
  1695. this.getConditionList(params[3], this.step)
  1696. })
  1697. } else {
  1698. this.$errorMsg('请选择')
  1699. }
  1700. },
  1701. // 更改每页数量
  1702. handleSizeChange(val) {
  1703. this.pageSize = val
  1704. this.currentPage = 1
  1705. this.getConditionList(this.policyConditionId, this.cusIndex + 1)
  1706. },
  1707. // 更改当前页
  1708. handleCurrentChange(val) {
  1709. this.currentPage = val
  1710. this.getConditionList(this.policyConditionId, this.cusIndex + 1)
  1711. },
  1712. // 更改列表当前页
  1713. handleTableCurrentChange(val) {
  1714. this.currentPage = val
  1715. this.getConditionList(this.policyConditionId, this.cusIndex + 1)
  1716. },
  1717. handleClose() {
  1718. this.totalQty = this.totalPrice = this.totalAmount = 0
  1719. // this.dataList = [];
  1720. // this.popDataArr = [];
  1721. // this.screenForm.policyId = "";
  1722. // this.screenForm.saleTypeCode = "";
  1723. },
  1724. // 删除产品
  1725. deleteItem(index, id) {
  1726. this.goodsList.splice(index, 1)
  1727. // this.dataList
  1728. this.newDataList.splice(index, 1)
  1729. if (!this.goodsList.length) {
  1730. this.disabled = false
  1731. this.policyId = ''
  1732. this.mainForm.policyId = ''
  1733. }
  1734. // this.popDataArr.splice(index,1)
  1735. },
  1736. // 修改返利钱包
  1737. changeWallet(e, row) {
  1738. if (e) {
  1739. const obj = row.rebateWallets.filter(k => {
  1740. return e === k.customerWalletId
  1741. })[0]
  1742. this.$set(row, 'rebateRate', obj.rebateRate || 0)
  1743. this.$set(row, 'amount', obj.amount || 0)
  1744. } else {
  1745. this.$set(row, 'rebateRate', 0)
  1746. this.$set(row, 'amount', 0)
  1747. }
  1748. },
  1749. clearWallet(e) {
  1750. console.log(e)
  1751. // const obj = row.rebateWallets.filter(k => {
  1752. // return e === k.customerWalletId
  1753. // })[0]
  1754. this.$set(row, 'rebateRate', 0)
  1755. },
  1756. // 检查库存
  1757. checkStock() {
  1758. if (!this.warehouseValue) {
  1759. return this.$errorMsg('请选择仓库')
  1760. }
  1761. if (!this.goodsList) {
  1762. return this.$errorMsg('请添加货品')
  1763. }
  1764. const ids = []
  1765. this.goodsList.forEach(item => {
  1766. ids.push(item.materialId)
  1767. })
  1768. checkStock({
  1769. correspondId: this.warehouseValue,
  1770. materialId: ids.join(',')
  1771. }).then(res => {
  1772. if (res.data) {
  1773. this.goodsList.forEach((item, index) => {
  1774. item.status1 = res.data[index].allStockNum
  1775. item.status2 = res.data[index].stockNum
  1776. // // consloe(item.status1, item.status2);
  1777. })
  1778. }
  1779. })
  1780. },
  1781. status2Filter(item) {
  1782. if (item.status2 === '' || item.status2 === null || item.status2 === undefined) {
  1783. return '未检查'
  1784. }
  1785. if (item.status2 <= 0) {
  1786. return '无货'
  1787. } else if (item.status2 >= 1 && item.status2 <= 30) {
  1788. return item.status2
  1789. } else if (item.status2 >= 31 && item.status2 <= 1000) {
  1790. return '有货'
  1791. } else {
  1792. return '充足'
  1793. }
  1794. // else if (item.status2 >= item.qty) return '可用'
  1795. // else return '短缺'
  1796. },
  1797. // 保存
  1798. clickSubmitForm() {
  1799. this.$refs.mainForm.validate(valid => {
  1800. if (valid) {
  1801. // let mainName =
  1802. // this.typeList[
  1803. // findElem(this.typeList, "dictCode", this.mainForm.type)
  1804. // ].dictValue;
  1805. this.goodsList.userList = []
  1806. this.goodsList.forEach(k => {
  1807. delete k.userList
  1808. })
  1809. let hasCustomerWalletId = this.goodsList.find((k, i) => {
  1810. if (!k.customerWalletId) {
  1811. this.$errorMsg(`第${i + 1}货品没现金钱包`)
  1812. return true
  1813. }
  1814. })
  1815. if (hasCustomerWalletId) return
  1816. if (this.commercialType && !this.mainForm.isPlanOrder && !this.correspondId) {
  1817. this.$errorMsg(`仓库必选`)
  1818. return
  1819. }
  1820. const params = {
  1821. theTime: this.mainForm.date,
  1822. k3ServiceId: this.mainForm.k3ServiceId,
  1823. k3ServiceName: this.mainForm.k3ServiceName,
  1824. isPlanOrder: this.mainForm.isPlanOrder,
  1825. commercialType: this.commercialType,
  1826. correspondName: this.correspondName,
  1827. correspondId: this.correspondId,
  1828. remark: this.mainForm.remark,
  1829. type: 2, // 1:普通零售单,2:政策零售单
  1830. retailOrderItemList: this.goodsList,
  1831. policyId: this.policyId,
  1832. fileNo: this.mainForm.fileNum
  1833. }
  1834. console.log(params,this.policyConditionId)
  1835. if (this.listItem) {
  1836. params.id = this.listItem.id
  1837. editData(params).then(res => {
  1838. this.$successMsg('编辑成功')
  1839. this.goBack()
  1840. this.$parent.getList()
  1841. })
  1842. } else {
  1843. params.retailOrderItemList.forEach(k => {
  1844. k.id = null
  1845. k.policyConditionId = this.policyConditionId
  1846. })
  1847. addData(params).then(res => {
  1848. this.$successMsg('添加成功')
  1849. this.goBack()
  1850. this.$parent.getList()
  1851. })
  1852. }
  1853. }
  1854. })
  1855. }
  1856. }
  1857. }
  1858. </script>
  1859. <style scoped lang="scss">
  1860. .yinput {
  1861. ::v-deep .el-input__inner {
  1862. text-align: right;
  1863. }
  1864. }
  1865. .fr {
  1866. margin: 10px;
  1867. overflow: hidden;
  1868. }
  1869. .detail-container {
  1870. width: 100%;
  1871. height: 100%;
  1872. margin-bottom: 80px;
  1873. ::v-deep .el-table__append-wrapper {
  1874. overflow: initial;
  1875. }
  1876. }
  1877. .table {
  1878. margin-top: 20px 0 0 0;
  1879. background-color: rgb(237 237 237);
  1880. }
  1881. .page-footer .footer.hideSidebar {
  1882. margin-left: 0;
  1883. width: 100%;
  1884. }
  1885. .mybox {
  1886. padding: 20px 0;
  1887. text-align: right;
  1888. div:first-child {
  1889. flex: 0 0 55px;
  1890. }
  1891. div {
  1892. flex: 1 0 200px;
  1893. padding-right: 10px;
  1894. text-align: right;
  1895. }
  1896. }
  1897. .myselect {
  1898. ::v-deep .el-select-dropdown__item {
  1899. max-width: 500px;
  1900. }
  1901. }
  1902. .main-title {
  1903. display: flex;
  1904. justify-content: space-between;
  1905. align-items: center;
  1906. margin-top: 20px;
  1907. height: 60px;
  1908. border-bottom: 1px solid #dcdfe6;
  1909. margin-bottom: 20px;
  1910. .title {
  1911. font-size: 16px;
  1912. font-weight: 600;
  1913. padding-left: 10px;
  1914. }
  1915. }
  1916. .tables {
  1917. display: flex;
  1918. margin-top: 10px;
  1919. .table {
  1920. width: 45%;
  1921. }
  1922. .buttons {
  1923. display: flex;
  1924. flex-direction: column;
  1925. justify-content: center;
  1926. align-items: center;
  1927. padding: 0 10px;
  1928. button {
  1929. margin: 0;
  1930. margin-top: 10px;
  1931. }
  1932. }
  1933. }
  1934. .ellipsis {
  1935. overflow: hidden;
  1936. text-overflow: ellipsis;
  1937. white-space: nowrap;
  1938. }
  1939. </style>