retail_form.vue 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998
  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="rebateAmount" min-width="100" show-overflow-tooltip>
  210. <template slot-scope="scope">
  211. <div>{{ scope.row.rebateAmount | 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, row) {
  928. if (e) {
  929. hasRak({ id: row.materialId }).then(res => {
  930. if (res.data) {
  931. this.goodsList.forEach(k => {
  932. this.$set(k, 'isDirectTransfer', true)
  933. })
  934. }
  935. })
  936. }
  937. },
  938. // 返回列表
  939. goBack() {
  940. this.$emit('backListFormDetail')
  941. },
  942. handleWarehouseValue(e) {
  943. if (!this.goodsList.length) return
  944. this.correspondName = this.warehouseList.find(k => {
  945. return k.id === e
  946. }).name
  947. this.correspondId = e
  948. this.goodsList.forEach(k => {
  949. this.$set(k, 'correspondName', this.correspondName)
  950. this.$set(k, 'correspondId', this.correspondId)
  951. })
  952. console.log(this.goodsList)
  953. },
  954. handleWallets(e, row, index) {
  955. if (e) {
  956. const service = row.wallets.filter(k => {
  957. return e == k.customerWalletId
  958. })[0]
  959. if (index == 0 && !this.mainForm.k3ServiceId) {
  960. this.$set(this.mainForm, 'k3ServiceId', service.serviceId)
  961. this.$set(this.mainForm, 'k3ServiceName', service.serviceName)
  962. }
  963. this.$set(row, 'serviceId', service.serviceId)
  964. this.$set(row, 'serviceName', service.serviceName)
  965. // this.$set(row,'amount',service.amount || 0)
  966. } else {
  967. console.log(index)
  968. if (index === 0) {
  969. this.$set(this.mainForm, 'k3ServiceId', '')
  970. this.$set(this.mainForm, 'k3ServiceName', '')
  971. }
  972. this.$set(row, 'serviceId', '')
  973. this.$set(row, 'serviceName', '')
  974. // this.$set(row,'amount',0 )
  975. }
  976. },
  977. // 选择销售政策获取政策条件列表
  978. async handlePolicy(e) {
  979. console.log(e)
  980. this.totalArr = []
  981. this.multipleSelections = []
  982. this.dataList = []
  983. this.popDataArr = []
  984. this.screenForm.saleTypeCode = ''
  985. const policy = this.policyList.filter(k => {
  986. return k.code === e
  987. })[0]
  988. this.commercialType = policy.commercialType
  989. if (this.commercialType) {
  990. if (this.websitNumber === 'GZ') {
  991. this.mainForm.isPlanOrder = false
  992. } else if (this.websitNumber === 'FS') {
  993. this.mainForm.isPlanOrder = true
  994. }
  995. } else {
  996. this.mainForm.isPlanOrder = ''
  997. }
  998. console.log(policy.type)
  999. if (policy.type == 'PROVISION') {
  1000. // PROVISION 配提
  1001. // 选择销售政策PolidcyId改变获取条件列表
  1002. const { data } = await getPolicyConditionList({ policyId: e })
  1003. this.factor = data
  1004. this.pop = data[0].pop
  1005. this.remark = data[0].remark || ''
  1006. this.popArr = data[0].pop.split(':')
  1007. if (this.policyId) {
  1008. this.screenForm.policyId = this.policyId
  1009. if (this.listItem) {
  1010. this.policyConditionId = data[0].id
  1011. }
  1012. } else {
  1013. this.screenForm.policyId = data[0].policyId
  1014. this.policyConditionId = data[0].id
  1015. }
  1016. for (let i = 0; i < this.popArr.length; i++) {
  1017. await this.getConditionList(this.policyConditionId, i + 1)
  1018. }
  1019. } else {
  1020. // LIMIT 限量
  1021. this.getMaterialTypeList('sProvision')
  1022. }
  1023. },
  1024. hendleEdit(val, index) {
  1025. this.dialogVisible = false
  1026. // let params = {
  1027. // id: this.cid,
  1028. // theTime: this.mainForm.date,
  1029. // mainId: this.mainForm.type,
  1030. // mainName: this.mainForm.mainName,
  1031. // remark: this.mainForm.remark,
  1032. // type: 2,
  1033. // retailOrderItemList: this.goodsList,
  1034. // policyId: this.policyId,
  1035. // };
  1036. // editData(params).then((res) => {
  1037. // this.$successMsg("编辑成功");
  1038. // this.getDetail();
  1039. // });
  1040. },
  1041. // 获取条件相对应的比列
  1042. handleFactor(e) {
  1043. const data = this.factor.filter(k => {
  1044. return k.id == e
  1045. })[0]
  1046. // // consloe(data, "kkkk");
  1047. this.pop = data.pop
  1048. this.popArr = data.pop.split(':')
  1049. this.screenForm.policyId = data.policyId
  1050. this.policyConditionId = data.id
  1051. },
  1052. async handleGetPolicyList() {
  1053. const { data } = await policyList({
  1054. pageNum: 1,
  1055. pageSize: -1,
  1056. status: 1,
  1057. customerId: JSON.parse(localStorage.getItem('supply_user')).customerId,
  1058. specification: this.screenForm.specification
  1059. })
  1060. this.policyList = data.records
  1061. if (data.records.length) {
  1062. this.handlePolicy(data.records[0].code)
  1063. }
  1064. },
  1065. // 获取某一个比例下的数据 ,查询popType 当前 this.cusIndex+1
  1066. async getConditionList(policyConditionId, popType, fang) {
  1067. this.listLoading = true
  1068. const { data } = await getConditionList({
  1069. pageNum: this.currentPage,
  1070. pageSize: -1,
  1071. policyConditionId,
  1072. popType,
  1073. status: true,
  1074. priceType: this.screenForm.priceType,
  1075. specification: this.screenForm.specifications,
  1076. saleTypeCode: this.screenForm.saleTypeCode,
  1077. customerId: JSON.parse(localStorage.getItem('supply_user')).customerId
  1078. })
  1079. if (!fang) {
  1080. this.poptotal['total' + popType] = data.total
  1081. this.popcun['cun' + popType] = 1
  1082. this.popfun['handleSizeChange' + popType] = (val, index) => {
  1083. this.popcun['cun' + index] = val
  1084. this.currentPage = 1
  1085. this.getConditionList(this.policyConditionId, index, true)
  1086. }
  1087. this.popfun['handleCurrentChange' + popType] = (val, index) => {
  1088. this.popcun['cun' + index] = val
  1089. this.getConditionList(this.policyConditionId, index, true)
  1090. }
  1091. }
  1092. const datas = data.records
  1093. if (this.listItem) {
  1094. for (let i = 0; i < this.goodsList.length; i++) {
  1095. for (let j = 0; j < datas.length; j++) {
  1096. if (datas[j].id == this.goodsList[i].policyMaterialId) {
  1097. this.$set(datas[j], 'disabled', true)
  1098. }
  1099. }
  1100. }
  1101. }
  1102. // this.total = data.total;
  1103. // console.log(this.goodsList,'4555');
  1104. if (this.goodsList.length) {
  1105. for (let p = 0; p < this.goodsList.length; p++) {
  1106. for (let q = 0; q < datas.length; q++) {
  1107. if ((this.goodsList[p].id || this.goodsList[p].policyMaterialId) == datas[q].id) {
  1108. this.$set(datas[q], 'disabled', true)
  1109. }
  1110. }
  1111. }
  1112. }
  1113. for (let i = 0; i < data.records.length; i++) {
  1114. data.records[i].qty = 1
  1115. data.records[i].policyMaterialId = data.records[i].id
  1116. this.$set(data.records[i], 'zong', data.records[i].qty * data.records[i].price)
  1117. data.records[i].sums1 = ['price', 'qty', 'zong']
  1118. // this.$set(data.records[i],'userList',this.userList)
  1119. }
  1120. if (fang) {
  1121. this.popDataArr[popType] = datas
  1122. } else {
  1123. console.log(datas, '89')
  1124. this.popDataArr.push(datas)
  1125. }
  1126. this.totalArr.push({
  1127. totalQty: 0,
  1128. totalPrice: 0,
  1129. totalAmount: 0
  1130. })
  1131. // this.$set(this.totalArr,[...this.totalArr])
  1132. this.listLoading = false
  1133. // consloe(this.popDataArr);
  1134. },
  1135. // 获取政策列表
  1136. getMaterialTypeList(val) {
  1137. this.listLoading2 = true
  1138. getMaterialTypeList({
  1139. pageNum: 1,
  1140. pageSize: -1,
  1141. policyId: this.screenForm.policyId,
  1142. saleTypeCode: this.screenForm.saleTypeCode,
  1143. priceType: this.screenForm.priceType,
  1144. specification: this.screenForm.specifications,
  1145. status: true,
  1146. customerId: JSON.parse(localStorage.getItem('supply_user')).customerId,
  1147. [val]: true
  1148. }).then(res => {
  1149. this.dataList = res.data.records
  1150. if (this.listItem) {
  1151. for (let i = 0; i < this.goodsList.length; i++) {
  1152. for (let j = 0; j < this.dataList.length; j++) {
  1153. if (this.dataList[j].id == this.goodsList[i].policyMaterialId) {
  1154. this.$set(this.dataList[i], 'disabled', true)
  1155. }
  1156. }
  1157. }
  1158. }
  1159. for (let i = 0; i < res.data.records.length; i++) {
  1160. this.$set(res.data.records[i], 'qty', 1)
  1161. res.data.records[i].sums1 = ['price', 'qty', 'zong']
  1162. res.data.records[i].userList = this.userList
  1163. res.data.records[i].policyMaterialId = res.data.records[i].id
  1164. for (let j = 0; j < this.goodsList.length; j++) {
  1165. if ((this.goodsList[j].id || this.goodsList[j].policyMaterialId) == res.data.records[i].id) {
  1166. res.data.records[i].disabled = false
  1167. }
  1168. }
  1169. }
  1170. this.dataList = res.data.records
  1171. this.total = res.data.total
  1172. this.listLoading2 = false
  1173. this.popDataArr = []
  1174. this.popArr = []
  1175. this.factor = []
  1176. // // consloe(this.dataList, "kkkk");
  1177. })
  1178. },
  1179. // 下一步获取某个政策条件比例数据
  1180. handleCondition() {
  1181. if (this.multipleSelection.length) {
  1182. this.cusIndex += 1
  1183. this.disabled = true
  1184. this.multipleData.push(this.multipleSelection)
  1185. this.getConditionList(this.policyConditionId, this.cusIndex + 1)
  1186. } else {
  1187. this.$errorMsg('请选择')
  1188. }
  1189. // // consloe(this.cusIndex,'下');
  1190. },
  1191. // 上一步
  1192. handleShang() {
  1193. this.cusIndex == 0 ? (this.disabled = false) : ''
  1194. this.multipleData.splice(this.cusIndex, 1)
  1195. this.popDataArr.splice(this.cusIndex, 1)
  1196. this.cusIndex -= 1
  1197. // // consloe(this.cusIndex,'上');
  1198. },
  1199. /**
  1200. * 根据条件禁用行复选框
  1201. * 函数返回值为false则禁用选择(反之亦然)
  1202. * @param {Object} row - 行数据
  1203. * @param {String} index - 索引值
  1204. * @return Boolean
  1205. */
  1206. selectable: function (row, index) {
  1207. // row.disabled == undefined 才能被选中
  1208. if (row.disabled == undefined) {
  1209. return true
  1210. }
  1211. // 函数必须有返回值且是布尔值
  1212. // 页面刷新后该函数会执行 N 次进行判断(N 为表格行数)
  1213. // 如果没有返回值则默认返回false(全部无法选中)
  1214. },
  1215. /**
  1216. * 根据条件禁用行复选框
  1217. * 函数返回值为false则禁用选择(反之亦然)
  1218. * @param {Object} row - 行数据
  1219. * @param {String} index - 索引值
  1220. * @return Boolean
  1221. */
  1222. selectable2: function (row, index) {
  1223. // row.disabled == undefined 才能被选中
  1224. if (row.disabled == undefined) {
  1225. return true
  1226. }
  1227. // 函数必须有返回值且是布尔值
  1228. // 页面刷新后该函数会执行 N 次进行判断(N 为表格行数)
  1229. // 如果没有返回值则默认返回false(全部无法选中)
  1230. },
  1231. // 条件数据多选
  1232. handleSelectionChange(val, type, index) {
  1233. if (type === 1) {
  1234. this.type = 1
  1235. if (!this.multipleSelections.length) {
  1236. this.multipleSelections = new Array(index).fill([])
  1237. } else {
  1238. for (let i = 0; i < this.multipleSelections.length; i++) {
  1239. if (!this.multipleSelections[i] || !this.multipleSelections[i].length) {
  1240. this.multipleSelections[i] = []
  1241. }
  1242. }
  1243. }
  1244. this.$set(this.multipleSelections, index, val)
  1245. this.$set(this.totalArr, index, {
  1246. totalQty: 0,
  1247. totalPrice: 0,
  1248. totalAmount: 0
  1249. })
  1250. for (let j = 0; j < this.multipleSelections[index].length; j++) {
  1251. this.multipleSelections[index][j].fang = true
  1252. this.totalArr[index].totalQty += +this.multipleSelections[index][j].qty
  1253. this.totalArr[index].totalPrice += +this.multipleSelections[index][j].price
  1254. this.totalArr[index].totalAmount +=
  1255. +this.multipleSelections[index][j].price * +this.multipleSelections[index][j].qty
  1256. }
  1257. // consloe(this.multipleSelections);
  1258. } else {
  1259. this.type = 2
  1260. this.multipleSelection = val
  1261. console.log(this.multipleSelection)
  1262. this.totalQty = this.totalPrice = this.totalAmount = 0
  1263. for (let i = 0; i < this.multipleSelection.length; i++) {
  1264. this.multipleSelection[i].fang = true
  1265. this.totalQty += +this.multipleSelection[i].qty
  1266. this.totalPrice += +this.multipleSelection[i].price
  1267. this.totalAmount += +this.multipleSelection[i].price * +this.multipleSelection[i].qty
  1268. }
  1269. }
  1270. },
  1271. hanlePopData() {
  1272. console.log(this.multipleSelections)
  1273. this.multipleData.push(this.multipleSelection)
  1274. if (this.multipleData.length && this.multipleSelection.length) {
  1275. let arrData = []
  1276. for (let i = 0; i < this.multipleData.length; i++) {
  1277. if (this.multipleData[i].wallets && this.multipleData[i].wallets.length) {
  1278. this.multipleData[i].id = null
  1279. this.$set(this.multipleData[i], 'customerWalletId', this.multipleData[i].wallets[0].customerWalletId)
  1280. this.$set(this.multipleData[i], 'serviceName', this.multipleData[i].wallets[0].serviceName)
  1281. this.$set(this.multipleData[i], 'serviceId', this.multipleData[i].wallets[0].serviceId)
  1282. this.$set(this.multipleData[i], 'amount', 0)
  1283. }
  1284. arrData = [...arrData, ...this.multipleData[i]]
  1285. }
  1286. if (this.goodsList.length) {
  1287. this.goodsList = [...this.goodsList, ...arrData]
  1288. } else {
  1289. this.goodsList = arrData
  1290. }
  1291. if (this.dataList.length) {
  1292. for (let u = 0; u < this.goodsList.length; u++) {
  1293. this.goodsList[u].disabled = true
  1294. }
  1295. this.newDataList = this.multipleSelection
  1296. this.disabled = true
  1297. }
  1298. this.goodsList.forEach(item => {
  1299. item.sums1 = ['qty', 'directTransferQty']
  1300. item.sums2 = [
  1301. 'price',
  1302. 'rebateAmount',
  1303. 'compute_amount',
  1304. 'compute_flAmount',
  1305. 'compute_zkAmount',
  1306. 'compute_sfAmount'
  1307. ]
  1308. this.$set(item, 'status1', '')
  1309. this.$set(item, 'status2', '')
  1310. this.$set(item, 'userList', this.userList)
  1311. })
  1312. if (this.goodsList.length && this.goodsList[0].wallets.length) {
  1313. console.log(555555)
  1314. this.mainForm.k3ServiceName = this.goodsList[0].wallets[0].serviceName || ''
  1315. this.mainForm.k3ServiceId = this.goodsList[0].wallets[0].serviceId || ''
  1316. }
  1317. // if (this.goodsList.length>4) {
  1318. // this.newGoodsList = this.goodsList
  1319. // this.newGoodsList.length = 4
  1320. // }
  1321. this.cusIndex = 0
  1322. this.total = 0
  1323. this.popDataArr = []
  1324. this.multipleData = []
  1325. this.multipleSelection = []
  1326. this.policyId = this.screenForm.policyId
  1327. this.totalQty = this.totalPrice = this.totalAmount = 0
  1328. this.isShowDialog = false
  1329. this.$refs.singleTable.clearSelection()
  1330. // consloe(this.goodsList, "kkkk");
  1331. } else if (this.multipleSelections.length) {
  1332. let arrData = []
  1333. this.newMultipleSelections = this.multipleSelections
  1334. for (let i = 0; i < this.multipleSelections.length; i++) {
  1335. for (let j = 0; j < this.multipleSelections[i].length; j++) {
  1336. this.multipleSelections[i][j].disabled = true
  1337. this.multipleSelections[i][j].id = null
  1338. if (this.multipleSelections[i][j].wallets.length) {
  1339. this.$set(
  1340. this.multipleSelections[i][j],
  1341. 'customerWalletId',
  1342. this.multipleSelections[i][j].wallets[0].customerWalletId
  1343. )
  1344. this.$set(
  1345. this.multipleSelections[i][j],
  1346. 'serviceName',
  1347. this.multipleSelections[i][j].wallets[0].serviceName
  1348. )
  1349. this.$set(this.multipleSelections[i][j], 'serviceId', this.multipleSelections[i][j].wallets[0].serviceId)
  1350. this.$set(this.multipleSelections[i][j], 'amount', 0)
  1351. }
  1352. arrData = [...arrData, this.multipleSelections[i][j]]
  1353. }
  1354. }
  1355. if (this.goodsList.length) {
  1356. this.goodsList = [...this.goodsList, ...arrData]
  1357. } else {
  1358. this.goodsList = arrData
  1359. }
  1360. if (this.goodsList.length && this.goodsList[0].wallets.length) {
  1361. this.mainForm.k3ServiceName = this.goodsList[0].wallets[0].serviceName || ''
  1362. this.mainForm.k3ServiceId = this.goodsList[0].wallets[0].serviceId || ''
  1363. }
  1364. this.goodsList.forEach(item => {
  1365. this.$set(item, 'status1', '')
  1366. this.$set(item, 'status2', '')
  1367. this.$set(item, 'userList', this.userList)
  1368. item.sums1 = ['qty', 'directTransferQty']
  1369. item.sums2 = [
  1370. 'price',
  1371. 'rebateAmount',
  1372. 'compute_amount',
  1373. 'compute_flAmount',
  1374. 'compute_zkAmount',
  1375. 'compute_sfAmount'
  1376. ]
  1377. })
  1378. this.disabled = true
  1379. // this.popDataArr = [];
  1380. this.multipleData = []
  1381. this.multipleSelection = []
  1382. this.policyId = this.screenForm.policyId
  1383. this.totalQty = this.totalPrice = this.totalAmount = 0
  1384. this.isShowDialog = false
  1385. this.$refs.singleTable.forEach(k => {
  1386. k.clearSelection()
  1387. })
  1388. // this.$refs.singleTable.clearSelection();
  1389. } else {
  1390. this.$errorMsg('请选择')
  1391. }
  1392. },
  1393. // 获取详情
  1394. getDetail() {
  1395. getUserList({
  1396. pageNum: 1,
  1397. pageSize: -1,
  1398. adminWebsitId: '',
  1399. isCustomer: 0,
  1400. roleId: '',
  1401. status: true,
  1402. userName: ''
  1403. }).then(res => {
  1404. this.userList = res.data.records
  1405. getDetail({ id: this.listItem.id }).then(res => {
  1406. const data = res.data
  1407. this.mainForm.date = data.theTime
  1408. this.mainForm.type = data.mainId
  1409. this.mainForm.remark = data.remark
  1410. this.mainForm.policyId = data.policyId
  1411. this.mainForm.isPlanOrder = data.isPlanOrder
  1412. this.commercialType = data.commercialType
  1413. this.correspondId = data.correspondId
  1414. this.correspondName = data.correspondName
  1415. this.warehouseValue = data.correspondId
  1416. this.policyId = data.policyId
  1417. this.mainForm.k3ServiceName = data.k3ServiceName
  1418. ;(this.mainForm.k3ServiceId = data.k3ServiceId), (this.mainForm.fileNum = data.fileNum)
  1419. // this.mainForm.k3ServiceName = data.retailOrderItemList[0].wallets[0].serviceName
  1420. // this.mainForm.k3ServiceId = data.retailOrderItemList[0].wallets[0].serviceId
  1421. data.retailOrderItemList.forEach(item => {
  1422. item.correspondName = data.correspondName
  1423. item.warehouseValue = data.correspondId
  1424. item.status1 = ''
  1425. item.status2 = ''
  1426. item.sums1 = ['qty', 'directTransferQty']
  1427. item.sums2 = [
  1428. 'price',
  1429. 'rebateAmount',
  1430. 'compute_amount',
  1431. 'compute_flAmount',
  1432. 'compute_zkAmount',
  1433. 'compute_sfAmount'
  1434. ]
  1435. this.$set(item, 'userList', this.userList)
  1436. item.rebateWallets.forEach(j => {
  1437. if (j.customerWalletId2 === data.customerWalletId2) {
  1438. this.$set(item, 'amount', j.amount || 0)
  1439. }
  1440. })
  1441. item.wallets.forEach(k => {
  1442. if (k.customerWalletId === data.customerWalletId) {
  1443. this.$set(item, 'serviceId', k.serviceId)
  1444. this.$set(item, 'serviceName', k.serviceName)
  1445. }
  1446. })
  1447. })
  1448. this.goodsList = data.retailOrderItemList
  1449. })
  1450. })
  1451. },
  1452. // 获取销售政策
  1453. getPolicyList() {
  1454. policyList({
  1455. pageNum: 1,
  1456. pageSize: -1,
  1457. customerId: JSON.parse(localStorage.getItem('supply_user')).customerId,
  1458. status: true
  1459. }).then(res => {
  1460. if (this.policyId) {
  1461. this.screenForm.policyId = this.policyId
  1462. this.disabled = true
  1463. } else {
  1464. this.screenForm.policyId = res.data.records[0].code
  1465. }
  1466. this.policyList = res.data.records
  1467. console.log(res.data.records)
  1468. if (this.policyList.length) {
  1469. this.screenForm.saleTypeCode = ''
  1470. this.screenForm.specifications = ''
  1471. this.handlePolicy(this.screenForm.policyId)
  1472. // const type = this.policyList.find(e=>e.code==this.screenForm.policyId).type
  1473. // if (type === "PROVISION") {
  1474. // // this.handlePolicy( res.data.records[0].id);
  1475. // }else{
  1476. // }
  1477. }
  1478. })
  1479. },
  1480. // 引用销售政策搜索
  1481. async handlePolicyTypeList() {
  1482. if (!this.screenForm.policyId) {
  1483. this.$errorMsg('请选择销售政策')
  1484. return
  1485. }
  1486. if (this.popArr.length) {
  1487. this.popDataArr = []
  1488. this.dataList = []
  1489. for (let i = 0; i < this.popArr.length; i++) {
  1490. await this.getConditionList(this.policyConditionId, i + 1, false)
  1491. }
  1492. } else {
  1493. // sProvision = true
  1494. this.getMaterialTypeList('sProvision')
  1495. }
  1496. },
  1497. // 获取销售类型
  1498. getTypeList() {
  1499. const params = {
  1500. pageNum: 1,
  1501. pageSize: -1,
  1502. saleCode: '',
  1503. saleName: '',
  1504. status: ''
  1505. }
  1506. typeList(params).then(res => {
  1507. this.ztypeList = res.data.records
  1508. // // consloe(this.ztypeList, "type1111");
  1509. })
  1510. },
  1511. // 获取仓库列表
  1512. getWarehouseList() {
  1513. getWarehouseList({
  1514. pageNum: 1,
  1515. pageSize: -1
  1516. }).then(res => {
  1517. this.warehouseList = res.data.records
  1518. })
  1519. },
  1520. // 获取限定机型
  1521. getpolicyTypeList() {
  1522. getpolicyTypeList({
  1523. pageNum: 1,
  1524. pageSize: 10,
  1525. policyId: this.screenForm.policyId,
  1526. saleTypeCode: this.screenForm.saleTypeCode
  1527. }).then(res => {
  1528. for (let i = 0; i < res.data.records.length; i++) {
  1529. this.$set(res.data.records[i], 'qty', 1)
  1530. res.data.records[i].sums2 = ['price', 'qty', 'zong']
  1531. res.data.records[i].userList = this.userList
  1532. }
  1533. this.dataList = res.data.records
  1534. this.total = res.data.total
  1535. })
  1536. },
  1537. // 打开引用
  1538. handleShow() {
  1539. this.isShowDialog = true
  1540. this.getPolicyList()
  1541. },
  1542. // 获取钱包列表
  1543. getWalletList() {
  1544. getWalletList({
  1545. customerId: JSON.parse(localStorage.getItem('supply_user')).customerId,
  1546. type: 'COMMONLY'
  1547. }).then(res => {
  1548. this.xjWalletList = res.data
  1549. })
  1550. getWalletList({
  1551. customerId: JSON.parse(localStorage.getItem('supply_user')).customerId,
  1552. type: 'REBATE'
  1553. }).then(res => {
  1554. this.flWalletList = res.data
  1555. })
  1556. },
  1557. // 获取销售类型列表
  1558. getSalesTypeList() {
  1559. getSalesTypeList({
  1560. pageNum: 1,
  1561. pageSize: -1
  1562. }).then(res => {
  1563. this.salesTypeList = res.data.records
  1564. })
  1565. },
  1566. getDictList() {
  1567. getDictList({ sysDictEnum: 'PRODUCT_TYPE' }).then(res => {
  1568. this.typeList = res.data
  1569. })
  1570. },
  1571. // 获取商品列表
  1572. getGoodsList() {
  1573. getGoodsList({
  1574. pageNum: this.currentPage,
  1575. pageSize: 10,
  1576. mainId: this.screenForm.type,
  1577. saleId: this.screenForm.salesType,
  1578. materialCode: this.screenForm.proNum,
  1579. materialName: this.screenForm.proName,
  1580. specification: this.screenForm.proModel,
  1581. price1: this.screenForm.price1,
  1582. price2: this.screenForm.price2
  1583. }).then(res => {
  1584. const oldGoodsList = this.goodsList
  1585. const newGoodsList = res.data.records
  1586. for (let i = 0; i < oldGoodsList.length; i++) {
  1587. const oldItem = oldGoodsList[i]
  1588. for (let j = 0; j < newGoodsList.length; j++) {
  1589. const newItem = newGoodsList[j]
  1590. if (newItem.materialId === oldItem.materialId) {
  1591. newGoodsList[j].selected = true
  1592. break
  1593. }
  1594. }
  1595. }
  1596. res.data.records.forEach(item => {
  1597. item.materialName = item.name
  1598. item.materialCode = item.number
  1599. item.saleTypeName = item.saleName
  1600. item.unit = item.baseUnit
  1601. item.price = item.batchPrice
  1602. item.tax = item.taxRate
  1603. item.isDirectTransfer = false
  1604. item.directTransferQty = ''
  1605. item.status1 = ''
  1606. item.status2 = ''
  1607. item.rebateAmount = ''
  1608. item.rebateRate = ''
  1609. item.productPriceId = item.id
  1610. })
  1611. this.leftGoodsList = res.data.records
  1612. this.listTotal = res.data.total
  1613. })
  1614. },
  1615. // 查询重复值并禁选
  1616. checkboxSelect(row, rowIndex) {
  1617. if (row.selected) {
  1618. return false // 禁用
  1619. } else {
  1620. return true // 不禁用
  1621. }
  1622. },
  1623. // 点击 选择商品
  1624. openDialog() {
  1625. this.getSalesTypeList()
  1626. this.getGoodsList()
  1627. this.isShowDialog = true
  1628. },
  1629. // 提交筛选表单
  1630. submitScreenForm() {
  1631. this.currentPage = 1
  1632. this.getGoodsList()
  1633. },
  1634. // 重置筛选表单
  1635. resetScreenForm() {
  1636. this.$refs.screenForm.resetFields()
  1637. this.currentPage = 1
  1638. this.getGoodsList()
  1639. },
  1640. // 关闭 弹窗
  1641. closeDialog() {
  1642. this.isShowDialog = false
  1643. this.popDataArr = []
  1644. },
  1645. // 删除
  1646. deleteGoods() {
  1647. const rightGoodsList = this.rightGoodsList
  1648. const rightSelection = this.rightSelection
  1649. for (let i = 0; i < rightGoodsList.length; i++) {
  1650. for (let j = 0; j < rightSelection.length; j++) {
  1651. if (rightSelection[j].materialId == rightGoodsList[i].materialId) {
  1652. this.rightGoodsList.splice(i, 1)
  1653. }
  1654. }
  1655. }
  1656. },
  1657. // 确定 添加产品
  1658. submitAddGoods() {
  1659. if (this.radio) {
  1660. const params = this.radio.split('&')
  1661. this.screenForm.policyId = params[1]
  1662. this.mainForm.policyId = params[1]
  1663. this.cusIndex += 1
  1664. getpolicyList({
  1665. materialId: params[2],
  1666. policyId: params[1]
  1667. }).then(res => {
  1668. this.pop = res.data.pop
  1669. this.popArr = res.data.pop.split(':')
  1670. this.popArr.splice(0, 1)
  1671. for (let i = 0; i < this.popArr.length; i++) {
  1672. this.$set(this.radioObj, 'radio' + (i + 1), '')
  1673. }
  1674. this.step = this.cusIndex + 1
  1675. this.getConditionList(params[3], this.step)
  1676. })
  1677. } else {
  1678. this.$errorMsg('请选择')
  1679. }
  1680. },
  1681. // 更改每页数量
  1682. handleSizeChange(val) {
  1683. this.pageSize = val
  1684. this.currentPage = 1
  1685. this.getConditionList(this.policyConditionId, this.cusIndex + 1)
  1686. },
  1687. // 更改当前页
  1688. handleCurrentChange(val) {
  1689. this.currentPage = val
  1690. this.getConditionList(this.policyConditionId, this.cusIndex + 1)
  1691. },
  1692. // 更改列表当前页
  1693. handleTableCurrentChange(val) {
  1694. this.currentPage = val
  1695. this.getConditionList(this.policyConditionId, this.cusIndex + 1)
  1696. },
  1697. handleClose() {
  1698. this.totalQty = this.totalPrice = this.totalAmount = 0
  1699. // this.dataList = [];
  1700. // this.popDataArr = [];
  1701. // this.screenForm.policyId = "";
  1702. // this.screenForm.saleTypeCode = "";
  1703. },
  1704. // 删除产品
  1705. deleteItem(index, id) {
  1706. this.goodsList.splice(index, 1)
  1707. // this.dataList
  1708. this.newDataList.splice(index, 1)
  1709. if (!this.goodsList.length) {
  1710. this.disabled = false
  1711. this.policyId = ''
  1712. this.mainForm.policyId = ''
  1713. }
  1714. // this.popDataArr.splice(index,1)
  1715. },
  1716. // 修改返利钱包
  1717. changeWallet(e, row) {
  1718. if (e) {
  1719. const obj = row.rebateWallets.filter(k => {
  1720. return e === k.customerWalletId
  1721. })[0]
  1722. this.$set(row, 'rebateRate', obj.rebateRate || 0)
  1723. this.$set(row, 'amount', obj.amount || 0)
  1724. } else {
  1725. this.$set(row, 'rebateRate', 0)
  1726. this.$set(row, 'amount', 0)
  1727. }
  1728. },
  1729. clearWallet(e) {
  1730. console.log(e)
  1731. // const obj = row.rebateWallets.filter(k => {
  1732. // return e === k.customerWalletId
  1733. // })[0]
  1734. this.$set(row, 'rebateRate', 0)
  1735. },
  1736. // 检查库存
  1737. checkStock() {
  1738. if (!this.warehouseValue) {
  1739. return this.$errorMsg('请选择仓库')
  1740. }
  1741. if (!this.goodsList) {
  1742. return this.$errorMsg('请添加货品')
  1743. }
  1744. const ids = []
  1745. this.goodsList.forEach(item => {
  1746. ids.push(item.materialId)
  1747. })
  1748. checkStock({
  1749. correspondId: this.warehouseValue,
  1750. materialId: ids.join(',')
  1751. }).then(res => {
  1752. if (res.data) {
  1753. this.goodsList.forEach((item, index) => {
  1754. item.status1 = res.data[index].allStockNum
  1755. item.status2 = res.data[index].stockNum
  1756. // // consloe(item.status1, item.status2);
  1757. })
  1758. }
  1759. })
  1760. },
  1761. status2Filter(item) {
  1762. if (item.status2 === '' || item.status2 === null || item.status2 === undefined) {
  1763. return '未检查'
  1764. }
  1765. if (item.status2 <= 0) {
  1766. return '无货'
  1767. } else if (item.status2 >= 1 && item.status2 <= 30) {
  1768. return item.status2
  1769. } else if (item.status2 >= 31 && item.status2 <= 1000) {
  1770. return '有货'
  1771. } else {
  1772. return '充足'
  1773. }
  1774. // else if (item.status2 >= item.qty) return '可用'
  1775. // else return '短缺'
  1776. },
  1777. // 保存
  1778. clickSubmitForm() {
  1779. this.$refs.mainForm.validate(valid => {
  1780. if (valid) {
  1781. // let mainName =
  1782. // this.typeList[
  1783. // findElem(this.typeList, "dictCode", this.mainForm.type)
  1784. // ].dictValue;
  1785. this.goodsList.userList = []
  1786. this.goodsList.forEach(k => {
  1787. delete k.userList
  1788. })
  1789. let hasCustomerWalletId = this.goodsList.find((k, i) => {
  1790. if (!k.customerWalletId) {
  1791. this.$errorMsg(`第${i + 1}货品没现金钱包`)
  1792. return true
  1793. }
  1794. })
  1795. if (hasCustomerWalletId) return
  1796. if (this.commercialType && !this.mainForm.isPlanOrder && !this.correspondId) {
  1797. this.$errorMsg(`仓库必选`)
  1798. return
  1799. }
  1800. const params = {
  1801. theTime: this.mainForm.date,
  1802. k3ServiceId: this.mainForm.k3ServiceId,
  1803. k3ServiceName: this.mainForm.k3ServiceName,
  1804. isPlanOrder: this.mainForm.isPlanOrder,
  1805. commercialType: this.commercialType,
  1806. correspondName: this.correspondName,
  1807. correspondId: this.correspondId,
  1808. remark: this.mainForm.remark,
  1809. type: 2, // 1:普通零售单,2:政策零售单
  1810. retailOrderItemList: this.goodsList,
  1811. policyId: this.policyId,
  1812. fileNo: this.mainForm.fileNum
  1813. }
  1814. console.log(params)
  1815. if (this.listItem) {
  1816. params.id = this.listItem.id
  1817. editData(params).then(res => {
  1818. this.$successMsg('编辑成功')
  1819. this.goBack()
  1820. this.$parent.getList()
  1821. })
  1822. } else {
  1823. params.retailOrderItemList.forEach(k => {
  1824. k.id = null
  1825. })
  1826. addData(params).then(res => {
  1827. this.$successMsg('添加成功')
  1828. this.goBack()
  1829. this.$parent.getList()
  1830. })
  1831. }
  1832. }
  1833. })
  1834. }
  1835. }
  1836. }
  1837. </script>
  1838. <style scoped lang="scss">
  1839. .yinput {
  1840. ::v-deep .el-input__inner {
  1841. text-align: right;
  1842. }
  1843. }
  1844. .fr {
  1845. margin: 10px;
  1846. overflow: hidden;
  1847. }
  1848. .detail-container {
  1849. width: 100%;
  1850. height: 100%;
  1851. margin-bottom: 80px;
  1852. ::v-deep .el-table__append-wrapper {
  1853. overflow: initial;
  1854. }
  1855. }
  1856. .table {
  1857. margin-top: 20px 0 0 0;
  1858. background-color: rgb(237 237 237);
  1859. }
  1860. .page-footer .footer.hideSidebar {
  1861. margin-left: 0;
  1862. width: 100%;
  1863. }
  1864. .mybox {
  1865. padding: 20px 0;
  1866. text-align: right;
  1867. div:first-child {
  1868. flex: 0 0 55px;
  1869. }
  1870. div {
  1871. flex: 1 0 200px;
  1872. padding-right: 10px;
  1873. text-align: right;
  1874. }
  1875. }
  1876. .myselect {
  1877. ::v-deep .el-select-dropdown__item {
  1878. max-width: 500px;
  1879. }
  1880. }
  1881. .main-title {
  1882. display: flex;
  1883. justify-content: space-between;
  1884. align-items: center;
  1885. margin-top: 20px;
  1886. height: 60px;
  1887. border-bottom: 1px solid #dcdfe6;
  1888. margin-bottom: 20px;
  1889. .title {
  1890. font-size: 16px;
  1891. font-weight: 600;
  1892. padding-left: 10px;
  1893. }
  1894. }
  1895. .tables {
  1896. display: flex;
  1897. margin-top: 10px;
  1898. .table {
  1899. width: 45%;
  1900. }
  1901. .buttons {
  1902. display: flex;
  1903. flex-direction: column;
  1904. justify-content: center;
  1905. align-items: center;
  1906. padding: 0 10px;
  1907. button {
  1908. margin: 0;
  1909. margin-top: 10px;
  1910. }
  1911. }
  1912. }
  1913. .ellipsis {
  1914. overflow: hidden;
  1915. text-overflow: ellipsis;
  1916. white-space: nowrap;
  1917. }
  1918. </style>