details.vue 36 KB

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