detailsPage.vue 71 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700
  1. <template>
  2. <div>
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="goBack(0)">返回列表
  7. </el-button>
  8. </div>
  9. <div class="add-customer-btn">
  10. <el-button class="el-button&#45;&#45;small-yh" style="margin-left: 6px;" type="primary" size="small"
  11. v-if="editButton" @click="confirmEditing">编 辑
  12. </el-button>
  13. <el-button class="el-button--small-yh" v-else style="margin-left: 6px;" type="primary" size="small"
  14. :disabled="isSaveBtn" @click="editCustomer">保 存
  15. </el-button>
  16. <el-button class="el-button--small-yh" style="margin-left: 6px;" type="info" size="small"
  17. :disabled="form.status != '已发货' || form.returnsNumber == form.goodsTotalNum || editButton"
  18. @click="getReturns">
  19. 销售退货
  20. </el-button>
  21. <el-button v-if="form.status != '已发货'" class="el-button--small-yh" style="margin-left: 6px;"
  22. type="success" size="small" :disabled="!form.id || editButton" @click="confirm(1)">确认到货
  23. </el-button>
  24. <el-button v-if="form.status == '已发货'" class="el-button--small-yh" style="margin-left: 6px;"
  25. type="danger" size="small" :disabled="!form.id || editButton" @click="confirm(2)">撤销到货
  26. </el-button>
  27. </div>
  28. </div>
  29. <div style="margin-top: 50px">
  30. <trade-card title="基础信息">
  31. <avue-form :option="optionForm" v-model="form" ref="form">
  32. <tempalte slot="customerName" slot-scope="{ row }">
  33. <dic-select v-model="form.customerName" placeholder="客户" key="id" label="cname" res="records"
  34. url="/blade-sales-part/corpsDesc/list?current=1&size=10&corpType=KH" :filterable="true"
  35. :remote="true" dataName="cname" @selectChange="dicChange('customerName', $event)"
  36. :disabled="editButton || form.status == '已发货' || form.businessSource == '外部销售'"></dic-select>
  37. </tempalte>
  38. <template slot-scope="{row,index}" slot="contacts">
  39. <el-select v-model="form.contacts" placeholder="请选择" size="small" style="width:60%" clearable
  40. filterable allow-create default-first-option @change="contactsChange($event)"
  41. :disabled="editButton || form.status == '已发货' || form.businessSource == '外部销售'">
  42. <el-option v-for="item in contactsOption" :key="item.id" :label="item.contacts"
  43. :value="item.contacts" />
  44. </el-select>
  45. </template>
  46. </avue-form>
  47. </trade-card>
  48. <trade-card title="明细信息">
  49. <el-tabs v-model="activeName" type="card">
  50. <el-tab-pane label="销售明细" name="sale_detail">
  51. <avue-crud :option="optionContacts" ref="formContacts" :data="form.orderItemsList" :key="key"
  52. @selection-change="selectionChange"
  53. @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 434)"
  54. @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 434)">
  55. <template slot-scope="{scope,row}" slot="menuLeft">
  56. <el-button type="primary" icon="el-icon-plus" size="small"
  57. :disabled="editButton || form.status == '已发货' || form.businessSource == '外部销售'"
  58. @click="rowAdd(row, 1)">添加商品</el-button>
  59. <el-button type="success" size="small"
  60. :disabled="!form.id || editButton || form.status == '已发货' || form.businessSource == '外部销售'"
  61. icon="el-icon-bottom" @click="excelDialogfun('名称')">按名称导入
  62. </el-button>
  63. <el-button type="success" size="small"
  64. :disabled="!form.id || editButton || form.status == '已发货' || form.businessSource == '外部销售'"
  65. icon="el-icon-bottom" @click="excelDialogfun('code')">按Code导入
  66. </el-button>
  67. <el-popover placement="top" width="400" trigger="click" @show="inventoryShow2()">
  68. <avue-crud :data="inventoryList" :option="inventoryOption">
  69. </avue-crud>
  70. <el-button slot="reference" type="primary" plain size="small"
  71. :disabled="selectionMultilist.length != 1">查看库存</el-button>
  72. </el-popover>
  73. <el-button type="primary" plain size="small"
  74. :disabled="selectionMultilist.length == 0 || editButton || form.status == '已发货'"
  75. @click="allClick('派发销售单')">派发销售单</el-button>
  76. <el-button type="danger" plain size="small" @click="allClick('撤销派发')"
  77. :disabled="selectionMultilist.length == 0 || editButton || form.status == '已发货'">撤销派发</el-button>
  78. <el-button type="primary" icon="el-icon-printer" size="small"
  79. @click="handlePrint">打印</el-button>
  80. <el-button type="danger" plain size="small" @click="batchDelete"
  81. :disabled="editButton || form.status == '已发货' || form.businessSource == '外部销售'">一键删除</el-button>
  82. </template>
  83. <template slot="goodsId" slot-scope="{ row }">
  84. {{ row.goodsName }}
  85. </template>
  86. <template slot="goodsNum" slot-scope="{ row }">
  87. <el-input-number v-if="row.$cellEdit" size="small" v-model="row.goodsNum"
  88. :precision="numberDecimal" :controls="false" @change="goodsNumblurfun(row)"
  89. style="width: 100%"></el-input-number>
  90. <span v-else>{{ row.goodsNum }}</span>
  91. </template>
  92. <template slot="price" slot-scope="{ row }">
  93. <el-input v-if="row.$cellEdit" size="small" v-model="row.price"
  94. style="width: 100%"></el-input>
  95. <span v-else>{{ row.price }}</span>
  96. </template>
  97. <template slot="dot" slot-scope="{ row }">
  98. <el-select v-if="row.$cellEdit" v-model="row.dot" filterable default-first-option
  99. @focus="picihaolistfun(row.goodsId)" @change="dotchangefun($event, row)"
  100. size="small">
  101. <el-option v-for="(item, index) in picihaolist" :key="index" :label="item.dot"
  102. :value="item.dot"></el-option>
  103. </el-select>
  104. <span v-else>{{ row.dot }}</span>
  105. </template>
  106. <template slot="subTotalMoney" slot-scope="{ row }">{{ row.goodsNum * row.price
  107. }}</template>
  108. <template slot="remarks" slot-scope="{ row }">
  109. <el-input v-if="row.$cellEdit" size="small" v-model="row.remarks"
  110. style="width: 100%"></el-input>
  111. <span v-else>{{ row.remarks }}</span>
  112. </template>
  113. <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  114. <el-button v-if="!row.$cellEdit" :size="size" :disabled="editButton || row.sendNum > 0"
  115. :type="type" icon="el-icon-edit" @click="rowCell(row, index)">编辑
  116. </el-button>
  117. <el-button v-else :size="size" :disabled="editButton || row.sendNum > 0" :type="type"
  118. icon="el-icon-plus" @click="rowSave(row, index)">保存
  119. </el-button>
  120. <el-button icon="el-icon-delete" :size="size" :disabled="editButton || row.sendNum > 0"
  121. :type="type" @click="rowDelBox(row, index, 'orderItemsList')">删除
  122. </el-button>
  123. </template>
  124. </avue-crud>
  125. <el-dialog title="导入明细" append-to-body :visible.sync="excelBox" v-if="excelBox" width="555px"
  126. :close-on-click-modal="false" v-dialog-drag>
  127. <avue-form :option="excelOption" v-model="excelForm" table-loading="excelLoading"
  128. :upload-before="uploadBefore" :upload-after="uploadAfter">
  129. <template slot="excelTemplate">
  130. <el-button type="primary" @click="derivation">
  131. 点击下载<i class="el-icon-download el-icon--right"></i>
  132. </el-button>
  133. </template>
  134. </avue-form>
  135. <p style="text-align: center;color: #DC0505">
  136. 温馨提示 第一次导入时请先下载模板
  137. </p>
  138. </el-dialog>
  139. </el-tab-pane>
  140. <el-tab-pane label="支付明细" name="payment_details">
  141. <avue-crud :option="optionPaymentDetails" v-model="formContacts" ref="payment_details"
  142. :data="dataList" @row-save="rowSave" @row-update="rowUpdate"
  143. @resetColumn="resetColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 269.2)"
  144. @saveColumn="saveColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 269.2)">
  145. </avue-crud>
  146. </el-tab-pane>
  147. <el-tab-pane label="共享记录" name="outbound_records">
  148. <avue-crud :option="optionOutboundRecords" v-model="formContacts" ref="outbound_records"
  149. :data="form.shareSalesItemsList" @row-save="rowSave" @row-update="rowUpdate"
  150. @resetColumn="resetColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 435)"
  151. @saveColumn="saveColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 435)">
  152. <!-- <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  153. <el-button :size="size" :disabled="disabled" :type="type"
  154. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  155. @click="$refs.formContacts.rowCell(row, index)">{{ row.$cellEdit ? '确认' : '修改' }}
  156. </el-button>
  157. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
  158. @click="rowDelBox(row, index)">删除
  159. </el-button>
  160. </template> -->
  161. </avue-crud>
  162. </el-tab-pane>
  163. </el-tabs>
  164. </trade-card>
  165. <report-dialog :switchDialog="switchDialog" reportName="轮胎商城-销售订单" :reportId="form.id"
  166. @onClose="onClose()"></report-dialog>
  167. </div>
  168. <el-dialog title="选择商品" append-to-body class="el-dialogDeep" :visible.sync="dialogVisible" width="80%"
  169. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" @close="closeGoods">
  170. <el-row>
  171. <el-col :span="5">
  172. <div>
  173. <el-scrollbar>
  174. <basic-container>
  175. <avue-tree style="height: 60vh;overflow-y: auto" :option="treeOption"
  176. :data="treeDataGoods" @node-click="nodeClick" />
  177. </basic-container>
  178. </el-scrollbar>
  179. </div>
  180. </el-col>
  181. <el-col :span="19">
  182. <basic-container>
  183. <avue-crud :option="optionTwo" :table-loading="loading" :data="goodsListShow" ref="crud"
  184. :search.sync="SelectSearch" @refresh-change="refreshChange" @search-change="goodsSearch"
  185. :page.sync="page" @on-load="onLoad" @resetColumn="resetCrud" @saveColumn="saveCrud">
  186. <template slot="menuLeft">
  187. <el-tabs v-model="activeNameTabs" @tab-click="tabHandle">
  188. <el-tab-pane label="查询结果" name="searchList" />
  189. <el-tab-pane label="已选定数据" name="importStaging" />
  190. </el-tabs>
  191. </template>
  192. <template slot="goodsNum" slot-scope="{row}">
  193. <el-input-number v-model="row.goodsNum" size="small" :controls="false"
  194. :precision="numberDecimal" @input="amountChange($event, row)" style="width: 100%" />
  195. </template>
  196. <template slot="dot" slot-scope="{row}">
  197. <!--使用allow-create属性即可通过在输入框中输入文字来创建新的条目。注意此时filterable必须为真。-->
  198. <!--本例还使用了default-first-option属性, 在该属性打开的情况下,按下回车就可以选中当前选项列表中的第一个选项,-->
  199. <!--无需使用鼠标或键盘方向键进行定位。-->
  200. <!--allow-create filterable default-first-option-->
  201. <el-select v-model="row.dot" filterable default-first-option size="small"
  202. @focus="picihaolistfun(row.id)" @change="dotchangefun($event, row)">
  203. <el-option v-for="(item, index) in picihaolist" :key="index" :label="item.dot"
  204. :value="item.dot"></el-option>
  205. </el-select>
  206. <!--<span v-else>{{ row.dot }}</span>-->
  207. </template>
  208. <template slot="price" slot-scope="{row}">
  209. <el-input-number v-model="row.price" size="small" :controls="false"
  210. style="width: 100%" />
  211. </template>
  212. <template slot-scope="scope" slot="menu">
  213. <el-button type="text" icon="el-icon-edit" size="small"
  214. @click.stop="importStagList(scope.row, scope.index)"
  215. v-if="activeNameTabs == 'searchList'"
  216. :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1">选择
  217. </el-button>
  218. <el-button type="text" icon="el-icon-delete" size="small"
  219. @click.stop="removeStagList(scope.row, scope.index)" v-else>移除
  220. </el-button>
  221. </template>
  222. <template slot="inventory" slot-scope="scope">
  223. <span style="color: #489fef">
  224. {{ Number(scope.row.inventory) }}
  225. </span>
  226. </template>
  227. </avue-crud>
  228. </basic-container>
  229. </el-col>
  230. </el-row>
  231. <span slot="footer" class="dialog-footer">
  232. <el-button @click="dialogVisible = false" :loading="saveLoading">取 消</el-button>
  233. <el-button type="primary" @click="importGoods" :loading="saveLoading">导入</el-button>
  234. <!--<el-button type="primary" @click="importChoice" v-if="commodityData === true" :loading="saveLoading"-->
  235. <!-- :disabled="tableData.length !== 1">导入</el-button>-->
  236. </span>
  237. </el-dialog>
  238. <el-dialog title="派发销售单" append-to-body class="el-dialogDeep" :visible.sync="distributeVisible" width="60%"
  239. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false"
  240. @close="distributeGoods">
  241. <div>
  242. <div style="display: flex;align-items: center;">
  243. <span>
  244. 共享公司:
  245. </span>
  246. <dic-select v-model="sharedCompany" placeholder="共享公司" key="id" label="deptName"
  247. url="/blade-system/dept/deptListAll" :filterable="true"
  248. @selectChange="dicChange('sharedCompany', $event)"></dic-select>
  249. </div>
  250. <avue-crud :data="selectionMultilist" :option="distributeOption">
  251. <template slot="outGoodsTotalShipNum" slot-scope="{row}">
  252. <el-input-number v-model="row.outGoodsTotalShipNum" size="small" :controls="false"
  253. style="width: 100%" @change="outGoodsChange(row)" />
  254. </template>
  255. <template slot-scope="{type,size,row,index}" slot="menu">
  256. <el-popover placement="top" width="400" trigger="click" @show="inventoryShow(row)">
  257. <avue-crud :data="inventoryList" :option="inventoryOption">
  258. </avue-crud>
  259. <el-button slot="reference" size="small" type="text">查看库存</el-button>
  260. </el-popover>
  261. </template>
  262. </avue-crud>
  263. </div>
  264. <span slot="footer" class="dialog-footer">
  265. <el-button @click="distributeVisible = false" :loading="saveLoading" size="small">取 消</el-button>
  266. <el-button type="primary" @click="inDistribute" :loading="saveLoading" size="small">确认派发</el-button>
  267. </span>
  268. </el-dialog>
  269. </div>
  270. </template>
  271. <script>
  272. import { getDetails as getCustom } from "@/api/tirePartsMall/basicData/customerInformation"
  273. import { getDetails as getDetailsGods } from '@/api/tirePartsMall/basicData/commodityInformation'
  274. import {
  275. getDetails,
  276. submit,
  277. delOrderItem,
  278. checkOrder,
  279. confirmRefund,
  280. revokeCheckOrder,
  281. goodsListXs,
  282. goodsPageXs,
  283. distributeShareSales,
  284. revokeDistributeShareSales,
  285. confirmShipment,
  286. revokeShipment,
  287. listAllByGoodsId
  288. } from "@/api/tirePartsMall/basicData/shareSales";
  289. import { dotList, goodsDetail } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
  290. import reportDialog from "@/components/report-dialog/main";
  291. import { dateFormat } from "@/util/date";
  292. import checkSchedule from "@/components/checkL/checkSchedule";
  293. import check from "@/components/checkL/check";
  294. import dicSelect from "@/components/dicSelect/main";
  295. import commodityxsho from '../../configuration/commodityxsho.json'
  296. import TicketDistribution from "../../../oceanShipping/maritimeExport/components/ticketDistribution.vue";
  297. import M from "minimatch";
  298. import da from "element-ui/src/locale/lang/da";
  299. import { number } from "echarts";
  300. import { getCorpTypes } from "@/api/tirePartsMall/basicData/commodityInformation";
  301. import { getWorkDicts } from "../../../../api/system/dictbiz";
  302. import losbfeestemplate from "@/views/iosBasicData/losbfeestemplate/index.vue";
  303. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  304. import {
  305. getList as KHgetList
  306. } from "@/api/tirePartsMall/basicData/customerInformation";
  307. import { getToken } from "@/util/auth";
  308. import { isProcurement } from "@/api/basicData/configuration";
  309. export default {
  310. name: "detailsPage",
  311. data() {
  312. return {
  313. sharedCompany: null,
  314. distributeVisible: false,
  315. numberDecimal: 0,
  316. inventoryList: [],
  317. inventoryOption: {
  318. header: false,
  319. menu: false,
  320. align: 'center',
  321. column: [
  322. {
  323. label: '来源公司',
  324. prop: 'srcSalesCompanyName',
  325. overHidden: true,
  326. },
  327. {
  328. label: '商品名称',
  329. prop: 'goodsName',
  330. overHidden: true,
  331. },
  332. {
  333. label: '库存数量',
  334. prop: 'inventory',
  335. overHidden: true,
  336. }
  337. ]
  338. },
  339. distributeOption: {
  340. header: false,
  341. border: true,
  342. stripe: true,
  343. editBtn: false,
  344. delBtn: false,
  345. menuWidth: '80',
  346. align: 'center',
  347. column: [
  348. {
  349. label: '商品名称',
  350. prop: 'goodsName',
  351. width: 360,
  352. overHidden: true,
  353. },
  354. {
  355. label: '商品数量',
  356. prop: 'goodsNum',
  357. overHidden: true,
  358. },
  359. {
  360. label: '发货数量',
  361. prop: 'sendNum',
  362. overHidden: true,
  363. },
  364. {
  365. label: '派发数量',
  366. prop: 'outGoodsTotalShipNum',
  367. overHidden: true,
  368. }
  369. ]
  370. },
  371. excelBox: false,
  372. reportName: '', // 打印传的名字
  373. SelectSearch: {}, // 添加商品检索
  374. // 编辑还是保存
  375. mingxibaocun: true,
  376. // 批次号请求到的数据
  377. picihaolist: [],
  378. // 添加商品弹窗
  379. dialogVisible: false,
  380. // 弹窗高度
  381. // rowHeight: '',
  382. // 左侧选择搜索
  383. treeDataGoods: [],
  384. treeDeptId: '',
  385. page: {
  386. pageSize: 10,
  387. currentPage: 1,
  388. total: 0,
  389. pageSizes: [10, 50, 100, 300, 500]
  390. },
  391. pageList: {
  392. pageSize: 10,
  393. currentPage: 1,
  394. total: 0
  395. },
  396. // 左侧选择
  397. treeOption: {
  398. addBtn: false,
  399. menu: false,
  400. size: "small",
  401. props: {
  402. labelText: "标题",
  403. label: "title",
  404. value: "id",
  405. }
  406. },
  407. templateUrl: '', // 模板url
  408. // 表格需要的配置
  409. optionTwo: {
  410. align: "center",
  411. height: "400",
  412. searchShow: true,
  413. searchShowBtn: false,
  414. menu: true,
  415. menuWidth: 80,
  416. searchSpan: 8,
  417. searchMenuSpan: 8,
  418. searchMenuPosition: "right",
  419. viewBtn: false,
  420. editBtn: false,
  421. delBtn: false,
  422. border: true,
  423. index: true,
  424. dialogClickModal: false,
  425. searchIcon: true,
  426. searchIndex: 2,
  427. column: [
  428. {
  429. label: "商品名称",
  430. prop: "goodsName",
  431. search: true,
  432. width: 100,
  433. overHidden: true
  434. },
  435. {
  436. label: "商品编号",
  437. prop: "goodsCode",
  438. search: true,
  439. width: 100,
  440. overHidden: true
  441. },
  442. {
  443. label: "数量",
  444. prop: "goodsNum",
  445. width: 100,
  446. overHidden: true
  447. },
  448. {
  449. label: "单价",
  450. prop: "price",
  451. width: 100,
  452. overHidden: true
  453. },
  454. {
  455. label: "库存",
  456. prop: "inventory",
  457. width: 100,
  458. overHidden: true
  459. },
  460. {
  461. label: "规格型号",
  462. prop: "specificationAndModel",
  463. width: 100,
  464. overHidden: true
  465. },
  466. {
  467. label: "公司",
  468. prop: "salesCompanyName",
  469. width: 100,
  470. overHidden: true
  471. },
  472. {
  473. label: "品牌",
  474. prop: "brandName",
  475. width: 100,
  476. overHidden: true
  477. },
  478. {
  479. label: "花纹",
  480. prop: "brandItem",
  481. width: 100,
  482. overHidden: true
  483. },
  484. {
  485. label: "是否静音棉",
  486. prop: "originalFactory",
  487. width: 100,
  488. type: 'select',
  489. dicData: [{
  490. label: '否',
  491. value: "0"
  492. }, {
  493. label: '是',
  494. value: "1"
  495. }],
  496. overHidden: true
  497. },
  498. {
  499. label: "是否防爆",
  500. prop: "explosionProof",
  501. width: 100,
  502. type: 'select',
  503. dicData: [{
  504. label: '否',
  505. value: 0
  506. }, {
  507. label: '是',
  508. value: 1
  509. }],
  510. overHidden: true
  511. },
  512. {
  513. label: "是否自修补",
  514. prop: "selfRecovery",
  515. width: 100,
  516. type: 'select',
  517. dicData: [{
  518. label: '否',
  519. value: "0"
  520. }, {
  521. label: '是',
  522. value: "1"
  523. }],
  524. overHidden: true
  525. }
  526. ]
  527. },
  528. loading: false,
  529. // 商品列表数据合计
  530. goodsListShow: [],
  531. // 商品列表暂存
  532. goodsListSave: [],
  533. saveLoading: false,
  534. commodityData: false,
  535. surplusRouteQuantityOption: [],
  536. tableData: [],
  537. // tabs切换
  538. activeNameTabs: 'searchList',
  539. data: [],
  540. courierCompaniesList: [],
  541. inventory: 0,
  542. isStatus: 1,
  543. goodsIdoptions: [],
  544. dataList: [],
  545. dicUrlWithCustomId: '',
  546. editButton: false, // 大编辑大隐藏显示
  547. isEditButton: false, // 大编辑是否禁用
  548. goods: [],
  549. isDisabled: false, // 表格删除的是否禁用
  550. isDisabledTask: false, // 撤销任务和生成任务的是否禁用
  551. contactsOption: [],
  552. isContacts: false, // 表单的联系人是否禁用
  553. checkData: {},
  554. buttonColor: 'success', // 初始颜色为success 生成任务和撤销任务颜色状态
  555. checkDialog: false, // 审核弹窗的开启关闭
  556. batchNo: '',
  557. switchDialog: false, // 打印弹窗的开启和关闭
  558. activeName: "sale_detail",
  559. disabled: false, // 表格按钮的禁用
  560. key: 0,
  561. form: {
  562. orderItemsList: [],
  563. paymentRecordsList: [],
  564. outboundRecordsList: [],
  565. freight: 5,
  566. },
  567. excelOption: {
  568. submitBtn: false,
  569. emptyBtn: false,
  570. column: [
  571. {
  572. label: "模板下载",
  573. prop: "excelTemplate",
  574. formslot: true,
  575. span: 24
  576. },
  577. {
  578. label: "导入明细",
  579. prop: "excelFile",
  580. type: "upload",
  581. drag: true,
  582. loadText: "上传中,请稍等",
  583. accept: '.xls,.xlsx',
  584. span: 24,
  585. propsHttp: {
  586. res: "data"
  587. },
  588. tip: "请上传 .xls,.xlsx 标准格式文件",
  589. action: "/api/blade-sales-part/ship/import-item"
  590. }
  591. ]
  592. },
  593. optionForm: {
  594. menuBtn: false,
  595. span: 8,
  596. disabled: false,
  597. column: [{
  598. label: '客户',
  599. prop: "customerName",
  600. disabled: false,
  601. formslot: true,
  602. rules: [{
  603. required: true,
  604. message: " ",
  605. trigger: "blur"
  606. }]
  607. },
  608. // {
  609. // label: '业务员',
  610. // // disabled: false,
  611. // prop: "salerId",
  612. // type: "select",
  613. // props: {
  614. // label: "name",
  615. // value: "id"
  616. // },
  617. // dicUrl: "/api/blade-user/salerList",
  618. // filterable: true,
  619. // }, {
  620. // label: '仓库',
  621. // prop: "storageId",
  622. // type: 'select',
  623. // disabled: true,
  624. // placeholder: '仓库为空即为异地销售',
  625. // props: {
  626. // label: 'cname',
  627. // value: 'id'
  628. // },
  629. // dicUrl: '/api/blade-sales-part/storageDesc/listAll',
  630. // },
  631. {
  632. label: '联系人',
  633. type: "select",
  634. prop: "contacts",
  635. disabled: false,
  636. allowCreate: true,
  637. filterable: true,
  638. dicData: [],
  639. props: {
  640. label: 'address',
  641. value: 'id'
  642. },
  643. dicUrl: '/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}'
  644. }, {
  645. label: '电话',
  646. disabled: false,
  647. prop: "phone",
  648. }, {
  649. label: '收货地址',
  650. prop: "recAddress",
  651. type: 'select',
  652. allowCreate: true,
  653. filterable: true,
  654. disabled: false,
  655. props: {
  656. label: 'address',
  657. value: 'address'
  658. },
  659. dicUrl: '/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}'
  660. }, {
  661. label: '业务日期',
  662. prop: "businesDate",
  663. searchProp: "businesDateList",
  664. disabled: false,
  665. type: "datetime",
  666. value: dateFormat(new Date(), 'yyyy-MM-dd'),
  667. format: "yyyy-MM-dd",
  668. valueFormat: "yyyy-MM-dd",
  669. rules: [
  670. {
  671. required: true,
  672. message: "",
  673. trigger: "blur"
  674. }
  675. ]
  676. }, {
  677. label: '收款方式',
  678. prop: "receivableType",
  679. type: "select",
  680. disabled: false,
  681. dicUrl: "/api/blade-system/dict-biz/dictionary?code=receivableType",
  682. props: {
  683. label: "dictValue",
  684. value: "dictValue"
  685. },
  686. value: '网络支付'
  687. },
  688. {
  689. label: '业务来源',
  690. prop: "businessSource",
  691. disabled: true
  692. }, {
  693. label: '配送方式',
  694. type: 'select',
  695. prop: "shipType",
  696. disabled: false,
  697. dicUrl: "/api/blade-system/dict-biz/dictionary?code=deliveryMethod",
  698. props: {
  699. label: "dictValue",
  700. value: "dictValue"
  701. },
  702. value: '物流',
  703. }, {
  704. label: '货运公司',
  705. type: 'select',
  706. prop: "logisticsCorpName",
  707. allowCreate: true,
  708. filterable: true,
  709. disabled: false,
  710. dicUrl: "/api/blade-system/dict-biz/dictionary?code=tyre_express_company",
  711. props: {
  712. label: "dictValue",
  713. value: "dictValue"
  714. }
  715. },
  716. {
  717. label: '货运单号',
  718. disabled: false,
  719. prop: "expressNo"
  720. },
  721. {
  722. label: '成本',
  723. prop: "cost",
  724. display: false,
  725. disabled: true
  726. }, {
  727. label: '毛利',
  728. prop: "grossProfit",
  729. display: false,
  730. disabled: true
  731. }, {
  732. label: '销售金额',
  733. prop: "salesAmount",
  734. disabled: true
  735. }, {
  736. label: '运费',
  737. prop: "freight",
  738. disabled: true
  739. }, {
  740. label: '总金额',
  741. prop: "totalMoney",
  742. disabled: true
  743. }, {
  744. label: '已收金额',
  745. prop: "paymentAmountTl",
  746. disabled: true
  747. }, {
  748. label: '单据编号',
  749. prop: "ordNo",
  750. disabled: true
  751. }, {
  752. label: '来源单号',
  753. prop: "srcOrdNo",
  754. disabled: true
  755. }, {
  756. label: '退货数量',
  757. prop: "returnsNumber",
  758. disabled: true
  759. }, {
  760. label: '退货金额',
  761. prop: "returnsAmount",
  762. disabled: true
  763. }, {
  764. label: '备注',
  765. prop: "remarks",
  766. type: 'textarea',
  767. disabled: false,
  768. span: 16,
  769. minRows: 1
  770. }]
  771. },
  772. formContacts: {},
  773. optionContacts: {},
  774. optionContactsBack: {
  775. disabled: false,
  776. goodsId: '',
  777. border: true,
  778. align: 'center',
  779. index: true,
  780. addBtnText: "添加商品",
  781. updateBtnText: '保存',
  782. refreshBtn: false,
  783. dialogDrag: true,
  784. addBtn: false,
  785. // 航编辑开启
  786. cellBtn: false,
  787. span: 8,
  788. height: 500,
  789. addRowBtn: false,
  790. editBtn: false,
  791. delBtn: false,
  792. menuWidth: 150,
  793. dialogTop: 25,
  794. dialogWidth: "80%",
  795. summaryText: "合计",
  796. showSummary: true,
  797. selection: true,
  798. sumColumnList: [{
  799. name: "goodsNum",
  800. type: "sum"
  801. }, {
  802. name: "sendNum",
  803. type: "sum"
  804. }, {
  805. name: "profit",
  806. type: "sum"
  807. }, {
  808. name: "subTotalMoney",
  809. type: "sum"
  810. }, {
  811. name: "thisAmount",
  812. type: "sum"
  813. }, {
  814. name: "costprie",
  815. type: "sum"
  816. }, {
  817. name: "grossProfit",
  818. type: "sum"
  819. }, {
  820. name: "returnsNumber",
  821. type: "sum"
  822. }, {
  823. name: "returnsAmount",
  824. type: "sum"
  825. }],
  826. column: [{
  827. label: '商品名称',
  828. prop: 'goodsId',
  829. width: 250,
  830. disabled: false,
  831. remote: true,
  832. overHidden: true,
  833. hide: true,
  834. type: 'select',
  835. dicData: [],
  836. props: {
  837. label: 'goodsName',
  838. value: 'goodsId'
  839. },
  840. dicUrl: `/api/blade-sales-part/goodsDesc/goodsListXs?cname={{key}}&customId=&enableOrNot=1&stock=${this.goodsId}`
  841. }, {
  842. label: '商品名称',
  843. prop: 'goodsName',
  844. width: 250,
  845. disabled: false,
  846. remote: true,
  847. overHidden: true,
  848. }, {
  849. label: '库存',
  850. prop: 'inventory',
  851. width: 250,
  852. disabled: false,
  853. remote: true,
  854. overHidden: true,
  855. }, {
  856. label: '数量',
  857. prop: 'goodsNum',
  858. overHidden: true,
  859. disabled: false,
  860. cell: true,
  861. width: 100,
  862. rules: [{
  863. required: true,
  864. message: " ",
  865. trigger: "blur"
  866. }, {
  867. validator: (rule, value, callback) => {
  868. console.log(this.formContacts.inventory);
  869. if (value < 0) {
  870. callback(new Error("数量不能小于0"));
  871. } else if (Number(value) > Number(this.formContacts.inventory)) {
  872. callback(new Error("数量不能大于库存"));
  873. } else {
  874. callback();
  875. }
  876. },
  877. trigger: "blur"
  878. }]
  879. },
  880. {
  881. label: '价格',
  882. prop: 'price',
  883. overHidden: true,
  884. width: 100,
  885. disabled: false,
  886. cell: true,
  887. rules: [{
  888. required: true,
  889. message: " ",
  890. trigger: "blur"
  891. }, {
  892. validator: (rule, value, callback) => {
  893. if (value < 0) {
  894. callback(new Error("价格不能小于0"));
  895. } else {
  896. callback();
  897. }
  898. },
  899. trigger: "blur"
  900. }]
  901. },
  902. {
  903. label: '库存',
  904. prop: 'inventory',
  905. overHidden: true,
  906. hide: true,
  907. width: 100
  908. },
  909. {
  910. label: '商品编码',
  911. prop: 'goodsNo',
  912. overHidden: true,
  913. disabled: false,
  914. width: 100
  915. },
  916. {
  917. label: '品牌',
  918. prop: 'brandName',
  919. disabled: false,
  920. width: 100,
  921. overHidden: true,
  922. },
  923. {
  924. label: '规格型号',
  925. prop: 'propertyName',
  926. overHidden: true,
  927. disabled: false,
  928. width: 100
  929. }, {
  930. label: '花纹',
  931. prop: 'pattern',
  932. overHidden: true,
  933. disabled: false,
  934. width: 100
  935. }, {
  936. label: '商品描述',
  937. prop: 'goodsDescription',
  938. disabled: false,
  939. overHidden: true,
  940. width: 100
  941. },
  942. {
  943. label: '发货数量',
  944. prop: 'sendNum',
  945. overHidden: true,
  946. width: 100,
  947. disabled: true,
  948. editDisplay: false,
  949. addDisplay: false
  950. },
  951. // {
  952. // label: '利润',
  953. // prop: 'profit',
  954. // overHidden: true,
  955. // width: 100
  956. // },
  957. {
  958. label: '小计',
  959. prop: 'subTotalMoney',
  960. overHidden: true,
  961. width: 100,
  962. disabled: true,
  963. editDisplay: false,
  964. addDisplay: false
  965. },
  966. // {
  967. // label: '返利',
  968. // prop: 'thisAmount',
  969. // overHidden: true,
  970. // width: 100
  971. // },
  972. {
  973. label: '成本',
  974. prop: 'costprie',
  975. overHidden: true,
  976. width: 100,
  977. disabled: true,
  978. editDisplay: false,
  979. addDisplay: false
  980. },
  981. {
  982. label: '毛利',
  983. prop: 'grossProfit',
  984. overHidden: true,
  985. width: 100,
  986. disabled: true,
  987. editDisplay: false,
  988. addDisplay: false
  989. },
  990. {
  991. label: '退货数量',
  992. prop: "returnsNumber",
  993. overHidden: true,
  994. width: 100,
  995. disabled: true,
  996. },
  997. {
  998. label: '退货金额',
  999. prop: "returnsAmount",
  1000. overHidden: true,
  1001. width: 100,
  1002. disabled: true,
  1003. },
  1004. {
  1005. label: '备注',
  1006. prop: "remarks",
  1007. overHidden: true,
  1008. width: 100,
  1009. disabled: false,
  1010. }
  1011. ]
  1012. },
  1013. selectionMultilist: [], // 多选数据
  1014. optionPaymentDetails: {},
  1015. optionPaymentDetailsBack: {
  1016. align: 'center',
  1017. index: true,
  1018. addBtnText: "录入明细",
  1019. menu: false,
  1020. refreshBtn: false,
  1021. dialogDrag: true,
  1022. addBtn: false,
  1023. span: 8,
  1024. height: 600,
  1025. addRowBtn: false,
  1026. editBtn: false,
  1027. delBtn: false,
  1028. menuWidth: 140,
  1029. dialogTop: 25,
  1030. dialogWidth: "80%",
  1031. column: [{
  1032. label: '支付编号',
  1033. prop: 'serialNumber',
  1034. overHidden: true,
  1035. }, {
  1036. label: '金额',
  1037. prop: 'amount',
  1038. overHidden: true,
  1039. }, {
  1040. label: '类型',
  1041. prop: 'type',
  1042. overHidden: true,
  1043. }, {
  1044. label: '支付时间',
  1045. prop: 'createTime',
  1046. overHidden: true,
  1047. }]
  1048. },
  1049. optionOutboundRecords: {},
  1050. optionOutboundRecordsBack: {
  1051. align: 'center',
  1052. index: true,
  1053. menu: false,
  1054. addBtnText: "录入明细",
  1055. refreshBtn: false,
  1056. dialogDrag: true,
  1057. addBtn: false,
  1058. span: 8,
  1059. height: 600,
  1060. addRowBtn: false,
  1061. editBtn: false,
  1062. delBtn: false,
  1063. // menuWidth: 140,
  1064. dialogTop: 25,
  1065. dialogWidth: "80%",
  1066. column: [{
  1067. label: '商品名称',
  1068. prop: 'goodsName',
  1069. overHidden: true,
  1070. },
  1071. // {
  1072. // label: '来源单号',
  1073. // prop: 'ordNo'
  1074. // },
  1075. {
  1076. label: '商品数量',
  1077. prop: 'goodsNum',
  1078. overHidden: true,
  1079. }, {
  1080. label: '单价',
  1081. prop: 'price',
  1082. overHidden: true,
  1083. }, {
  1084. label: '小计',
  1085. prop: 'subTotalMoney',
  1086. overHidden: true,
  1087. }, {
  1088. label: '共享公司',
  1089. prop: 'sharedCompanyName',
  1090. overHidden: true,
  1091. }, {
  1092. label: '状态',
  1093. prop: 'sharedStatus',
  1094. overHidden: true,
  1095. }]
  1096. }
  1097. }
  1098. },
  1099. components: { SearchQuery, reportDialog, check, checkSchedule, dicSelect },
  1100. props: {
  1101. detailData: Object
  1102. },
  1103. async created() {
  1104. this.optionContacts = await this.getColumnData(this.getColumnName(434), this.optionContactsBack);
  1105. this.optionPaymentDetails = await this.getColumnData(this.getColumnName(269.2), this.optionPaymentDetailsBack);
  1106. this.optionOutboundRecords = await this.getColumnData(this.getColumnName(435), this.optionOutboundRecordsBack);
  1107. this.key++
  1108. if (this.detailData.id) {
  1109. this.editButton = true
  1110. this.optionForm.disabled = true
  1111. this.getDetail(this.detailData.id, true)
  1112. }
  1113. },
  1114. methods: {
  1115. confirmEditing() {
  1116. this.editButton = false
  1117. if (this.form.status != '已发货') {
  1118. if (this.form.businessSource == '外部销售') {
  1119. this.optionForm.disabled = false
  1120. this.optionForm.column.forEach(item => {
  1121. if (item.prop == 'shipType' || item.prop == 'logisticsCorpName' || item.prop == 'expressNo' || item.prop == 'remarks') {
  1122. item.disabled = false
  1123. } else {
  1124. item.disabled = true
  1125. }
  1126. })
  1127. }
  1128. if (this.form.businessSource == '内部销售') {
  1129. this.optionForm.disabled = false
  1130. }
  1131. }
  1132. },
  1133. outGoodsChange(row) {
  1134. if (Number(row.outGoodsTotalShipNum) > Number(Number(row.goodsNum) - Number(row.sendNum))) {
  1135. this.$set(row, 'outGoodsTotalShipNum', null)
  1136. return this.$message.error("派发数量不能超过" + (Number(row.goodsNum) - Number(row.sendNum)));
  1137. }
  1138. },
  1139. dicChange(name, row) {
  1140. if (name == 'customerName') {
  1141. if (row) {
  1142. this.$set(this.form, 'customerId', row.id)
  1143. getCustom({ id: row.id }).then(res => {
  1144. if (res.data.data) {
  1145. this.dicUrlWithCustomId = res.data.data.id ? res.data.data.id : ''
  1146. this.form.storageId = res.data.data.deliveryWarehouseId
  1147. this.form.storageName = res.data.data.deliveryWarehouseName
  1148. this.form.contacts = res.data.data.corpsAttnList[0].cname
  1149. this.form.phone = res.data.data.corpsAttnList[0].tel
  1150. this.contactsOption = res.data.data.corpsAddrList
  1151. this.form.recAddress = res.data.data.corpsAddrList[0].belongtoarea + res.data.data.corpsAddrList[0].detailedAddress
  1152. this.form.salerId = res.data.data.salesmanId
  1153. this.form.salerName = res.data.data.salesmanName
  1154. }
  1155. })
  1156. } else {
  1157. this.form.customerId = ''
  1158. this.form.customerName = ''
  1159. this.dicUrlWithCustomId = ''
  1160. this.form.storageId = ''
  1161. this.form.contacts = ''
  1162. this.form.phone = ''
  1163. this.contactsOption = ''
  1164. this.form.recAddress = ''
  1165. this.form.salerId = ''
  1166. this.form.salerName = ''
  1167. this.form.storageName = ''
  1168. }
  1169. }
  1170. if (name == 'sharedCompany') {
  1171. if (row) {
  1172. this.form.sharedCompanyId = row.id
  1173. this.form.sharedCompanyName = row.deptName
  1174. } else {
  1175. this.form.sharedCompanyId = null
  1176. this.form.sharedCompanyName = null
  1177. }
  1178. }
  1179. },
  1180. confirm(type) {
  1181. if (type == 1) {
  1182. for (let item of this.form.orderItemsList) {
  1183. if (item.sendNum != item.goodsNum) {
  1184. return this.$message.error("第" + Number(item.$index + 1) + "行明细未发货,请先发货");
  1185. }
  1186. }
  1187. this.$confirm('是否确认发货?', '提示', {
  1188. confirmButtonText: '确定',
  1189. cancelButtonText: '取消',
  1190. type: 'warning'
  1191. }).then(() => {
  1192. const loading = this.$loading({
  1193. lock: true,
  1194. text: '加载中',
  1195. spinner: 'el-icon-loading',
  1196. background: 'rgba(255,255,255,0.7)'
  1197. });
  1198. confirmShipment(this.form).then(res => {
  1199. this.$message.success("操作成功");
  1200. this.getDetail(this.form.id)
  1201. }).finally(() => {
  1202. loading.close();
  1203. });
  1204. })
  1205. }
  1206. if (type == 2) {
  1207. this.$confirm('是否撤销发货?', '提示', {
  1208. confirmButtonText: '确定',
  1209. cancelButtonText: '取消',
  1210. type: 'warning'
  1211. }).then(() => {
  1212. const loading = this.$loading({
  1213. lock: true,
  1214. text: '加载中',
  1215. spinner: 'el-icon-loading',
  1216. background: 'rgba(255,255,255,0.7)'
  1217. });
  1218. revokeShipment(this.form).then(res => {
  1219. this.$message.success("操作成功");
  1220. this.getDetail(this.form.id)
  1221. }).finally(() => {
  1222. loading.close();
  1223. });
  1224. })
  1225. }
  1226. },
  1227. allClick(name) {
  1228. if (name == '派发销售单') {
  1229. for (let item of this.selectionMultilist) {
  1230. if (!item.id) {
  1231. return this.$message.error("请保存数据");
  1232. }
  1233. if (item.sendNum == item.goodsNum) {
  1234. return this.$message.error("明细存在已派发完的数据,请重新选择");
  1235. }
  1236. }
  1237. this.sharedCompany = null
  1238. this.selectionMultilist.forEach(e => {
  1239. e.outGoodsTotalShipNum = 0
  1240. })
  1241. this.distributeVisible = true
  1242. }
  1243. if (name == '撤销派发') {
  1244. let ids = []
  1245. for (let item of this.selectionMultilist) {
  1246. if (item.sendNum == 0) {
  1247. return this.$message.error("请正确选择明细");
  1248. }
  1249. ids.push(item.id)
  1250. }
  1251. this.$confirm('是否撤销派发?', '提示', {
  1252. confirmButtonText: '确定',
  1253. cancelButtonText: '取消',
  1254. type: 'warning'
  1255. }).then(() => {
  1256. const loading = this.$loading({
  1257. lock: true,
  1258. text: '加载中',
  1259. spinner: 'el-icon-loading',
  1260. background: 'rgba(255,255,255,0.7)'
  1261. });
  1262. revokeDistributeShareSales({ itemIds: ids.join(',') }).then(res => {
  1263. this.$message.success("操作成功");
  1264. this.getDetail(this.form.id)
  1265. }).finally(() => {
  1266. loading.close();
  1267. });
  1268. })
  1269. }
  1270. },
  1271. // 数量失焦触发
  1272. goodsNumblurfun(row) {
  1273. if (Number(row.goodsNum) > Number(row.inventory)) {
  1274. this.$set(row, 'goodsNum', null)
  1275. return this.$message.warning("不能大于库存数量");
  1276. }
  1277. },
  1278. inventoryShow(row) {
  1279. this.inventoryList = []
  1280. const loading = this.$loading({
  1281. lock: true,
  1282. text: '加载中',
  1283. spinner: 'el-icon-loading',
  1284. background: 'rgba(255,255,255,0.7)'
  1285. });
  1286. listAllByGoodsId({ goodsCode: row.goodsNo }).then(res => {
  1287. this.inventoryList = res.data.data
  1288. }).finally(() => {
  1289. loading.close();
  1290. });
  1291. },
  1292. inventoryShow2() {
  1293. this.inventoryList = []
  1294. const loading = this.$loading({
  1295. lock: true,
  1296. text: '加载中',
  1297. spinner: 'el-icon-loading',
  1298. background: 'rgba(255,255,255,0.7)'
  1299. });
  1300. listAllByGoodsId({ goodsCode: this.selectionMultilist[0].goodsNo }).then(res => {
  1301. this.inventoryList = res.data.data
  1302. }).finally(() => {
  1303. loading.close();
  1304. });
  1305. },
  1306. inDistribute() {
  1307. if (!this.sharedCompany) {
  1308. return this.$message.error("请选择共享公司");
  1309. }
  1310. for (let item of this.selectionMultilist) {
  1311. if (item.outGoodsTotalShipNum == 0) {
  1312. return this.$message.error("请输入派件数量");
  1313. }
  1314. }
  1315. let obj = {}
  1316. obj = {
  1317. ...this.form,
  1318. orderItemsList: this.selectionMultilist
  1319. }
  1320. const loading = this.$loading({
  1321. lock: true,
  1322. text: '加载中',
  1323. spinner: 'el-icon-loading',
  1324. background: 'rgba(255,255,255,0.7)'
  1325. });
  1326. distributeShareSales(obj).then(res => {
  1327. this.$message.success("操作成功")
  1328. this.distributeVisible = false
  1329. this.getDetail(this.form.id)
  1330. }).finally(() => {
  1331. loading.close();
  1332. });
  1333. },
  1334. uploadAfter(res, done, loading, column) {
  1335. if (Array.isArray(res)) {
  1336. if (res instanceof Array) {
  1337. this.form.orderItemsList = this.form.orderItemsList.concat(res)
  1338. res.forEach(item => {
  1339. dotList({
  1340. storageId: this.form.storageId,
  1341. goodsId: res.goodsId
  1342. }).then(e => {
  1343. this.findObject(this.optionContactsBack.column, "dot").dicData = e.data.data
  1344. })
  1345. })
  1346. }
  1347. } else {
  1348. this.$message.error(res)
  1349. }
  1350. this.excelBox = false;
  1351. loading = false;
  1352. done(res);
  1353. },
  1354. derivation() {
  1355. window.open(
  1356. `${this.templateUrl}?${this.website.tokenHeader
  1357. }=${getToken()}&stockId=${this.form.storageId}`
  1358. );
  1359. },
  1360. uploadBefore(file, done, loading) {
  1361. done();
  1362. loading = true;
  1363. },
  1364. // 销售明细 导入按钮
  1365. excelDialogfun(name) {
  1366. if (!this.form.customerId) {
  1367. this.$message.error('请选择客户')
  1368. return
  1369. }
  1370. if (name == '名称') {
  1371. this.findObject(this.excelOption.column, "excelFile").action = '/api/blade-sales-part/order/import-item-name'
  1372. this.templateUrl = '/api/blade-sales-part/order/export-item-name'
  1373. } else if (name == 'code') {
  1374. this.findObject(this.excelOption.column, "excelFile").action = '/api/blade-sales-part/order/import-item-code'
  1375. this.templateUrl = '/api/blade-sales-part/order/export-item-code'
  1376. }
  1377. this.excelBox = true
  1378. },
  1379. //生成退货单
  1380. getReturns() {
  1381. this.$confirm("您确定要退货吗?", {
  1382. confirmButtonText: "确定",
  1383. cancelButtonText: "取消",
  1384. type: "warning"
  1385. }).then(() => {
  1386. this.$router.push({
  1387. path: "/tirePartsMall/salesService/returns/index",
  1388. query: {
  1389. bsType: 'TKGX',
  1390. id: this.form.id,
  1391. }
  1392. });
  1393. })
  1394. },
  1395. // 获取左侧筛选
  1396. getAllWorkDicts() {
  1397. getCorpTypes({ whetherIntegral: '0' }).then(res => {
  1398. this.treeDataGoods = res.data.data;
  1399. });
  1400. },
  1401. //导入页左商品类型查询
  1402. nodeClick(data) {
  1403. this.treeDeptId = data.id;
  1404. this.page.currentPage = 1;
  1405. this.onLoad(this.page, { ...this.SelectSearch, goodsTypeId: this.treeDeptId });
  1406. },
  1407. closeGoods() {
  1408. this.treeDataGoods = [];
  1409. this.treeDeptId = "";
  1410. this.activeNameTabs = "searchList";
  1411. },
  1412. //刷新触发
  1413. refreshChange() {
  1414. this.page.currentPage = 1;
  1415. this.onLoad(this.page);
  1416. },
  1417. // 点击搜索触发
  1418. goodsSearch(params, done) {
  1419. this.page.currentPage = 1;
  1420. params = {
  1421. ...params,
  1422. }
  1423. this.onLoad(this.page, params);
  1424. done()
  1425. },
  1426. rowCell(row) {
  1427. this.$set(row, "$cellEdit", true);
  1428. },
  1429. rowSave(row) {
  1430. this.$set(row, "$cellEdit", false);
  1431. },
  1432. // 标签页切换
  1433. tabHandle(data) {
  1434. if (data.name == 'searchList') {
  1435. this.goodsListShow = this.data;
  1436. this.page.total = this.pageList.total
  1437. } else if (data.name == 'importStaging') {
  1438. this.goodsListShow = this.goodsListSave;
  1439. this.page.total = 0
  1440. }
  1441. },
  1442. // 商品信息价格计算
  1443. amountChange(value, row) {
  1444. if (value > row.inventory) {
  1445. this.$set(row, 'goodsNum', null)
  1446. return this.$message.error("数量不能超过库存数量");
  1447. }
  1448. },
  1449. importStagList(row, index, type) {
  1450. this.goodsListSave.push(row);
  1451. },
  1452. removeStagList(row, index, type) {
  1453. this.goodsListSave.splice(row.$index, 1)
  1454. },
  1455. //确认导入触发
  1456. importGoods() {
  1457. if (this.goodsListSave.length == 0) {
  1458. return this.$message.error("请选择");
  1459. }
  1460. this.goodsListSave.forEach(item => {
  1461. item.goodsNo = item.goodsCode
  1462. item.propertyName = item.specificationAndModel
  1463. item.pattern = item.brandItem
  1464. item.costpriePrice = item.shareCost
  1465. item.rebatePrice = item.costpriePrice
  1466. item.subTotalMoney = Number(item.goodsNum * item.price) ? Number(item.goodsNum * item.price).toFixed(2) : 0,
  1467. delete item.id
  1468. this.form.orderItemsList.push(item)
  1469. })
  1470. this.dialogVisible = false
  1471. },
  1472. //导入商品弹窗列表查询
  1473. onLoad(page, params = {}) {
  1474. this.loading = true;
  1475. goodsPageXs({
  1476. current: page.currentPage,
  1477. size: page.pageSize,
  1478. ...Object.assign(params, this.SelectSearch)
  1479. }).then(res => {
  1480. res.data.data.records.forEach(e => {
  1481. e.price = e.priceOne
  1482. e.goodsNum = 0
  1483. })
  1484. this.goodsListShow = res.data.data.records
  1485. this.page.total = res.data.data.total;
  1486. this.data = res.data.data.records
  1487. this.pageList.total = res.data.data.total;
  1488. this.loading = false;
  1489. })
  1490. },
  1491. //修改提交触发
  1492. editCustomer() {
  1493. this.$refs["form"].validate((valid, done) => {
  1494. done();
  1495. let picihao = false
  1496. if (valid) {
  1497. const loading = this.$loading({
  1498. lock: true,
  1499. text: '加载中',
  1500. spinner: 'el-icon-loading',
  1501. background: 'rgba(255,255,255,0.7)'
  1502. });
  1503. submit({
  1504. bsType: "GX",
  1505. ...this.form
  1506. }).then(res => {
  1507. this.getDetail(res.data.data.id)
  1508. this.$message.success("保存成功");
  1509. }).finally(() => {
  1510. loading.close();
  1511. });
  1512. } else {
  1513. return false;
  1514. }
  1515. });
  1516. },
  1517. getDetail(id, type) {
  1518. const loading = this.$loading({
  1519. lock: true,
  1520. text: '加载中',
  1521. spinner: 'el-icon-loading',
  1522. background: 'rgba(255,255,255,0.7)'
  1523. })
  1524. getDetails({ id: id }).then(res => {
  1525. this.form = res.data.data
  1526. if (res.data.data.status == '已发货') {
  1527. this.optionForm.disabled = true
  1528. }
  1529. }).finally(() => {
  1530. loading.close();
  1531. })
  1532. },
  1533. rowDelBox(row, index, type) {
  1534. this.$confirm("确定将选择数据删除?", {
  1535. confirmButtonText: "确定",
  1536. cancelButtonText: "取消",
  1537. type: "warning"
  1538. }).then(() => {
  1539. if (row.id) {
  1540. delOrderItem({ ids: row.id }).then(res => {
  1541. this.form.orderItemsList.splice(index, 1);
  1542. this.$message.success("操作成功!");
  1543. });
  1544. } else {
  1545. this.form[type].splice(index, 1);
  1546. this.$message.success("操作成功!");
  1547. }
  1548. }
  1549. );
  1550. },
  1551. // 明细信息多选
  1552. selectionChange(list) {
  1553. this.selectionMultilist = list
  1554. },
  1555. // 一键删除
  1556. batchDelete() {
  1557. if (this.selectionMultilist.length == 0) {
  1558. return this.$message.warning('请选择要删除的数据')
  1559. }
  1560. for (let item of this.selectionMultilist) {
  1561. if (item.sendNum != 0) {
  1562. return this.$message.error("已派发,不能删除");
  1563. }
  1564. }
  1565. this.$confirm("确定将选择数据删除?", {
  1566. confirmButtonText: "确定",
  1567. cancelButtonText: "取消",
  1568. type: "warning"
  1569. }).then(() => {
  1570. let multiList = this.selectionMultilist
  1571. let arr = this.form.orderItemsList
  1572. // 获取有id 的数据
  1573. const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
  1574. let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
  1575. // 把选中的删除掉
  1576. multiList.forEach((item) => {
  1577. for (let index in arr) {
  1578. if (JSON.stringify(item) == JSON.stringify(arr[index])) {
  1579. arr.splice(Number(index), 1)
  1580. }
  1581. }
  1582. })
  1583. // 有id 的处理
  1584. if (itemsWithId.length != 0) {
  1585. delOrderItem({ ids: arrIds.join(',') }).then(res => {
  1586. this.$message.success("操作成功!");
  1587. });
  1588. }
  1589. })
  1590. },
  1591. // 新增商品
  1592. rowAdd(row, type) {
  1593. if (!this.form.customerId) {
  1594. this.$message.error('请选择客户')
  1595. return
  1596. }
  1597. this.findObject(this.optionContactsBack.column, 'goodsId').dicUrl = `/api/blade-sales-part/goodsDesc/goodsListXs?cname={{key}}&customId=${this.dicUrlWithCustomId}&enableOrNot=1&stock=${this.form.storageId}`
  1598. this.optionContactsBack.column.forEach(its => {
  1599. if (its.prop == 'goodsId' || its.prop == 'goodsNum' || its.prop == 'price' || its.prop == 'dot' || its.prop == 'remarks') {
  1600. its.disabled = false
  1601. } else {
  1602. its.disabled = true
  1603. }
  1604. })
  1605. this.getAllWorkDicts()
  1606. this.goodsListSave = []
  1607. setTimeout(res => {
  1608. this.refreshChange()
  1609. this.dialogVisible = true
  1610. }, 300)
  1611. // this.$refs.formContacts.rowAdd()
  1612. },
  1613. //打印
  1614. handlePrint() {
  1615. this.switchDialog = !this.switchDialog;
  1616. },
  1617. onClose(val) {
  1618. this.switchDialog = val;
  1619. },
  1620. //自定义列保存
  1621. async saveColumnTwo(ref, option, optionBack, code) {
  1622. /**
  1623. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  1624. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  1625. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  1626. */
  1627. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  1628. isProcurement({ "param": "whether.model" }).then(res => {
  1629. if (res.data.data == 1) {
  1630. this.findObject(this.optionContacts.column, "pattern").label = '规格型号1'
  1631. this.findObject(this.optionContacts.column, "rebatePrice").hide = true
  1632. this.findObject(this.optionContacts.column, "rebateCostprie").hide = true
  1633. this.findObject(this.optionContacts.column, "rebateProfit").hide = true
  1634. this.findObject(this.optionContacts.column, "rebatePrice").showColumn = true
  1635. this.findObject(this.optionContacts.column, "rebateCostprie").showColumn = true
  1636. this.findObject(this.optionContacts.column, "rebateProfit").showColumn = true
  1637. }
  1638. })
  1639. if (inSave) {
  1640. this.$message.success("保存成功");
  1641. //关闭窗口
  1642. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1643. }
  1644. },
  1645. //自定义列重置
  1646. async resetColumnTwo(ref, option, optionBack, code) {
  1647. this[option] = this[optionBack];
  1648. isProcurement({ "param": "whether.model" }).then(res => {
  1649. if (res.data.data == 1) {
  1650. this.findObject(this.optionContacts.column, "pattern").label = '规格型号1'
  1651. this.findObject(this.optionContacts.column, "rebatePrice").hide = true
  1652. this.findObject(this.optionContacts.column, "rebateCostprie").hide = true
  1653. this.findObject(this.optionContacts.column, "rebateProfit").hide = true
  1654. this.findObject(this.optionContacts.column, "rebatePrice").showColumn = true
  1655. this.findObject(this.optionContacts.column, "rebateCostprie").showColumn = true
  1656. this.findObject(this.optionContacts.column, "rebateProfit").showColumn = true
  1657. }
  1658. })
  1659. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  1660. if (inSave) {
  1661. this.$message.success("重置成功");
  1662. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1663. }
  1664. },
  1665. goBack(type) {
  1666. this.$emit("goBack", type);
  1667. },
  1668. // 弹框的重置
  1669. resetCrud() {
  1670. this.$message.success("重置成功");
  1671. },
  1672. // 弹窗的保存
  1673. saveCrud() {
  1674. this.$message.success("保存成功");
  1675. }
  1676. }
  1677. }
  1678. </script>
  1679. <style lang="scss" scoped>
  1680. ::v-deep .el-form-item {
  1681. margin-bottom: 8px !important;
  1682. }
  1683. </style>