retail_form.vue 66 KB

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