home_form.vue 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224
  1. <template>
  2. <div class="detail-container">
  3. <el-page-header @back="goBack" :content="listItem ? '编辑':'新增'"></el-page-header>
  4. <div class="main-title">
  5. <div class="title">工程订单</div>
  6. </div>
  7. <el-form ref="mainForm" :model="mainForm" :rules="mainFormRules" label-width="110px" size="small" label-position="right">
  8. <el-row :gutter="20">
  9. <el-col :xs="24" :sm="12" :lg="8">
  10. <el-form-item label="工程订单" prop="orderNum">
  11. <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" disabled></el-input>
  12. </el-form-item>
  13. </el-col>
  14. <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
  15. <el-form-item label="单据日期" prop="orderDate">
  16. <el-date-picker
  17. v-model="mainForm.orderDate"
  18. disabled
  19. type="date"
  20. value-format="yyyy-MM-dd"
  21. style="width: 100%;"
  22. placeholder="系统自动生成">
  23. </el-date-picker>
  24. </el-form-item>
  25. </el-col>
  26. <!-- <el-col :xs="24" :sm="12" :lg="8">
  27. <el-form-item label="产品大类" prop="type">
  28. <el-input v-model="mainForm.type" disabled v-if="listItem"></el-input>
  29. <el-select v-model="mainForm.type" placeholder="选择产品大类" style="width: 100%" disabled v-else>
  30. <el-option v-for="item in typeList" :key="item.dictCode" :label="item.dictValue" :value="item.dictCode"></el-option>
  31. </el-select>
  32. </el-form-item>
  33. </el-col> -->
  34. <el-col :xs="24" :sm="12" :lg="8">
  35. <el-form-item label="销售类型" prop="saleType">
  36. <el-select v-model="mainForm.saleType" placeholder="选择销售类型" style="width: 100%" clearable @change="changeSaleType">
  37. <el-option v-for="item in salesTypeList" :key="item.id" :label="item.saleName" :value="item.id"></el-option>
  38. </el-select>
  39. </el-form-item>
  40. </el-col>
  41. <el-col :xs="24" :sm="12" :lg="8">
  42. <el-form-item label="经销商编码" prop="jxsNum">
  43. <el-input v-model="mainForm.jxsNum" placeholder="请输入经销商编码" disabled></el-input>
  44. </el-form-item>
  45. </el-col>
  46. <el-col :xs="24" :sm="12" :lg="16">
  47. <el-form-item label="经销商名称" prop="jxsName">
  48. <el-input v-model="mainForm.jxsName" placeholder="请输入经销商名称" disabled></el-input>
  49. </el-form-item>
  50. </el-col>
  51. <el-col :xs="24" :sm="12" :lg="8">
  52. <el-form-item label="工程登录编号" prop="loginNum">
  53. <div style="display: flex;">
  54. <el-input v-model="mainForm.loginNum" placeholder="请引用工程登录" disabled></el-input>
  55. <el-button style="margin-left: 10px;" @click="openShareDetail">引用</el-button>
  56. </div>
  57. </el-form-item>
  58. </el-col>
  59. <el-col :xs="24" :sm="12" :lg="8">
  60. <el-form-item label="项目类别" prop="enginName">
  61. <el-input v-model="mainForm.enginName" placeholder="请输入项目类别" :disabled="isDealer"></el-input>
  62. </el-form-item>
  63. </el-col>
  64. <el-col :xs="24" :sm="12" :lg="8">
  65. <el-form-item label="行业类别" prop="loginType">
  66. <el-input v-model="mainForm.loginType" placeholder="请输入行业类别" :disabled="isDealer"></el-input>
  67. </el-form-item>
  68. </el-col>
  69. <el-col :xs="24" :sm="12" :lg="8">
  70. <el-form-item label="跨区厂编号" prop="factoryNum">
  71. <el-input v-model="mainForm.factoryNum" placeholder="请输入跨区厂编号"></el-input>
  72. </el-form-item>
  73. </el-col>
  74. <el-col :xs="24" :sm="12" :lg="8">
  75. <el-form-item label="使用单位" prop="company">
  76. <el-input v-model="mainForm.company" placeholder="请输入使用单位" :disabled="isDealer"></el-input>
  77. </el-form-item>
  78. </el-col>
  79. <el-col :xs="24" :sm="12" :lg="8">
  80. <el-form-item label="业务员" prop="salesMan">
  81. <el-select v-model="mainForm.salesMan" placeholder="选择业务员" size="small" filterable clearable style="width: 100%">
  82. <el-option
  83. v-for="item in salesmanList"
  84. :key="item.adminUserId"
  85. :label="item.nickName"
  86. :value="item.adminUserId">
  87. </el-option>
  88. </el-select>
  89. </el-form-item>
  90. </el-col>
  91. <el-col :xs="24" :sm="12" :lg="8">
  92. <el-form-item label="联系人" prop="contactMan">
  93. <el-input v-model="mainForm.contactMan" placeholder="请输入联系人" :disabled="isDealer"></el-input>
  94. </el-form-item>
  95. </el-col>
  96. <el-col :xs="24" :sm="12" :lg="8">
  97. <el-form-item label="固定电话" prop="tel">
  98. <el-input v-model="mainForm.tel" placeholder="请输入固定电话" :disabled="isDealer"></el-input>
  99. </el-form-item>
  100. </el-col>
  101. <el-col :xs="24" :sm="12" :lg="8">
  102. <el-form-item label="移动电话" prop="phone">
  103. <el-input v-model="mainForm.phone" placeholder="请输入移动电话" :disabled="isDealer"></el-input>
  104. </el-form-item>
  105. </el-col>
  106. <el-col :xs="24" :sm="12" :lg="16">
  107. <el-form-item label="安装地址" prop="address">
  108. <el-input v-model="mainForm.address" placeholder="请输入安装地址" :disabled="isDealer"></el-input>
  109. </el-form-item>
  110. </el-col>
  111. <el-col :xs="24" :sm="12" :lg="8">
  112. <el-form-item label="第几次申报" prop="declareNo">
  113. <el-input v-model="mainForm.declareNo" placeholder="请输入第几次申报"></el-input>
  114. </el-form-item>
  115. </el-col>
  116. <el-col :xs="24" :sm="12" :lg="16">
  117. <el-form-item label="项目说明" prop="projectRemark">
  118. <el-input v-model="mainForm.projectRemark" placeholder="请输入项目说明"></el-input>
  119. </el-form-item>
  120. </el-col>
  121. <el-col :xs="24" :sm="12" :lg="8">
  122. <el-form-item label="项目类型" prop="projectType">
  123. <el-input v-model="mainForm.projectType" placeholder="请输入项目类型"></el-input>
  124. </el-form-item>
  125. </el-col>
  126. <el-col :xs="24" :sm="24" :lg="24" v-if="!isDealer">
  127. <el-form-item label="格力内部备注" prop="greeRemark">
  128. <el-input v-model="mainForm.greeRemark" placeholder="请输入格力内部备注"></el-input>
  129. </el-form-item>
  130. </el-col>
  131. <!-- <el-col :xs="24" :sm="24" :lg="24">
  132. <el-form-item label="格力回复" prop="greeReply">
  133. <el-input v-model="mainForm.greeReply" placeholder="请输入格力回复"></el-input>
  134. </el-form-item>
  135. </el-col> -->
  136. <el-col :xs="24" :sm="24" :lg="24">
  137. <el-form-item label="备注" prop="remark">
  138. <el-input v-model="mainForm.remark" placeholder="请输入备注"></el-input>
  139. </el-form-item>
  140. </el-col>
  141. <el-col :xs="24" :sm="12" :lg="8">
  142. <el-form-item label="制单人" prop="createMan">
  143. <el-input v-model="mainForm.createMan" placeholder="请输入制单人" disabled></el-input>
  144. </el-form-item>
  145. </el-col>
  146. <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
  147. <el-form-item label="制单日期" prop="createDate">
  148. <el-date-picker
  149. v-model="mainForm.createDate"
  150. disabled
  151. type="date"
  152. value-format="yyyy-MM-dd"
  153. style="width: 100%;"
  154. placeholder="选择日期">
  155. </el-date-picker>
  156. </el-form-item>
  157. </el-col>
  158. <el-col :xs="24" :sm="12" :lg="8">
  159. <el-form-item label="文件编号" prop="fileNum">
  160. <el-input v-model="mainForm.fileNum" placeholder="请输入文件编号"></el-input>
  161. </el-form-item>
  162. </el-col>
  163. <el-col :xs="24" :sm="24" :lg="24" v-if="mainForm.examineRemark">
  164. <el-form-item label="审批说明" prop="examineRemark">
  165. <el-input v-model="mainForm.examineRemark" placeholder="请输入审批说明" disabled></el-input>
  166. </el-form-item>
  167. </el-col>
  168. </el-row>
  169. </el-form>
  170. <div class="main-title">
  171. <div class="title">货品信息</div>
  172. <div>
  173. <el-select v-model="warehouseValue" placeholder="请选择发货仓库" size="small" style="margin-right: 10px">
  174. <el-option :label="item.name" :value="item.id" v-for="(item, index) in warehouseList" :key="index"></el-option>
  175. </el-select>
  176. <el-button type="primary" size="small" icon="el-icon-search" @click="checkStock">检查库存</el-button>
  177. <el-divider direction="vertical"></el-divider>
  178. <el-button type="primary" size="small" icon="el-icon-plus" @click="openDialog">添加货品</el-button>
  179. </div>
  180. </div>
  181. <div class="table" style="margin-top: 20px">
  182. <el-table :data="goodsList" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
  183. <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
  184. <el-table-column align="center" label="引用记录" prop="useRefCount" min-width="160" show-overflow-tooltip></el-table-column>
  185. <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="120" show-overflow-tooltip></el-table-column>
  186. <el-table-column align="center" label="物料编码" prop="materialNumber" min-width="120" show-overflow-tooltip></el-table-column>
  187. <el-table-column align="center" label="产品编码" prop="materialOldNumber" min-width="120" show-overflow-tooltip></el-table-column>
  188. <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
  189. <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip>
  190. <template slot-scope="scope">
  191. <el-input v-model="scope.row.specification" size="small" v-if="listItem"></el-input>
  192. <div v-else>{{scope.row.specification}}</div>
  193. </template>
  194. </el-table-column>
  195. <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  196. <el-table-column align="center" label="单价" prop="price" min-width="100" show-overflow-tooltip>
  197. <template slot-scope="scope">
  198. <el-input v-model="scope.row.price" size="small" type="number"></el-input>
  199. </template>
  200. </el-table-column>
  201. <el-table-column align="center" label="工程登录数量" prop="enginNum" min-width="120" show-overflow-tooltip></el-table-column>
  202. <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip>
  203. <template slot-scope="scope">
  204. <el-input v-model="scope.row.qty" size="small" type="number"></el-input>
  205. </template>
  206. </el-table-column>
  207. <el-table-column align="center" label="订单金额" min-width="100" show-overflow-tooltip>
  208. <template slot-scope="scope">
  209. {{scope.row.price * scope.row.qty}}
  210. </template>
  211. </el-table-column>
  212. <el-table-column align="center" label="返利类型" prop="customerWalletId2" min-width="160" show-overflow-tooltip>
  213. <template slot-scope="scope">
  214. <el-select v-model="scope.row.customerWalletId2" placeholder="选择返利类型" size="small" clearable @change="changeFlWallet(scope.$index)">
  215. <el-option
  216. v-for="item in scope.row.rebateWallets"
  217. :key="item.customerWalletId"
  218. :label="item.customerWalletName"
  219. :value="item.customerWalletId">
  220. </el-option>
  221. </el-select>
  222. </template>
  223. </el-table-column>
  224. <el-table-column align="center" label="返利金额" min-width="100" show-overflow-tooltip>
  225. <template slot-scope="scope">
  226. {{(scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) / 100}}
  227. </template>
  228. </el-table-column>
  229. <el-table-column align="center" label="格力折扣" min-width="100" show-overflow-tooltip>
  230. <template slot-scope="scope">
  231. {{scope.row.qty * scope.row.discAmount}}
  232. </template>
  233. </el-table-column>
  234. <el-table-column align="center" label="现金钱包" prop="customerWalletId" min-width="160" show-overflow-tooltip>
  235. <template slot-scope="scope">
  236. <el-select v-model="scope.row.customerWalletId" placeholder="选择现金钱包" size="small" clearable @change="changeXjWallet(scope.$index)">
  237. <el-option
  238. v-for="item in scope.row.wallets"
  239. :key="item.customerWalletId"
  240. :label="item.customerWalletName"
  241. :value="item.customerWalletId">
  242. </el-option>
  243. </el-select>
  244. </template>
  245. </el-table-column>
  246. <el-table-column align="center" label="实付金额" prop="qty" min-width="100" show-overflow-tooltip>
  247. <template slot-scope="scope">
  248. {{((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}}
  249. </template>
  250. </el-table-column>
  251. <el-table-column align="center" label="是否直调" prop="isDirectTransfer" min-width="100">
  252. <template slot-scope="scope">
  253. <el-checkbox v-model="scope.row.isDirectTransfer"></el-checkbox>
  254. </template>
  255. </el-table-column>
  256. <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100"></el-table-column>
  257. <el-table-column align="center" label="已发货数量" prop="hasSendQty" min-width="100" show-overflow-tooltip></el-table-column>
  258. <el-table-column align="center" label="已退数量" prop="retiredQty" min-width="100" show-overflow-tooltip></el-table-column>
  259. <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip>
  260. <template slot-scope="scope">
  261. <el-input v-model="scope.row.remark" size="small"></el-input>
  262. </template>
  263. </el-table-column>
  264. <el-table-column align="center" label="税率" prop="tax" min-width="100" show-overflow-tooltip></el-table-column>
  265. <!-- <el-table-column align="center" label="总仓库" prop="status1" min-width="100" show-overflow-tooltip>
  266. <template slot-scope="scope">
  267. <div>{{ scope.row.status1 | status1Filter }}</div>
  268. </template>
  269. </el-table-column> -->
  270. <el-table-column align="center" label="仓库状态" prop="status2" min-width="100" show-overflow-tooltip>
  271. <template slot-scope="scope">
  272. <div>{{ status2Filter(scope.row) }}</div>
  273. </template>
  274. </el-table-column>
  275. <!-- <el-table-column align="center" label="业务员" prop="serviceId" min-width="160" show-overflow-tooltip>
  276. <template slot-scope="scope">
  277. <el-select v-model="scope.row.serviceId" placeholder="选择业务员" size="small" clearable disabled>
  278. <el-option
  279. v-for="item in salesmanList"
  280. :key="item.adminUserId"
  281. :label="item.nickName"
  282. :value="item.adminUserId">
  283. </el-option>
  284. </el-select>
  285. </template>
  286. </el-table-column> -->
  287. <el-table-column align="center" label="操作" width="100" fixed="right">
  288. <template slot-scope="scope">
  289. <el-button type="text" @click="deleteItem(scope.$index)">删除</el-button>
  290. </template>
  291. </el-table-column>
  292. </el-table>
  293. </div>
  294. <div class="page-footer">
  295. <div class="footer">
  296. <el-button type="primary" @click="clickSubmitForm(1)" :loading="formLoading">保 存</el-button>
  297. <el-button type="primary" @click="clickSubmitForm(2)" :loading="formLoading">提交审核</el-button>
  298. <el-popconfirm title="确定关闭吗?" @onConfirm="goBack" style="margin-left: 10px;">
  299. <el-button slot="reference">关 闭</el-button>
  300. </el-popconfirm>
  301. </div>
  302. </div>
  303. <!-- 工程登录列表 -->
  304. <el-dialog title="工程登录列表" :visible.sync="isShowDialog" width="70%" :close-on-click-modal="false">
  305. <el-form ref="screenForm" :model="screenForm" label-width="0" size="small" label-position="left">
  306. <el-row :gutter="20">
  307. <el-col :xs="24" :sm="12" :lg="6">
  308. <el-form-item prop="loginNum">
  309. <el-input v-model="screenForm.loginNum" placeholder="工程登录编号"></el-input>
  310. </el-form-item>
  311. </el-col>
  312. <el-col :xs="24" :sm="12" :lg="6">
  313. <el-form-item prop="enginName">
  314. <el-input v-model="screenForm.enginName" placeholder="工程项目"></el-input>
  315. </el-form-item>
  316. </el-col>
  317. <el-col :xs="24" :sm="12" :lg="6">
  318. <el-form-item prop="company">
  319. <el-input v-model="screenForm.company" placeholder="使用单位"></el-input>
  320. </el-form-item>
  321. </el-col>
  322. <el-col :xs="24" :sm="12" :lg="6" class="tr">
  323. <el-form-item label="">
  324. <el-button size="small" @click="resetScreenForm">清空</el-button>
  325. <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
  326. </el-form-item>
  327. </el-col>
  328. </el-row>
  329. </el-form>
  330. <div class="table" style="margin: 10px 0 20px;">
  331. <el-table
  332. v-loading="dialogTable_listLoading"
  333. :data="dialogTable_dataList"
  334. element-loading-text="Loading"
  335. tooltip-effect="dark"
  336. style="width: 100%"
  337. max-height="270">
  338. <el-table-column align="center" label="" width="100">
  339. <template slot-scope="scope">
  340. <el-button type="primary" size="small" @click="chooseItem(scope.row.recordNo, scope.row.userid)">选择</el-button>
  341. </template>
  342. </el-table-column>
  343. <el-table-column align="center" prop="checkTime" label="工程登录日期" show-overflow-tooltip></el-table-column>
  344. <el-table-column align="center" prop="recordNo" label="工程登录编号" show-overflow-tooltip></el-table-column>
  345. <el-table-column align="center" prop="projectName" label="工程项目" show-overflow-tooltip></el-table-column>
  346. <el-table-column align="center" prop="useUnit" label="使用单位" show-overflow-tooltip></el-table-column>
  347. <el-table-column align="center" prop="organizationName" label="经销商" show-overflow-tooltip></el-table-column>
  348. </el-table>
  349. </div>
  350. <div class="pagination clearfix">
  351. <div class="fr">
  352. <el-pagination
  353. @current-change="dialogTableCurrentChange"
  354. :current-page="dialogTable_currentPage"
  355. :page-size="dialogTable_pageSize"
  356. background
  357. layout="prev, pager, next"
  358. :total="dialogTable_listTotal">
  359. </el-pagination>
  360. </div>
  361. </div>
  362. <div slot="footer" class="dialog-footer">
  363. <el-button @click="isShowDialog = false">关 闭</el-button>
  364. </div>
  365. </el-dialog>
  366. <el-dialog title="添加产品" :visible.sync="isShowGoodsDialog" width="80%">
  367. <el-form ref="goodsScreenForm" :model="goodsScreenForm" size="small" label-position="left">
  368. <el-row :gutter="20">
  369. <el-col :xs="12" :sm="6" :lg="6">
  370. <el-form-item prop="proNum">
  371. <el-input v-model="goodsScreenForm.proNum" placeholder="请输入产品编码"></el-input>
  372. </el-form-item>
  373. </el-col>
  374. <el-col :xs="12" :sm="6" :lg="6">
  375. <el-form-item prop="proName">
  376. <el-input v-model="goodsScreenForm.proName" placeholder="请输入产品名称"></el-input>
  377. </el-form-item>
  378. </el-col>
  379. <el-col :xs="12" :sm="6" :lg="6">
  380. <el-form-item prop="proModel">
  381. <el-input v-model="goodsScreenForm.proModel" placeholder="请输入产品型号"></el-input>
  382. </el-form-item>
  383. </el-col>
  384. <el-col :xs="12" :sm="6" :lg="6">
  385. <el-form-item prop="price1" style="display: flex">
  386. <el-input v-model="goodsScreenForm.price1" placeholder="请输入价格" style="width: 46%"></el-input>
  387. <span> - </span>
  388. <el-input v-model="goodsScreenForm.price2" placeholder="请输入价格" style="width: 46%"></el-input>
  389. </el-form-item>
  390. </el-col>
  391. <el-col :xs="24" :sm="24" :lg="24" class="tr">
  392. <el-form-item label="">
  393. <el-button size="small" @click="resetGoodsScreenForm">清空</el-button>
  394. <el-button size="small" type="primary" @click="submitGoodsScreenForm">搜索</el-button>
  395. </el-form-item>
  396. </el-col>
  397. </el-row>
  398. </el-form>
  399. <div class="tables">
  400. <div class="table">
  401. <el-table :data="leftGoodsList" element-loading-text="Loading" border fit highlight-current-row stripe height="400" @selection-change="leftSelectionChange">
  402. <el-table-column align="center" type="selection" width="55" :selectable='checkboxSelect'></el-table-column>
  403. <el-table-column align="center" label="产品编码" prop="number" min-width="100" show-overflow-tooltip></el-table-column>
  404. <el-table-column align="center" label="产品名称" prop="name" min-width="160" show-overflow-tooltip></el-table-column>
  405. <el-table-column align="center" label="产品型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  406. <el-table-column align="center" label="产品价格" prop="batchPrice" min-width="80" show-overflow-tooltip></el-table-column>
  407. </el-table>
  408. <div class="pagination clearfix" style="margin-top: 10px">
  409. <div class="fr">
  410. <el-pagination
  411. @current-change="handleTableCurrentChange"
  412. :current-page="currentPage"
  413. :page-size="10"
  414. background
  415. layout="prev, pager, next"
  416. :total="listTotal">
  417. </el-pagination>
  418. </div>
  419. </div>
  420. </div>
  421. <div class="buttons">
  422. <el-button size="small" type="primary" @click="addAllGoods">全部添加</el-button>
  423. <el-button size="small" type="primary" @click="addGoods">添&emsp;加</el-button>
  424. <el-button size="small" type="danger" @click="deleteGoods">删&emsp;除</el-button>
  425. <el-button size="small" type="danger" @click="deleteAllGoods">全部删除</el-button>
  426. </div>
  427. <div class="table">
  428. <el-table :data="rightGoodsList" element-loading-text="Loading" border fit highlight-current-row stripe height="400" @selection-change="rightSelectionChange">
  429. <el-table-column align="center" type="selection" width="55"></el-table-column>
  430. <el-table-column align="center" label="产品编码" prop="number" min-width="100" show-overflow-tooltip></el-table-column>
  431. <el-table-column align="center" label="产品名称" prop="name" min-width="160" show-overflow-tooltip></el-table-column>
  432. <el-table-column align="center" label="产品型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  433. <el-table-column align="center" label="产品价格" prop="batchPrice" min-width="80" show-overflow-tooltip></el-table-column>
  434. </el-table>
  435. </div>
  436. </div>
  437. <span slot="footer" class="dialog-footer">
  438. <el-button @click="closeDialog">取 消</el-button>
  439. <el-button type="primary" @click="submitAddGoods">确 定</el-button>
  440. </span>
  441. </el-dialog>
  442. </div>
  443. </template>
  444. <script>
  445. import { getOrderDetail, getHomeLoginList, getHomeLoginDetail, getWarehouseList, addHome, editHome, submitHome, checkStock, getRetailProductList } from "@/api/supply/engin";
  446. import { getDictList, getTypeList, getSalesmanList } from '@/api/common'
  447. import { findElem } from '@/utils/util'
  448. let that
  449. export default {
  450. name: 'HomeForm',
  451. componentName: 'HomeForm',
  452. props: ['listItem'],
  453. filters: {
  454. status1Filter(val) {
  455. let STOCK_ORDER_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_START').dictValue;
  456. let STOCK_ORDER_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_END').dictValue;
  457. let STOCK_ORDER_HAVE_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_START').dictValue;
  458. let STOCK_ORDER_HAVE_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_END').dictValue;
  459. let STOCK_ORDER_ALL_NUM = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_ALL_NUM').dictValue;
  460. if (val === '' || val === null || val === undefined) return '未检查';
  461. else if (val <= 0) return '无货';
  462. else if (val > STOCK_ORDER_START && val <= STOCK_ORDER_END) return val;
  463. else if (val >= STOCK_ORDER_HAVE_START && val <= STOCK_ORDER_HAVE_END) return '有货';
  464. else if (val > STOCK_ORDER_ALL_NUM) return '充足';
  465. },
  466. },
  467. data() {
  468. return {
  469. editId: '',
  470. mainForm: {
  471. orderNum: '',
  472. orderDate: '',
  473. type: '',
  474. jxsNum: '',
  475. jxsName: '',
  476. loginNum: '',
  477. enginName: '',
  478. loginType: '',
  479. promiseStatus: '',
  480. factoryNum: '',
  481. company: '',
  482. saleType: '',
  483. contactMan: '',
  484. tel: '',
  485. phone: '',
  486. address: '',
  487. declareNo: '',
  488. greeRemark: '',
  489. greeReply: '',
  490. remark: '',
  491. createMan: '',
  492. createDate: '',
  493. fileNum: '',
  494. loginUserId: '',
  495. salesMan: '',
  496. projectRemark: '',
  497. projectType: '',
  498. examineRemark: '',
  499. },
  500. mainFormRules: {
  501. // orderDate: [{ required: true, message: '请选择单据日期', trigger: 'change' }],
  502. jxsNum: [{ required: true, message: '请输入经销商编码', trigger: 'blur' }],
  503. jxsName: [{ required: true, message: '请输入经销商名称', trigger: 'blur' }],
  504. loginNum: [{ required: true, message: '请输入工程登录编号', trigger: 'blur' }],
  505. // enginName: [{ required: true, message: '请输入项目类别', trigger: 'blur' }],
  506. // loginType: [{ required: true, message: '请输入行业类别', trigger: 'blur' }],
  507. company: [{ required: true, message: '请输入使用单位', trigger: 'blur' }],
  508. saleType: [{ required: true, message: '请选择销售类型', trigger: 'change' }],
  509. // contactMan: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
  510. // tel: [{ required: true, message: '请输入固定电话', trigger: 'blur' }],
  511. // phone: [{ required: true, message: '请输入移动电话', trigger: 'blur' }],
  512. address: [{ required: true, message: '请输入安装地址', trigger: 'blur' }],
  513. },
  514. salesTypeList: [],
  515. // typeList: [],
  516. stockList: [],
  517. goodsList: [],
  518. isShowDialog: false, // 工程登录列表 - 弹窗
  519. screenForm: {
  520. loginNum: '',
  521. enginName: '',
  522. company: '',
  523. },
  524. dialogTable_dataList: null, // 工程登录列表 - 列表数据
  525. dialogTable_listLoading: true, // 工程登录列表 - 列表加载loading
  526. dialogTable_currentPage: 1, // 工程登录列表 - 当前页码
  527. dialogTable_pageSize: 10, // 工程登录列表 - 每页数量
  528. dialogTable_listTotal: 0, // 工程登录列表 - 列表总数
  529. warehouseList: [],
  530. warehouseValue: '',
  531. isShowGoodsDialog: false,
  532. goodsScreenForm: {
  533. proNum: '',
  534. proName: '',
  535. proModel: '',
  536. price1: '',
  537. price2: '',
  538. },
  539. currentPage: 1,
  540. listTotal: 0,
  541. leftGoodsList: [],
  542. rightGoodsList: [],
  543. leftSelection: [],
  544. rightSelection: [],
  545. formLoading: false,
  546. isFirst: false,
  547. salesmanList: [],
  548. }
  549. },
  550. computed: {
  551. isDealer() {
  552. return JSON.parse(localStorage.getItem("supply_user")).isCustomer
  553. },
  554. outSalesmanList() {
  555. let list = [];
  556. if(this.goodsList && this.goodsList.length) {
  557. this.goodsList.forEach(item => {
  558. if(item.serviceId) {
  559. let hasItem = findElem(list, 'adminUserId', item.serviceId);
  560. if(hasItem < 0) {
  561. let obj = this.salesmanList.find(o => o.adminUserId == item.serviceId);
  562. if(obj) {
  563. list.push(obj);
  564. }
  565. }
  566. }
  567. })
  568. if(this.isFirst) {
  569. this.isFirst = false;
  570. }else {
  571. this.mainForm.salesMan = this.goodsList[0].serviceId;
  572. }
  573. }
  574. return list
  575. }
  576. },
  577. watch: {
  578. goodsList: {
  579. handler(newValue, oldValue) {
  580. if(this.goodsList && this.goodsList.length) {
  581. if(this.isFirst) {
  582. this.isFirst = false;
  583. }else {
  584. this.mainForm.salesMan = this.goodsList[0].serviceId;
  585. }
  586. }else {
  587. this.mainForm.salesMan = '';
  588. }
  589. },
  590. immediate: true,
  591. deep: true
  592. }
  593. },
  594. beforeCreate() {
  595. that = this;
  596. },
  597. async created() {
  598. await this.getSalesmanList();
  599. this.getDictList();
  600. this.getSalesTypeList();
  601. this.getWarehouseList();
  602. if(this.listItem) {
  603. this.isFirst = true;
  604. this.editId = this.listItem.parentId;
  605. this.getDetail();
  606. }else {
  607. this.mainForm.jxsNum = JSON.parse(localStorage.getItem("supply_user")).customerNumber;
  608. this.mainForm.jxsName = JSON.parse(localStorage.getItem("supply_user")).customerName;
  609. this.mainForm.createMan = JSON.parse(localStorage.getItem("supply_user")).nickName;
  610. this.mainForm.createDate = this.getDate();
  611. }
  612. },
  613. methods: {
  614. // 返回列表
  615. goBack() {
  616. this.$emit('backListFormDetail');
  617. },
  618. getDate() {
  619. var date = new Date();
  620. var seperator1 = "-";
  621. var year = date.getFullYear();
  622. var month = date.getMonth() + 1;
  623. var strDate = date.getDate();
  624. if (month >= 1 && month <= 9) {
  625. month = "0" + month;
  626. }
  627. if (strDate >= 0 && strDate <= 9) {
  628. strDate = "0" + strDate;
  629. }
  630. var currentdate = year + seperator1 + month + seperator1 + strDate;
  631. return currentdate;
  632. },
  633. // 获取产品大类列表
  634. getDictList() {
  635. // getDictList({sysDictEnum: 'PRODUCT_TYPE'}).then(res => {
  636. // this.typeList = res.data;
  637. // })
  638. getDictList({sysDictEnum: 'STOCK_ORDER'}).then(res => {
  639. this.stockList = res.data;
  640. })
  641. },
  642. // 获取销售类型列表
  643. getSalesTypeList() {
  644. getTypeList({
  645. pageNum: 1,
  646. pageSize: -1
  647. }).then((res) => {
  648. this.salesTypeList = res.data.records;
  649. })
  650. },
  651. // 获取仓库列表
  652. getWarehouseList() {
  653. getWarehouseList({
  654. pageNum: 1,
  655. pageSize: -1
  656. }).then((res) => {
  657. this.warehouseList = res.data.records;
  658. })
  659. },
  660. async getSalesmanList() {
  661. const res = await getSalesmanList({
  662. pageNum: 1,
  663. pageSize: -1,
  664. isCustomer: 0,
  665. status: true,
  666. });
  667. this.salesmanList = res.data.records;
  668. },
  669. // 工程登录列表 - 获取列表
  670. getHomeLoginList() {
  671. getHomeLoginList({
  672. pageNum: this.dialogTable_currentPage,
  673. pageSize: this.dialogTable_pageSize,
  674. recordNo: this.screenForm.loginNum,
  675. projectName: this.screenForm.enginName,
  676. useUnit: this.screenForm.company,
  677. examineStatus: 'OK'
  678. }).then(res => {
  679. this.dialogTable_dataList = res.data.records;
  680. this.dialogTable_listTotal = res.data.total;
  681. this.dialogTable_listLoading = false;
  682. })
  683. },
  684. // 工程登录列表 - 打开弹窗
  685. openShareDetail() {
  686. if(!this.mainForm.saleType) {
  687. return this.$errorMsg('请先选择销售类型');
  688. }
  689. this.isShowDialog = true;
  690. this.dialogTable_currentPage = 1;
  691. this.screenForm.loginNum = this.mainForm.loginNum;
  692. this.getHomeLoginList();
  693. },
  694. // 工程登录列表 - 更改列表当前页
  695. dialogTableCurrentChange(val) {
  696. this.dialogTable_currentPage = val;
  697. this.getHomeLoginList();
  698. },
  699. // 提交筛选表单
  700. submitScreenForm() {
  701. this.dialogTable_currentPage = 1;
  702. this.getHomeLoginList();
  703. },
  704. // 重置筛选表单
  705. resetScreenForm() {
  706. this.$refs.screenForm.resetFields();
  707. this.dialogTable_currentPage = 1;
  708. this.getHomeLoginList();
  709. },
  710. // 选择工程登录
  711. chooseItem(id, uid) {
  712. getHomeLoginDetail({
  713. recordNo: id,
  714. saleTypeId: this.mainForm.saleType,
  715. userId: uid,
  716. enginOrderId: this.mainForm.orderNum
  717. }).then(res => {
  718. this.isShowDialog = false;
  719. let data = res.data;
  720. this.mainForm.type = data.productCategory;
  721. this.mainForm.loginUserId = data.userid;
  722. // this.mainForm.saleType = '';
  723. this.mainForm.loginNum = data.recordNo;
  724. this.mainForm.enginName = data.projectName;
  725. this.mainForm.loginType = data.tradeCategory;
  726. this.mainForm.factoryNum = data.factoryNo;
  727. this.mainForm.promiseStatus = data.promiseStatus;
  728. this.mainForm.company = data.useUnit;
  729. this.mainForm.contactMan = data.buyUnitCallMen;
  730. this.mainForm.tel = data.buyUnitTel;
  731. this.mainForm.phone = data.buyUnitPhone;
  732. this.mainForm.address = data.installAddress;
  733. this.mainForm.declareNo = data.declareNo;
  734. this.mainForm.projectRemark = data.buChonShuoMing;
  735. this.mainForm.projectType = data.govBuyType;
  736. let saleTypeItem = this.salesTypeList.find(o => o.id == this.mainForm.saleType);
  737. this.goodsList = data.items.map(item => {
  738. return {
  739. useRefCount: item.useRefCount,
  740. saleTypeId: saleTypeItem.id,
  741. saleTypeCode: saleTypeItem.saleCode,
  742. saleTypeName: saleTypeItem.saleName,
  743. materialId: item.materialId,
  744. materialNumber: item.materialNumber,
  745. materialOldNumber: item.materialOldNumber,
  746. materialName: item.materialName,
  747. specification: item.machine,
  748. enginNum: item.num,
  749. enginPrice: item.price,
  750. enginTotality: item.totality,
  751. historyHasDeliverQty: item.hasDeliverQty,
  752. unit: item.unit,
  753. price: item.price,
  754. qty: item.num,
  755. customerWalletId2: '',
  756. rebateRate: '',
  757. discAmount: '',
  758. customerWalletId: '',
  759. isDirectTransfer: false,
  760. directTransferQty: '',
  761. hasSendQty: '',
  762. remark: item.discri,
  763. tax: '',
  764. status1: '',
  765. status2: '',
  766. rebateWallets: item.customerWalletList.filter(item => {
  767. return item.type === 'REBATE';
  768. }),
  769. wallets: item.customerWalletList.filter(item => {
  770. return item.type === 'COMMONLY';
  771. }),
  772. }
  773. })
  774. this.goodsList.forEach(item => {
  775. item.customerWalletId = (item.wallets && item.wallets.length) ? item.wallets[0].customerWalletId : '';
  776. item.serviceId = (item.wallets && item.wallets.length) ? item.wallets[0].serviceId : '';
  777. item.serviceName = (item.wallets && item.wallets.length) ? item.wallets[0].serviceName : '';
  778. })
  779. })
  780. },
  781. // 选择销售类型
  782. changeSaleType() {
  783. if(this.mainForm.loginNum) {
  784. this.chooseItem(this.mainForm.loginNum, this.mainForm.loginUserId);
  785. }
  786. },
  787. // 删除产品
  788. deleteItem(index) {
  789. this.goodsList.splice(index, 1);
  790. },
  791. // 修改返利钱包
  792. changeFlWallet(index) {
  793. if(this.goodsList[index].customerWalletId2) {
  794. let obj = this.goodsList[index].rebateWallets.find(o => o.customerWalletId == this.goodsList[index].customerWalletId2);
  795. this.goodsList[index].rebateRate = obj.rebateRate;
  796. this.goodsList[index].customerWalletName2 = obj.customerWalletName;
  797. }else {
  798. this.goodsList[index].rebateRate = '';
  799. this.goodsList[index].customerWalletName2 = '';
  800. }
  801. },
  802. // 修改现金钱包
  803. changeXjWallet(index) {
  804. if(this.goodsList[index].customerWalletId) {
  805. let obj = this.goodsList[index].wallets.find(o => o.customerWalletId == this.goodsList[index].customerWalletId);
  806. this.goodsList[index].customerWalletName = obj.customerWalletName;
  807. }else {
  808. this.goodsList[index].customerWalletName = '';
  809. }
  810. },
  811. // 获取详情
  812. getDetail() {
  813. getOrderDetail({id: this.editId}).then(res => {
  814. let data = res.data;
  815. this.mainForm.orderNum = data.enginOrderId;
  816. this.mainForm.orderDate = data.orderDate;
  817. this.mainForm.type = data.mainId;
  818. this.mainForm.jxsNum = data.customerNumber;
  819. this.mainForm.jxsName = data.customerName;
  820. this.mainForm.loginNum = data.refEnginRecordNo;
  821. this.mainForm.enginName = data.refProjectName;
  822. this.mainForm.loginType = data.refTradeCategory;
  823. this.mainForm.promiseStatus = data.refPromiseStatus;
  824. this.mainForm.factoryNum = data.refFactoryNo;
  825. this.mainForm.company = data.refUseUnit;
  826. this.mainForm.saleType = data.saleTypeId;
  827. this.mainForm.contactMan = data.refLinkman;
  828. this.mainForm.tel = data.refTel;
  829. this.mainForm.phone = data.refPhone;
  830. this.mainForm.address = data.refInstallAddress;
  831. this.mainForm.declareNo = data.refDeclareNo;
  832. this.mainForm.greeRemark = data.geLiInerNote;
  833. this.mainForm.greeReply = data.note1;
  834. this.mainForm.remark = data.remark;
  835. this.mainForm.createMan = data.createBy;
  836. this.mainForm.createDate = data.createTime;
  837. this.mainForm.fileNum = data.fileNo;
  838. this.mainForm.salesMan = data.serviceId;
  839. this.mainForm.projectRemark = data.refProjectNote;
  840. this.mainForm.projectType = data.refProjectType;
  841. this.mainForm.examineRemark = data.examineNote;
  842. data.items.forEach(item => {
  843. item.status1 = '';
  844. item.status2 = '';
  845. item.rebateWallets = item.customerWalletList.filter(item => {
  846. return item.type === 'REBATE';
  847. });
  848. item.wallets = item.customerWalletList.filter(item => {
  849. return item.type === 'COMMONLY';
  850. });
  851. })
  852. this.goodsList = data.items;
  853. })
  854. },
  855. // 获取商品列表
  856. getGoodsList() {
  857. getRetailProductList({
  858. pageNum: this.currentPage,
  859. pageSize: 10,
  860. saleId: this.mainForm.saleType,
  861. materialCode: this.goodsScreenForm.proNum,
  862. materialName: this.goodsScreenForm.proName,
  863. specification: this.goodsScreenForm.proModel,
  864. price1: this.goodsScreenForm.price1,
  865. price2: this.goodsScreenForm.price2,
  866. }).then(res => {
  867. let oldGoodsList = this.goodsList;
  868. let newGoodsList = res.data.records;
  869. for(let i = 0; i < oldGoodsList.length; i++) {
  870. let oldItem = oldGoodsList[i]
  871. for(let j = 0; j < newGoodsList.length; j++) {
  872. let newItem = newGoodsList[j]
  873. if(newItem.id === oldItem.id){
  874. newGoodsList[j].selected = true;
  875. break;
  876. }
  877. }
  878. }
  879. res.data.records.forEach(item => {
  880. item.materialName = item.name;
  881. item.materialCode = item.number;
  882. item.saleTypeName = item.saleName;
  883. item.unit = item.baseUnit;
  884. item.price = item.batchPrice;
  885. item.tax = item.taxRate;
  886. item.isDirectTransfer = false;
  887. item.directTransferQty = '';
  888. item.status1 = '';
  889. item.status2 = '';
  890. item.rebateAmount = '';
  891. item.rebateRate = '';
  892. item.productPriceId = item.id;
  893. item.customerWalletId = (item.wallets && item.wallets.length) ? item.wallets[0].customerWalletId : '';
  894. });
  895. this.leftGoodsList = res.data.records;
  896. this.listTotal = res.data.total;
  897. })
  898. },
  899. // 查询重复值并禁选
  900. checkboxSelect(row, rowIndex) {
  901. if (row.selected) {
  902. return false // 禁用
  903. }else{
  904. return true // 不禁用
  905. }
  906. },
  907. // 点击 选择商品
  908. openDialog() {
  909. if(!this.mainForm.saleType) {
  910. return this.$errorMsg('请先选择销售类型');
  911. }
  912. this.isShowGoodsDialog = true;
  913. this.getGoodsList();
  914. },
  915. // 提交筛选表单
  916. submitGoodsScreenForm() {
  917. this.currentPage = 1;
  918. this.getGoodsList();
  919. },
  920. // 重置筛选表单
  921. resetGoodsScreenForm() {
  922. this.$refs.goodsScreenForm.resetFields();
  923. this.currentPage = 1;
  924. this.getGoodsList();
  925. },
  926. // 更改列表当前页
  927. handleTableCurrentChange(val) {
  928. this.currentPage = val;
  929. this.getGoodsList();
  930. },
  931. // 关闭 弹窗
  932. closeDialog() {
  933. this.isShowGoodsDialog = false;
  934. },
  935. // 左侧列表选择
  936. leftSelectionChange(val) {
  937. this.leftSelection = val;
  938. },
  939. // 右侧列表选择
  940. rightSelectionChange(val) {
  941. this.rightSelection = val;
  942. },
  943. // 数组去重
  944. delRepeat(arr1, arr2) {
  945. let allArr = arr1.concat(arr2); // 两个数组对象合并
  946. let newArr = []; // 存放去重后数据的新数组
  947. for(let i=0; i<allArr.length; i++){ // 循环allArr数组对象的内容
  948. let flag = true; // 建立标记,判断数据是否重复,true为不重复
  949. for(let j=0; j<newArr.length; j++){ // 循环新数组的内容
  950. if(allArr[i].id == newArr[j].id){ // 让allArr数组对象的内容与新数组的内容作比较,相同的话,改变标记为false
  951. flag = false;
  952. }
  953. }
  954. if(flag){ // 判断是否重复
  955. newArr.push(allArr[i]); // 不重复的放入新数组。 新数组的内容会继续进行上边的循环。
  956. }
  957. }
  958. return newArr;
  959. },
  960. // 全部添加
  961. addAllGoods() {
  962. this.rightGoodsList = this.delRepeat(this.leftGoodsList, this.rightGoodsList);
  963. },
  964. // 添加
  965. addGoods() {
  966. this.rightGoodsList = this.delRepeat(this.leftSelection, this.rightGoodsList);
  967. },
  968. // 删除
  969. deleteGoods() {
  970. let rightGoodsList = this.rightGoodsList;
  971. let rightSelection = this.rightSelection;
  972. for(let i = 0; i < rightGoodsList.length; i++) {
  973. for(let j = 0; j < rightSelection.length; j++) {
  974. if(rightSelection[j].materialId == rightGoodsList[i].materialId){
  975. this.rightGoodsList.splice(i, 1);
  976. }
  977. }
  978. }
  979. },
  980. // 全部删除
  981. deleteAllGoods() {
  982. this.rightGoodsList = [];
  983. },
  984. // 确定 添加产品
  985. submitAddGoods() {
  986. // this.goodsList = this.delRepeat(this.rightGoodsList, this.goodsList);
  987. this.goodsList = this.goodsList.concat(this.rightGoodsList);
  988. this.isShowGoodsDialog = false;
  989. this.leftGoodsList = [];
  990. this.rightGoodsList = [];
  991. },
  992. // 检查库存
  993. checkStock() {
  994. if(!this.warehouseValue) {
  995. return this.$errorMsg('请选择仓库');
  996. }
  997. if(!this.goodsList) {
  998. return this.$errorMsg('请添加货品');
  999. }
  1000. let ids = [];
  1001. this.goodsList.forEach(item => {
  1002. ids.push(item.materialId);
  1003. })
  1004. checkStock({
  1005. correspondId: this.warehouseValue,
  1006. materialId: ids.join(',')
  1007. }).then(res => {
  1008. if(res.data) {
  1009. this.goodsList.forEach((item, index) => {
  1010. item.status1 = res.data[index].allStockNum;
  1011. item.status2 = res.data[index].stockNum;
  1012. })
  1013. }
  1014. })
  1015. },
  1016. status2Filter(item) {
  1017. if (item.status2 === '' || item.status2 === null || item.status2 === undefined) return '未检查';
  1018. else if (item.status2 <= 0) return '无货';
  1019. else if (item.status2 >= item.qty) return '可用';
  1020. else return '短缺';
  1021. },
  1022. // 保存 / 提交审核
  1023. clickSubmitForm(type) {
  1024. this.$refs.mainForm.validate((valid) => {
  1025. if (valid) {
  1026. for(let i=0; i<this.goodsList.length; i++) {
  1027. if(!this.goodsList[i].customerWalletId) {
  1028. this.$errorMsg('请选择现金钱包');
  1029. return;
  1030. }
  1031. }
  1032. let goodsList = JSON.parse(JSON.stringify(this.goodsList));
  1033. goodsList.forEach(item => {
  1034. delete item.rebateWallets;
  1035. delete item.wallets;
  1036. })
  1037. let saleTypeItem = this.salesTypeList.find(o => o.id == this.mainForm.saleType);
  1038. let saleManItem = this.mainForm.salesMan ? this.salesmanList.find(o => o.adminUserId == this.mainForm.salesMan) : '';
  1039. let params = {
  1040. enginOrderId: this.mainForm.orderNum,
  1041. // orderDate: this.mainForm.orderDate,
  1042. // mainId: this.mainForm.type || '',
  1043. loginUserId: this.mainForm.loginUserId,
  1044. refEnginRecordNo: this.mainForm.loginNum || '',
  1045. refProjectName: this.mainForm.enginName || '',
  1046. refTradeCategory: this.mainForm.loginType || '',
  1047. refPromiseStatus: this.mainForm.promiseStatus || '',
  1048. refFactoryNo: this.mainForm.factoryNum || '',
  1049. refUseUnit: this.mainForm.company || '',
  1050. refLinkman: this.mainForm.contactMan || '',
  1051. refTel: this.mainForm.tel || '',
  1052. refPhone: this.mainForm.phone || '',
  1053. refInstallAddress: this.mainForm.address || '',
  1054. refDeclareNo: this.mainForm.declareNo || '',
  1055. saleTypeId: this.mainForm.saleType,
  1056. saleTypeCode: saleTypeItem.saleCode,
  1057. saleTypeName: saleTypeItem.saleName,
  1058. geLiInerNote: this.mainForm.greeRemark || '',
  1059. geLiNote: this.mainForm.greeReply || '',
  1060. remark: this.mainForm.remark || '',
  1061. fileNo: this.mainForm.fileNum || '',
  1062. serviceId: this.mainForm.salesMan,
  1063. serviceName: saleManItem.nickName,
  1064. refProjectNote: this.mainForm.projectRemark,
  1065. refProjectType: this.mainForm.projectType,
  1066. items: goodsList,
  1067. }
  1068. this.formLoading = true;
  1069. if(type === 1) {
  1070. if(this.listItem) {
  1071. editHome(params).then(res => {
  1072. this.$successMsg('编辑成功');
  1073. this.goBack();
  1074. this.$parent.getList();
  1075. }).finally(res => {
  1076. this.formLoading = false;
  1077. })
  1078. }else {
  1079. addHome(params).then(res => {
  1080. this.$successMsg('新增成功');
  1081. this.goBack();
  1082. this.$parent.getList();
  1083. }).finally(res => {
  1084. this.formLoading = false;
  1085. })
  1086. }
  1087. }else if(type === 2) {
  1088. submitHome(params).then(res => {
  1089. this.$successMsg('提交审核成功');
  1090. this.goBack();
  1091. this.$parent.getList();
  1092. }).finally(res => {
  1093. this.formLoading = false;
  1094. })
  1095. }
  1096. }
  1097. })
  1098. },
  1099. }
  1100. }
  1101. </script>
  1102. <style scoped lang="scss">
  1103. .detail-container {
  1104. width: 100%;
  1105. height: 100%;
  1106. }
  1107. .main-title {
  1108. display: flex;
  1109. justify-content: space-between;
  1110. align-items: center;
  1111. margin-top: 20px;
  1112. height: 60px;
  1113. border-bottom: 1px solid #DCDFE6;
  1114. margin-bottom: 20px;
  1115. .title {
  1116. font-size: 16px;
  1117. font-weight: 600;
  1118. padding-left: 10px;
  1119. }
  1120. }
  1121. .tables {
  1122. display: flex;
  1123. margin-top: 10px;
  1124. .table {
  1125. width: 45%;
  1126. }
  1127. .buttons {
  1128. display: flex;
  1129. flex-direction: column;
  1130. justify-content: center;
  1131. align-items: center;
  1132. padding: 0 10px;
  1133. button {
  1134. margin: 0;
  1135. margin-top: 10px;
  1136. }
  1137. }
  1138. }
  1139. ::v-deep input::-webkit-outer-spin-button,
  1140. ::v-deep input::-webkit-inner-spin-button {
  1141. -webkit-appearance: none;
  1142. }
  1143. ::v-deep input[type='number'] {
  1144. -moz-appearance: textfield;
  1145. }
  1146. </style>