salesOrderDetails.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338
  1. <template>
  2. <view style="padding-top: 1rpx;">
  3. <u--form labelPosition="left" :labelStyle="{color: '#fd4b09'}" :model="form" ref="form" labelWidth="180rpx"
  4. style="margin-top: 10rpx;padding-bottom: 130rpx;">
  5. <view style="width: calc(96%);margin: 0 auto;background-color: #fff;border-radius: 20rpx;">
  6. <u-cell-group :border="false">
  7. <u-cell :border="false" center title="基础信息" arrow-direction="down">
  8. <view slot="icon" style="width: 10rpx;height: 35rpx;background-color: #fd4b09;"></view>
  9. </u-cell>
  10. </u-cell-group>
  11. <view style="padding: 0 10rpx;">
  12. <u-form-item leftIcon="account" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="客户名称"
  13. prop="customerName" borderBottom @click="selectCustomer">
  14. <u-input v-model="form.customerName" inputAlign="right" border="none" placeholder="请选择客户名称"
  15. disabled disabledColor="#ffffff" />
  16. </u-form-item>
  17. <u-form-item leftIcon="account" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="联系人"
  18. prop="contacts" borderBottom @click="filterAll(['contacts','contacts'])">
  19. <u-input v-model="form.contacts" inputAlign="right" border="none" placeholder="请选择" disabled
  20. disabledColor="#ffffff">
  21. </u-input>
  22. </u-form-item>
  23. <u-form-item leftIcon="phone" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="电话"
  24. prop="phone" borderBottom>
  25. <u-input v-model="form.phone" inputAlign="right" border="none" placeholder="请选择"
  26. :disabled="form.generateTask != '未生成'" disabledColor="#ffffff">
  27. </u-input>
  28. </u-form-item>
  29. <u-form-item leftIcon="map" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="送货地址"
  30. prop="recAddress" borderBottom>
  31. <view style="width: 100%;text-align:right;padding-right: 10rpx;"
  32. v-if="form.generateTask != '未生成'">{{form.recAddress}}</view>
  33. <u--textarea v-else v-model="form.recAddress" autoHeight inputAlign="right" border="none"
  34. placeholder="请选择" :disabled="form.generateTask != '未生成'" disabledColor="#ffffff">
  35. <!-- <template slot="suffix">
  36. <u-icon name="map" color="#fd4b09" @tap="getMap"></u-icon>
  37. </template> -->
  38. </u--textarea>
  39. </u-form-item>
  40. <u-form-item leftIcon="account" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="业务员"
  41. prop="salerName" borderBottom @click="filterAll(['salerName','salerId'])">
  42. <u-input v-model="form.salerName" border="none" inputAlign="right" placeholder="请选择业务员" disabled
  43. disabledColor="#ffffff" />
  44. </u-form-item>
  45. <u-form-item leftIcon="calendar" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="日期"
  46. prop="businesDate" borderBottom @click="filterAll(['businesDate','businesDate'])">
  47. <u-input v-model="form.businesDate" inputAlign="right" border="none" placeholder="请选择日期"
  48. disabled disabledColor="#ffffff" />
  49. </u-form-item>
  50. <u-form-item leftIcon="home" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="发货仓库"
  51. prop="storageName" borderBottom @click="filterAll(['storageName','storageId'])">
  52. <u-input v-model="form.storageName" border="none" inputAlign="right" placeholder="请选择发货仓库"
  53. disabled disabledColor="#ffffff" />
  54. </u-form-item>
  55. <u-form-item leftIcon="car" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="配送方式"
  56. prop="cname" borderBottom @click="filterAll(['shipType','shipType'])">
  57. <u-input v-model="form.shipType" inputAlign="right" border="none" placeholder="请选择配送方式" disabled
  58. disabledColor="#ffffff" />
  59. </u-form-item>
  60. <u-form-item leftIcon="home" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="物流公司"
  61. prop="cname" borderBottom @click="filterAll(['logisticsCorpName','logisticsCorpId'])">
  62. <u-input v-model="form.logisticsCorpName" inputAlign="right" border="none" placeholder="请选择物流公司"
  63. disabled disabledColor="#ffffff" />
  64. </u-form-item>
  65. <u-form-item leftIcon="file-text" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="物流单号"
  66. prop="cname" borderBottom>
  67. <u-input v-model="form.expressNo" inputAlign="right" border="none" placeholder="请输入物流单号"
  68. :disabled="form.generateTask != '未生成'" disabledColor="#ffffff" />
  69. </u-form-item>
  70. </view>
  71. </view>
  72. <view style="width: 95%;margin: 10rpx auto;">
  73. <view
  74. style="display: flex;align-items: center;justify-content: space-between;background: #fff;border-radius: 12rpx; padding: 20rpx;">
  75. <view style="font-size: 30rpx;color: #fd4b09;">产品列表{{form.orderItemsList.length}}</view>
  76. <view v-if="form.generateTask == '未生成'">
  77. <u-button type="primary" text="添加产品" shape="circle" size="small" color="#FD4B09"
  78. @click="chanpintiao()"></u-button>
  79. </view>
  80. </view>
  81. <view
  82. style="position: relative;background: #fff;padding: 20rpx;margin-top: 20rpx;border-box;font-size: 32rpx;"
  83. v-for="(item,index) in form.orderItemsList" :key="index" @click="tanchuangxgai(item,index)">
  84. <view v-if="form.generateTask == '未生成'" class="orderItemsDelent"
  85. @click="orderItemsDelent(item.id,index)">删除</view>
  86. <view>
  87. <u-row>
  88. <u-col span="3">
  89. <u--image :showLoading="true" :src="item.url?item.url:'../../../static/images/404.png'"
  90. width="80px" height="80px" radius="10">
  91. </u--image>
  92. </u-col>
  93. <u-col span="8">
  94. <!-- style="font-size: 36rpx;width: 420rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;" -->
  95. <view style="font-size: 36rpx;">
  96. {{item.goodsName}}
  97. </view>
  98. <view style="color: #707070;">批次号:{{item.dot}}</view>
  99. <view style="display: flex;justify-content: space-between;">
  100. <view style="color: #707070;">单价:¥{{Number(item.price).toFixed(2)}}</view>
  101. <view style="color: #707070;">
  102. 数量:{{item.goodsNum?parseInt(item.goodsNum):item.goodsNum}}</view>
  103. </view>
  104. <view style="display: flex;justify-content: space-between;">
  105. <view style="color: #707070;">金额:¥{{item.subTotalMoney}}</view>
  106. <view v-if="form.confirmStatus == 0" style="color: #707070; color: red;"
  107. @click="deleteProduct(index)">
  108. <u-button type="error" size="mini" text="删除"></u-button>
  109. </view>
  110. </view>
  111. </u-col>
  112. </u-row>
  113. </view>
  114. </view>
  115. </view>
  116. </u--form>
  117. <view style="width: 100%;position: fixed;
  118. bottom: 0;background-color: #fff;border-top: 1rpx solid #ccc;">
  119. <view style="width: 100%;display: flex;font-size: 24rpx;">
  120. <view @click="revokeCheckOrderRWfun" v-if="form.taskWhetherAdopt == '审核提交'" style="width: 100%; padding: 10rpx 0;
  121. background-color: #d2983c;display: grid;justify-items: center;">
  122. <u-icon name="edit-pen" color="#fff"></u-icon>
  123. <view style="color: #fff;">撤销出库任务审批</view>
  124. </view>
  125. <view @click="orderRevokeGenerateShipTaskfun" v-else-if="form.generateTask == '已生成'" style="width: 100%; padding: 10rpx 0;
  126. background-color: #d2983c;display: grid;justify-items: center;">
  127. <u-icon name="edit-pen" color="#fff"></u-icon>
  128. <view style="color: #fff;">撤销任务</view>
  129. </view>
  130. <view @click="orderGenerateTask" v-else
  131. style="width: 100%; padding: 10rpx 0; background-color: #5ac725;display: grid;justify-items: center;">
  132. <u-icon name="edit-pen" color="#fff"></u-icon>
  133. <view style="color: #fff;">生成任务</view>
  134. </view>
  135. <view @click="conserve"
  136. style="width: 100%; background-color: #FD4B09;display: grid;justify-items: center;">
  137. <u-icon name="edit-pen" color="#fff"></u-icon>
  138. <view style="color: #fff;">保存</view>
  139. </view>
  140. </view>
  141. </view>
  142. <!-- 弹窗数据 -->
  143. <u-popup :show="popupShow" @close="popupShow = false" :closeable="true" mode="center"
  144. customStyle="width: 90%;margin: 0 auto;">
  145. <view style="padding: 40rpx 25rpx;box-sizing: border-box;">
  146. <view style="text-align: center;margin: 10rpx 0;">
  147. <view style="font-size: 36rpx;word-break:break-all;">
  148. {{popupForm.cname}}
  149. </view>
  150. </view>
  151. <view style="width: 96%;margin: 0 auto;clear: both;">
  152. <u-cell-group>
  153. <u-cell title="单价">
  154. <view slot="value">
  155. <u--input type='number' placeholder="请输入单价" border="none" inputAlign="right"
  156. v-model="popupForm.price" clearable disabledColor="#ffffff">
  157. </u--input>
  158. </view>
  159. </u-cell>
  160. <u-cell title="数量">
  161. <view slot="value">
  162. <u-number-box v-model="popupForm.goodsNum" :min="0">
  163. </u-number-box>
  164. </view>
  165. </u-cell>
  166. <u-cell title="批次号(DOT)" @click="dotClickfun">
  167. <view slot="value">
  168. <u--input border="none" inputAlign="right" v-model="popupForm.dot" disabled
  169. placeholder="请选择批次号" disabledColor="#ffffff"></u--input>
  170. </view>
  171. </u-cell>
  172. <u-cell title="库存">
  173. <view slot="value">
  174. {{popupForm.inventory?popupForm.inventory:'--'}}
  175. </view>
  176. </u-cell>
  177. <u-cell title="规格型号">
  178. <view slot="value">
  179. {{popupForm.specificationAndModel?popupForm.specificationAndModel:'--'}}
  180. </view>
  181. </u-cell>
  182. </u-cell-group>
  183. </view>
  184. <view style="margin-top: 40rpx;text-align: center;
  185. font-size: 32rpx;">
  186. <view style="display: flex; color: #fff;justify-content: space-around;">
  187. <view style="color: #FD4B09; border: 1rpx solid #FD4B09;
  188. width: 200rpx; height: 80rpx;
  189. line-height: 80rpx; border-radius: 12rpx;" @click="popupShow = false">取消</view>
  190. <view
  191. style="background-color: #FF6F3B; width: 200rpx; height: 80rpx; line-height: 80rpx; border-radius: 12rpx;"
  192. @click="popupConserve()">保存</view>
  193. </view>
  194. </view>
  195. </view>
  196. </u-popup>
  197. <!-- 批次号弹窗 -->
  198. <u-picker :show="dotPickerShow" :columns="dotPickerColumns" keyName="dot" @confirm="dotPickerConfirm"
  199. @cancel="dotPickerShow = false"></u-picker>
  200. <u-datetime-picker :show="timeOpen" v-model="datetime" mode="date" @cancel="timeOpen = false"
  201. @confirm="confirmTiem"></u-datetime-picker>
  202. <u-picker :show="showOpen" :columns="columns" :defaultIndex="defaultIndex" :keyName="keyName"
  203. @cancel="showOpen = false" @confirm="showPicker"></u-picker>
  204. <u-toast ref="uToast"></u-toast>
  205. </view>
  206. </template>
  207. <script>
  208. import {
  209. queryBrand
  210. } from '@/api/views/stock/index.js'
  211. import {
  212. gainUser,
  213. storageDescListAll,
  214. corpsDescDetail,
  215. orderItemsRemove,
  216. stockDescDotList,
  217. corpsAddrCorpIdByAddr,
  218. orderGenerateShipTask,
  219. orderRevokeGenerateShipTask,
  220. revokeCheckOrderRW,
  221. isProcurement,
  222. checkOrderRW,
  223. whetherExistenceFinancing
  224. } from '@/api/views/sale/index.js'
  225. import {
  226. typeSave,
  227. submitApp,
  228. confirm,
  229. revoke,
  230. removeItem,
  231. removeId,
  232. copyOrder,
  233. collectPayment,
  234. saveAtta,
  235. } from '@/api/views/sale/salesOrderDetails.js'
  236. import http from '@/http/api.js'
  237. import {
  238. clientId,
  239. clientSecret
  240. } from '@/common/setting'
  241. import {
  242. dateFormat
  243. } from '@/common/dateFormat'
  244. // #ifdef APP-PLUS
  245. const HanyinPlugin = uni.requireNativePlugin('Hanyin-Plugin'); //汉印
  246. import printConnect from "@/common/print.js"; //引入打印机模板文件
  247. let print;
  248. // #endif
  249. import {
  250. GET_REQUEST_DATA
  251. } from "@/store/gettersType.js";
  252. import {
  253. mapGetters,
  254. mapActions
  255. } from 'vuex';
  256. import {
  257. DX
  258. } from '@/common/dateFormat.js';
  259. export default {
  260. data() {
  261. return {
  262. form: {
  263. orderItemsList: [],
  264. },
  265. datetime: Number(new Date()),
  266. timeOpen: false,
  267. screen: [],
  268. showOpen: false,
  269. choice: false,
  270. columns: [],
  271. connected: false,
  272. amountNumber: {
  273. deliveryAll: 0,
  274. cost: 0,
  275. grossProfit: 0,
  276. delivery: 0,
  277. saleAll: 0,
  278. amount: 0
  279. },
  280. // 会员卡余额
  281. balanceAmount: 0,
  282. // 深拷贝的优惠金额数据
  283. JsonthisUsedProfit: 0,
  284. keyName: '',
  285. // 业务员数据
  286. salesmanData: [],
  287. // 物流配送方式请求到的数据
  288. selectData: [],
  289. // 物流公司请求的数据
  290. logisticsCorpData: [],
  291. // 仓库数据
  292. warehouseData: [],
  293. // 联系人数据
  294. contactsData: [],
  295. popupShow: false,
  296. popupForm: {},
  297. popupIndex: 0,
  298. dotPickerShow: false,
  299. dotPickerColumns: [],
  300. defaultIndex: [0]
  301. }
  302. },
  303. onLoad(data) {
  304. this.queryBrandfun()
  305. this.HYqueryBrandfun()
  306. // 获取详情信息
  307. this.refresh(data.id)
  308. },
  309. computed: {
  310. ...mapGetters([GET_REQUEST_DATA])
  311. },
  312. onShow() {
  313. this.choice = false
  314. let this_ = this
  315. // #ifdef APP-PLUS
  316. HanyinPlugin.IsOpened(res => {
  317. this_.connected = res.state
  318. if (this_.GET_REQUEST_DATA.length == 0) {
  319. this_.connected = false
  320. print = new printConnect({}, 1); //打印机连接
  321. }
  322. });
  323. // #endif
  324. },
  325. onNavigationBarButtonTap(e) {
  326. this.choice = !this.choice
  327. },
  328. methods: {
  329. // 批次号打开弹窗按钮 获取批次号数据
  330. dotClickfun() {
  331. this.dotPickerShow = true
  332. console.log(this.popupForm, 284);
  333. stockDescDotList({
  334. storageId: this.form.storageId,
  335. goodsId: this.popupForm.goodsId
  336. }).then(res => {
  337. this.dotPickerColumns = [res.data]
  338. })
  339. },
  340. // 批次号弹窗的确认
  341. dotPickerConfirm(e) {
  342. this.popupForm.dot = e.value[0].dot
  343. this.dotPickerShow = false
  344. },
  345. //修改弹窗点击保存事件
  346. popupConserve() {
  347. if (this.popupForm.whether == 1) {
  348. if (!this.popupForm.dot) {
  349. return uni.showToast({
  350. icon: 'none',
  351. title: '批次号必填',
  352. position: "bottom"
  353. })
  354. }
  355. }
  356. if (!this.popupForm.goodsNum) {
  357. return uni.showToast({
  358. icon: 'none',
  359. title: '数量不能为0',
  360. position: "bottom"
  361. })
  362. }
  363. this.form.orderItemsList[this.popupIndex] = this.popupForm
  364. uni.hideLoading();
  365. this.popupShow = false
  366. },
  367. // 获取仓库数据
  368. storageDescListAllfun() {
  369. storageDescListAll().then(res => {
  370. this.warehouseData = res.data
  371. this.salesmanData.map(item => {
  372. if (item.id == this.form.storageId) {
  373. this.$set(this.form, 'storageName', item.cname)
  374. }
  375. })
  376. })
  377. },
  378. // 获取联系人数据 赋值第一项
  379. corpsAddrCorpIdByAddrfun(type) {
  380. corpsAddrCorpIdByAddr({
  381. pid: this.form.customerId
  382. }).then(res => {
  383. this.contactsData = res.data
  384. if (type == 'KH') {
  385. this.$set(this.form, 'contacts', this.contactsData[0].contacts)
  386. this.$set(this.form, 'recAddress', this.contactsData[0].address)
  387. this.$set(this.form, 'phone', this.contactsData[0].tel)
  388. }
  389. })
  390. },
  391. // 获取业务员信息
  392. gainUserfun() {
  393. gainUser({
  394. roleName: '业务员'
  395. }).then(res => {
  396. this.salesmanData = res.data
  397. this.salesmanData.map(item => {
  398. if (item.id == this.form.salerId) {
  399. this.$set(this.form, 'salerName', item.name)
  400. }
  401. })
  402. })
  403. },
  404. // 获取物流配送方式数据
  405. queryBrandfun() {
  406. queryBrand({
  407. code: 'deliveryMethod'
  408. }).then(res => {
  409. this.selectData = res.data
  410. })
  411. },
  412. // 获取货运公司数据
  413. HYqueryBrandfun() {
  414. queryBrand({
  415. code: 'tyre_express_company'
  416. }).then(res => {
  417. this.logisticsCorpData = res.data
  418. })
  419. },
  420. //跳转连接设备
  421. connectingDevices() {
  422. if (this.connected) {
  423. this.senBleLabel()
  424. } else {
  425. uni.$u.route('/pages/views/bluetooth/index', {
  426. data: JSON.stringify(this.form)
  427. });
  428. }
  429. },
  430. senBleLabel() {
  431. // if (!print) return;
  432. console.log(this.$Mock.printTemplate.pagConfig)
  433. this.$Mock.printTemplate.pagConfig = 0
  434. let data = []
  435. let i = 0
  436. for (let item of this.form.orderItemsList) {
  437. data.push({
  438. "top": Number(i * 40 + 90),
  439. "left": "0",
  440. "textAlign": "start",
  441. "width": "270",
  442. "fontSize": 9,
  443. "text": item.cname,
  444. "type": "text",
  445. "fontWeight": "400",
  446. "height": "20"
  447. })
  448. data.push({
  449. "top": Number(i * 40 + 110),
  450. "left": "140",
  451. "textAlign": "start",
  452. "width": "40",
  453. "fontSize": 8,
  454. "text": Number(item.storageInQuantity),
  455. "type": "text",
  456. "fontWeight": "400",
  457. "height": "20"
  458. })
  459. data.push({
  460. "top": Number(i * 40 + 110),
  461. "left": "160",
  462. "textAlign": "start",
  463. "width": "50",
  464. "fontSize": 8,
  465. "text": item.price,
  466. "type": "text",
  467. "fontWeight": "400",
  468. "height": "20"
  469. })
  470. data.push({
  471. "top": Number(i * 40 + 110),
  472. "left": "210",
  473. "textAlign": "start",
  474. "width": "60",
  475. "fontSize": 8,
  476. "text": item.amount,
  477. "type": "text",
  478. "fontWeight": "400",
  479. "height": "20"
  480. })
  481. i++
  482. }
  483. data.push({
  484. "top": Number(i * 40 + 90),
  485. "left": "20",
  486. "textAlign": "start",
  487. "width": "270",
  488. "fontSize": 9,
  489. "text": "合计:",
  490. "type": "text",
  491. "fontWeight": "400",
  492. "height": "20"
  493. })
  494. data.push({
  495. "top": Number(i * 40 + 90),
  496. "left": "140",
  497. "textAlign": "start",
  498. "width": "40",
  499. "fontSize": 8,
  500. "text": this.amountNumber.saleAll,
  501. "type": "text",
  502. "fontWeight": "400",
  503. "height": "20"
  504. })
  505. data.push({
  506. "top": Number(i * 40 + 90),
  507. "left": "210",
  508. "textAlign": "start",
  509. "width": "60",
  510. "fontSize": 8,
  511. "text": this.form.debitAmount,
  512. "type": "text",
  513. "fontWeight": "400",
  514. "height": "20"
  515. })
  516. data.push({
  517. "top": Number(i * 40 + 110),
  518. "left": "20",
  519. "textAlign": "start",
  520. "width": "270",
  521. "fontSize": 9,
  522. "text": "产品合计:",
  523. "type": "text",
  524. "fontWeight": "400",
  525. "height": "20"
  526. })
  527. data.push({
  528. "top": Number(i * 40 + 110),
  529. "left": "70",
  530. "textAlign": "start",
  531. "width": "70",
  532. "fontSize": 8,
  533. "text": this.amountNumber.amount,
  534. "type": "text",
  535. "fontWeight": "400",
  536. "height": "20"
  537. })
  538. data.push({
  539. "top": Number(i * 40 + 110),
  540. "left": "140",
  541. "textAlign": "start",
  542. "width": "60",
  543. "fontSize": 8,
  544. "text": "合计金额:",
  545. "type": "text",
  546. "fontWeight": "400",
  547. "height": "20"
  548. })
  549. data.push({
  550. "top": Number(i * 40 + 110),
  551. "left": "190",
  552. "textAlign": "start",
  553. "width": "80",
  554. "fontSize": 8,
  555. "text": DX(this.amountNumber.amount),
  556. "type": "text",
  557. "fontWeight": "400",
  558. "height": "40"
  559. })
  560. data.push({
  561. "top": Number(i * 40 + 130),
  562. "left": "20",
  563. "textAlign": "start",
  564. "width": "270",
  565. "fontSize": 9,
  566. "text": "订货电话:" + this.form.clientAttn,
  567. "type": "text",
  568. "fontWeight": "400",
  569. "height": "20"
  570. })
  571. data.push({
  572. "top": Number(i * 40 + 150),
  573. "left": "20",
  574. "textAlign": "start",
  575. "width": "270",
  576. "fontSize": 9,
  577. "text": "制单人:" + this.form.client,
  578. "type": "text",
  579. "fontWeight": "400",
  580. "height": "20"
  581. })
  582. data.push({
  583. "top": Number(i * 40 + 150),
  584. "left": "140",
  585. "textAlign": "start",
  586. "width": "80",
  587. "fontSize": 8,
  588. "text": "收货人(签字):",
  589. "type": "text",
  590. "fontWeight": "400",
  591. "height": "20"
  592. })
  593. print.startPrint({
  594. SALES_SLIP: this.form.sysNo,
  595. CUSTOMER_NAME: this.form.customerName,
  596. SALES_DATE: this.form.businesDate.slice(0, 10)
  597. }, {
  598. pageHeight: (this.form.orderItemsList.length * 40) / 3
  599. }, data);
  600. },
  601. generatePictures() {
  602. uni.$u.route('/pages/views/bluetooth/salesSlipTable', {
  603. data: JSON.stringify(this.form)
  604. });
  605. },
  606. //遮罩层禁止点击空方法
  607. moveHandle() {},
  608. newCompany() {
  609. uni.$u.route('/pages/views/product/createCompany', {
  610. code: "account",
  611. title: "收款账户"
  612. });
  613. },
  614. getMap() {
  615. let this_ = this
  616. uni.chooseLocation({
  617. success: function(res) {
  618. this_.$set(this_.form, "recAddress", res.address)
  619. }
  620. });
  621. },
  622. copyDocument() {
  623. let form = {
  624. ...this.form,
  625. }
  626. if (form.orderFilesList.length > 0) {
  627. form.orderFilesList.forEach(item => delete item.status)
  628. }
  629. let this_ = this
  630. uni.showModal({
  631. title: '提示',
  632. content: "是否确认复制新增",
  633. success: function(rest) {
  634. if (rest.confirm == true) {
  635. uni.showLoading({
  636. title: '加载中',
  637. mask: true
  638. });
  639. copyOrder(form).then(res => {
  640. uni.hideLoading();
  641. uni.showToast({
  642. icon: "none",
  643. title: '复制新增成功',
  644. mask: true
  645. });
  646. this_.form = res.data
  647. this_.amountNumber = {
  648. deliveryAll: 0, //送货总数量
  649. cost: 0, //成本
  650. grossProfit: 0, //毛利
  651. delivery: 0, //送货
  652. saleAll: 0, //销售数量
  653. amount: 0
  654. }
  655. for (let item of this_.form.orderItemsList) {
  656. this_.amountNumber.saleAll += Number(item.storageInQuantity)
  657. this_.amountNumber.cost += Number(item.storageInQuantity) * Number(
  658. item.purchasePrice)
  659. this_.amountNumber.delivery += Number(item.actualQuantity)
  660. this_.amountNumber.deliveryAll += Number(item.actualQuantity)
  661. this_.amountNumber.amount += Number(item.amount)
  662. this_.amountNumber.grossProfit += Number(item.amount) - (item
  663. .purchasePrice ? Number(item.storageInQuantity) * Number(
  664. item.purchasePrice) : 0)
  665. }
  666. this.form.orderAmount = this.amountNumber.amount
  667. })
  668. }
  669. }
  670. })
  671. },
  672. deleteDoc() {
  673. if (this.form.id) {
  674. let this_ = this
  675. if (this_.form.confirmStatus == 1) {
  676. return uni.showToast({
  677. icon: "none",
  678. title: '禁止删除',
  679. mask: true
  680. });
  681. }
  682. uni.showModal({
  683. title: '提示',
  684. content: "是否确认删除",
  685. success: function(rest) {
  686. if (rest.confirm == true) {
  687. removeId({
  688. id: this_.form.id
  689. }).then(res => {
  690. uni.showToast({
  691. icon: "none",
  692. title: '删除成功',
  693. mask: true
  694. });
  695. setTimeout(function() {
  696. uni.navigateBack()
  697. }, 1000);
  698. })
  699. }
  700. }
  701. })
  702. } else {
  703. uni.showToast({
  704. icon: "none",
  705. title: '未保存',
  706. mask: true
  707. });
  708. }
  709. },
  710. deleteProduct(index) {
  711. let this_ = this
  712. if (this_.form.orderItemsList[index].id) {
  713. uni.showModal({
  714. title: '提示',
  715. content: "是否确认删除",
  716. success: function(rest) {
  717. if (rest.confirm == true) {
  718. uni.showLoading({
  719. title: '加载中',
  720. mask: true
  721. });
  722. removeItem({
  723. itemId: this_.form.orderItemsList[index].id
  724. }).then(res => {
  725. uni.hideLoading();
  726. uni.showToast({
  727. icon: "none",
  728. title: '删除成功',
  729. mask: true
  730. });
  731. this_.form.orderItemsList.splice(index, 1)
  732. }).catch(err => {
  733. uni.hideLoading();
  734. })
  735. }
  736. }
  737. })
  738. } else {
  739. this_.form.orderItemsList.splice(index, 1)
  740. }
  741. },
  742. //时间确认选择
  743. confirmTiem(e) {
  744. this.form[this.screen[1]] = dateFormat(new Date(e.value), "YYYY-MM-DD HH:mm:ss")
  745. this.timeOpen = false
  746. },
  747. // 下拉选择
  748. showPicker(e) {
  749. console.log(this.screen[1]);
  750. if (this.screen[1] == "account") {
  751. this.formTwo.account = e.value[0].dictValue
  752. this.showOpen = false
  753. } else if (this.screen[1] == "salerId") {
  754. this.form.salerName = e.value[0].name
  755. this.form.salerId = e.value[0].id
  756. this.showOpen = false
  757. } else if (this.screen[1] == "storageId") {
  758. this.form.storageName = e.value[0].cname
  759. this.form.storageId = e.value[0].id
  760. this.showOpen = false
  761. } else if (this.screen[1] == "contacts") {
  762. this.form.contacts = e.value[0].contacts
  763. this.form.recAddress = e.value[0].address
  764. this.form.phone = e.value[0].tel
  765. this.showOpen = false
  766. } else if (this.screen[1] == "shipType") {
  767. this.form.shipType = e.value[0].dictValue
  768. this.showOpen = false
  769. } else if (this.screen[1] == "logisticsCorpId") {
  770. this.form.logisticsCorpId = e.value[0].dictKey
  771. this.form.logisticsCorpName = e.value[0].dictValue
  772. this.showOpen = false
  773. } else {}
  774. // this.form[this.screen[1]] = e.value[0].dictValue
  775. // this.showOpen = false
  776. },
  777. //集合筛选条件
  778. filterAll(screen) {
  779. // if (this.form.status != '录入') return
  780. if (this.form.generateTask != '未生成') return
  781. this.screen = screen
  782. switch (screen[1]) {
  783. case "businesDate":
  784. this.timeOpen = true
  785. break;
  786. case "account":
  787. this.$u.api.getWorkDicts('account').then(res => {
  788. this.columns = [res.data]
  789. this.defaultIndex = [0]
  790. this.keyName = 'dictValue'
  791. this.showOpen = true
  792. })
  793. break;
  794. case "settlmentAmount":
  795. uni.$u.route('/pages/views/salesSlip/collectionList', this.form);
  796. break;
  797. // 仓库
  798. case "storageId":
  799. this.columns = [this.warehouseData]
  800. this.defaultIndex = [0]
  801. this.keyName = 'cname'
  802. this.showOpen = true
  803. break;
  804. // 业务员
  805. case "salerId":
  806. this.columns = [this.salesmanData]
  807. this.defaultIndex = [0]
  808. this.keyName = 'name'
  809. this.showOpen = true
  810. break;
  811. // 联系人
  812. case "contacts":
  813. this.columns = [this.contactsData]
  814. this.defaultIndex = [0]
  815. this.keyName = 'contacts'
  816. this.showOpen = true
  817. break;
  818. // 配送方式
  819. case "shipType":
  820. this.columns = [this.selectData]
  821. this.defaultIndex = [0]
  822. this.keyName = 'dictValue'
  823. this.showOpen = true
  824. break;
  825. // 物流公司
  826. case "logisticsCorpId":
  827. this.columns = [this.logisticsCorpData]
  828. this.defaultIndex = [0]
  829. this.keyName = 'dictValue'
  830. this.showOpen = true
  831. break;
  832. }
  833. },
  834. // 弹窗修改
  835. tanchuangxgai(row, index) {
  836. if (this.form.generateTask != '未生成') return
  837. this.popupForm = row
  838. this.popupIndex = index
  839. this.popupShow = true
  840. },
  841. // 产品删除
  842. orderItemsDelent(id, index) {
  843. uni.showModal({
  844. title: '提示',
  845. content: '是否确认删除',
  846. success: (rest) => {
  847. console.log(rest);
  848. if (rest.confirm == true) {
  849. if (id) {
  850. orderItemsRemove({
  851. ids: id
  852. }).then(res => {
  853. this.form.orderItemsList.splice(index, 1);
  854. this.$refs.uToast.show({
  855. type: 'success',
  856. message: "操作成功",
  857. })
  858. })
  859. } else {
  860. this.form.orderItemsList.splice(index, 1);
  861. this.$refs.uToast.show({
  862. type: 'success',
  863. message: "操作成功",
  864. })
  865. }
  866. }
  867. }
  868. })
  869. },
  870. // 获取详情数据
  871. refresh(id) {
  872. uni.showLoading({
  873. title: '加载中',
  874. mask: true
  875. });
  876. typeSave({
  877. id: id
  878. }).then(res => {
  879. this.form = res.data
  880. this.gainUserfun()
  881. this.storageDescListAllfun()
  882. this.corpsAddrCorpIdByAddrfun()
  883. this.form.memberAmout = 0
  884. this.amountNumber = {
  885. deliveryAll: 0, //送货总数量
  886. cost: 0, //成本
  887. grossProfit: 0, //毛利
  888. delivery: 0, //送货
  889. saleAll: 0, //销售数量
  890. amount: 0
  891. }
  892. for (let item of this.form.orderItemsList) {
  893. this.amountNumber.saleAll += Number(item.storageInQuantity)
  894. this.amountNumber.cost += Number(item.storageInQuantity) * Number(item.purchasePrice)
  895. this.amountNumber.delivery += Number(item.actualQuantity)
  896. this.amountNumber.deliveryAll += Number(item.actualQuantity)
  897. this.amountNumber.amount += Number(item.amount)
  898. this.amountNumber.grossProfit += Number(item.amount) - (item.purchasePrice ? Number(item
  899. .storageInQuantity) * Number(item.purchasePrice) : 0)
  900. }
  901. this.form.orderAmount = this.amountNumber.amount
  902. setTimeout(function() {
  903. uni.hideLoading();
  904. }, 500);
  905. })
  906. },
  907. //确认收款
  908. confirmReceipt() {
  909. let this_ = this
  910. let form = {
  911. ...this_.form,
  912. }
  913. if (form.orderFilesList.length > 0) {
  914. form.orderFilesList.forEach(item => delete item.status)
  915. }
  916. // if (!form.currentAmount) {
  917. // return uni.showToast({
  918. // icon: "none",
  919. // title: '本次收款金额不能为空',
  920. // mask: true,
  921. // duration: 2000
  922. // });
  923. // }
  924. // 判断本次收款和会员卡收款不能为空
  925. if (!this.form.currentAmount || this.form.currentAmount == 0) {
  926. if (!this.form.memberAmout || this.form.memberAmout == 0) {
  927. return uni.showToast({
  928. icon: "none",
  929. title: '本次收款金额或会员卡金额不能为空或零',
  930. mask: true
  931. });
  932. }
  933. }
  934. if (!form.account) {
  935. return uni.showToast({
  936. icon: "none",
  937. title: '未选择收款账户',
  938. mask: true,
  939. duration: 2000
  940. });
  941. }
  942. form.currentAmount = form.currentAmount ? form.currentAmount : 0
  943. uni.showModal({
  944. title: '收款:',
  945. content: '现金收款:' + form.currentAmount + '元\n会员卡收款:' + form.memberAmout + '元',
  946. success: function(rest) {
  947. if (rest.confirm == true) {
  948. uni.showLoading({
  949. title: '加载中',
  950. mask: true
  951. });
  952. collectPayment(form).then(res => {
  953. uni.showToast({
  954. icon: "none",
  955. title: '收款成功',
  956. mask: true,
  957. duration: 2000
  958. });
  959. setTimeout(function() {
  960. uni.hideLoading();
  961. this_.refresh(res.data.id)
  962. }, 1000);
  963. })
  964. }
  965. }
  966. })
  967. },
  968. //保存附件
  969. saveAttachment() {
  970. let form = {
  971. pid: this.form.id,
  972. }
  973. if (form.orderFilesList.length > 0) {
  974. form.orderFilesList.forEach(item => delete item.status)
  975. }
  976. uni.showLoading({
  977. title: '加载中',
  978. mask: true
  979. });
  980. saveAtta(form).then(res => {
  981. uni.showToast({
  982. icon: "none",
  983. title: '保存成功',
  984. mask: true
  985. });
  986. let _this = this
  987. setTimeout(function() {
  988. uni.hideLoading();
  989. _this.refresh(res.data.id)
  990. }, 1000);
  991. })
  992. },
  993. orderGenerateTask() {
  994. isProcurement({
  995. param: "whether.financing"
  996. }).then(res => {
  997. if (res.data == 1) {
  998. if (!this.form.storageId) {
  999. return this.$refs.uToast.show({
  1000. top: this.revenueTop,
  1001. type: 'warning',
  1002. message: '请选择发货仓库!'
  1003. })
  1004. } else {
  1005. this.whetherExistenceFinancingFun(this.form)
  1006. }
  1007. } else {
  1008. this.orderGenerateShipTaskfun()
  1009. }
  1010. })
  1011. },
  1012. orderGenerateShipTaskfun() {
  1013. uni.showModal({
  1014. title: '提示',
  1015. content: '是否确认生成任务',
  1016. success: (rest) => {
  1017. if (rest.confirm == true) {
  1018. uni.showLoading({
  1019. title: '加载中',
  1020. mask: true
  1021. });
  1022. submitApp({
  1023. bsType: "XS",
  1024. ...this.form
  1025. }).then(() => {
  1026. orderGenerateShipTask({
  1027. bsType: "XS",
  1028. ...this.form
  1029. }).then(res => {
  1030. uni.showToast({
  1031. icon: "none",
  1032. title: '生成任务成功',
  1033. mask: true
  1034. });
  1035. uni.hideLoading();
  1036. this.refresh(res.data.id)
  1037. })
  1038. })
  1039. }
  1040. }
  1041. })
  1042. },
  1043. whetherExistenceFinancingFun(form) {
  1044. whetherExistenceFinancing({
  1045. bsType: "XS",
  1046. ...form
  1047. }).then(res => {
  1048. if (res.data == true) {
  1049. this.orderGenerateShipTaskfun()
  1050. } else {
  1051. uni.showModal({
  1052. title: '提示',
  1053. content: res.data,
  1054. success: (rest) => {
  1055. if (rest.confirm == true) {
  1056. checkOrderRW({
  1057. bsType: "XS",
  1058. ...form,
  1059. url: '/tirePartsMall/salesManagement/saleOrder/index',
  1060. pageStatus: "this.$store.getters.ltxsStatus",
  1061. pageLabel: "销售订单(L)",
  1062. }).then(res => {
  1063. uni.showToast({
  1064. icon: "none",
  1065. title: '生成任务成功',
  1066. mask: true
  1067. });
  1068. this.refresh(res.data.id)
  1069. })
  1070. }
  1071. }
  1072. })
  1073. }
  1074. })
  1075. }, // 生成任务接口
  1076. revokeCheckOrderRWfun() {
  1077. uni.showModal({
  1078. title: '提示',
  1079. content: '是否撤销出库任务审批',
  1080. success: (rest) => {
  1081. if (rest.confirm == true) {
  1082. uni.showLoading({
  1083. title: '加载中',
  1084. mask: true
  1085. });
  1086. revokeCheckOrderRW({
  1087. ...this.form
  1088. }).then(res => {
  1089. uni.showToast({
  1090. icon: "none",
  1091. title: '撤销任务成功',
  1092. mask: true
  1093. });
  1094. uni.hideLoading();
  1095. this.refresh(res.data.id)
  1096. })
  1097. }
  1098. }
  1099. })
  1100. },
  1101. // 撤销任务
  1102. orderRevokeGenerateShipTaskfun() {
  1103. uni.showModal({
  1104. title: '提示',
  1105. content: '是否确认生成任务',
  1106. success: (rest) => {
  1107. if (rest.confirm == true) {
  1108. uni.showLoading({
  1109. title: '加载中',
  1110. mask: true
  1111. });
  1112. submitApp({
  1113. bsType: "XS",
  1114. ...this.form
  1115. }).then(() => {
  1116. orderRevokeGenerateShipTask({
  1117. bsType: "XS",
  1118. ...this.form
  1119. }).then(res => {
  1120. uni.showToast({
  1121. icon: "none",
  1122. title: '撤销任务成功',
  1123. mask: true
  1124. });
  1125. uni.hideLoading();
  1126. this.refresh(res.data.id)
  1127. })
  1128. })
  1129. }
  1130. }
  1131. })
  1132. },
  1133. //保存
  1134. conserve() {
  1135. // if (!this.form.shipType) {
  1136. // return this.$refs.uNotify.show({
  1137. // top: this.revenueTop,
  1138. // type: 'warning',
  1139. // message: '请选择配送方式!'
  1140. // })
  1141. // }
  1142. // if (!this.form.logisticsCorpId) {
  1143. // return this.$refs.uNotify.show({
  1144. // top: this.revenueTop,
  1145. // type: 'warning',
  1146. // message: '请选择物流公司!'
  1147. // })
  1148. // }
  1149. // if (!this.form.expressNo) {
  1150. // return this.$refs.uNotify.show({
  1151. // top: this.revenueTop,
  1152. // type: 'warning',
  1153. // message: '请输入物流单号!'
  1154. // })
  1155. // }
  1156. let form = {
  1157. ...this.form,
  1158. }
  1159. uni.showLoading({
  1160. title: '加载中',
  1161. mask: true
  1162. });
  1163. submitApp(form).then(res => {
  1164. uni.showToast({
  1165. icon: "none",
  1166. title: '保存成功',
  1167. mask: true
  1168. });
  1169. let _this = this
  1170. setTimeout(function() {
  1171. uni.hideLoading();
  1172. _this.refresh(res.data.id)
  1173. }, 1000);
  1174. })
  1175. },
  1176. //客户选择返回触发
  1177. otherFun(customer) {
  1178. this.form.customerName = customer.cname
  1179. this.form.customerId = customer.id
  1180. this.form.salerId = customer.salesmanId
  1181. this.form.salerName = ''
  1182. this.salesmanData.map(item => {
  1183. if (item.id == this.form.salerId) {
  1184. this.form.salerName = item.name
  1185. }
  1186. })
  1187. this.form.storageName = ''
  1188. this.form.storageId = customer.deliveryWarehouseId
  1189. this.warehouseData.map(item => {
  1190. if (item.id == this.form.storageId) {
  1191. this.form.storageName = item.cname
  1192. }
  1193. })
  1194. this.corpsAddrCorpIdByAddrfun('KH')
  1195. // corpsDescDetail({id:customer.id}).then(res=>{
  1196. // this.form.contacts = res.data.corpsAddrList[0].contacts
  1197. // this.form.recAddress = res.data.corpsAddrList[0].belongtoarea + res.data.corpsAddrList[0].detailedAddress
  1198. // this.form.phone = res.data.corpsAddrList[0].tel
  1199. // })
  1200. },
  1201. selectProduct() {
  1202. if (this.form.confirmStatus == 0) {
  1203. this.$u.route('/pages/views/salesSlip/selectProduct', this.form);
  1204. }
  1205. },
  1206. // 产品跳转
  1207. chanpintiao() {
  1208. if (!this.form.customerId) return this.$refs.uToast.show({
  1209. top: this.revenueTop,
  1210. type: 'warning',
  1211. message: '请选择客户!'
  1212. })
  1213. if (this.form.storageId) {
  1214. this.$u.route('/pages/views/salesSlip/selectProduct', {
  1215. form: JSON.stringify(this.form),
  1216. data: JSON.stringify(this.form.orderItemsList),
  1217. corpId: this.form.corpId
  1218. });
  1219. } else {
  1220. this.$refs.uToast.show({
  1221. top: this.revenueTop,
  1222. type: 'warning',
  1223. message: '请选择发货仓库!'
  1224. })
  1225. }
  1226. },
  1227. //商品选择返回
  1228. getProduct(dataList) {
  1229. for (let item of dataList) {
  1230. this.form.orderItemsList.push({
  1231. goodsId: item.id,
  1232. price: item.price,
  1233. goodsName: item.cname,
  1234. goodsNum: item.goodsNum,
  1235. brandName: item.brandName,
  1236. brandId: item.brandId,
  1237. goodsNo: item.code,
  1238. propertyName: item.specificationAndModel,
  1239. inventory: item.inventory,
  1240. pattern: item.brandItem,
  1241. goodsDescription: item.goodsDescription,
  1242. dot: item.dot,
  1243. whether: item.whether,
  1244. units: item.unit,
  1245. // 小计
  1246. subTotalMoney: item.goodsNum * item.price,
  1247. // 备注
  1248. remarks: item.remarks,
  1249. // 批次号的状态
  1250. dotedittype: false,
  1251. // 价格数量
  1252. goodsNumtype: false,
  1253. // 价格
  1254. pricetype: false,
  1255. })
  1256. }
  1257. console.log(this.form.orderItemsList, 963);
  1258. },
  1259. selectCustomer() {
  1260. // if (this.form.status != '录入') return
  1261. if (this.form.generateTask != '未生成') return
  1262. this.$u.route('/pages/views/salesSlip/selectCustomer', {
  1263. corpType: 'KH'
  1264. });
  1265. },
  1266. }
  1267. }
  1268. </script>
  1269. <style lang="scss" scoped>
  1270. ::v-deep .u-cell__body {
  1271. padding: 20rpx 10rpx;
  1272. }
  1273. .choice {
  1274. position: fixed;
  1275. right: 10rpx;
  1276. border-radius: 10rpx;
  1277. padding: 0 10rpx 10rpx 10rpx;
  1278. background-color: #fff;
  1279. // #ifdef H5
  1280. top: calc(var(--status-bar-height) + 44px + 20rpx);
  1281. // #endif
  1282. // #ifdef APP-PLUS
  1283. top: 30rpx,
  1284. // #endif
  1285. }
  1286. .mask {
  1287. width: 100%;
  1288. height: 100%;
  1289. position: fixed;
  1290. top: 0;
  1291. bottom: 0;
  1292. background-color: rgba(1, 1, 1, 0.3);
  1293. }
  1294. .orderItemsDelent {
  1295. position: absolute;
  1296. top: 15rpx;
  1297. right: 15rpx;
  1298. color: #fd4b09;
  1299. }
  1300. </style>