business_buy.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. <template>
  2. <view class="center">
  3. <view class="transaction">
  4. <view class="c-row b-b">
  5. <view class="title">卖方</view>
  6. <view class="con-list">
  7. <view v-if='goods.customerTypeFlag==2' class="title" @click="liang">{{purchaseOrder.compName?purchaseOrder.compName:goods.compName}}&nbsp></view>
  8. <view v-else class="title" @click="liang">{{purchaseOrder.customer?purchaseOrder.customer:goods.customerName}}></view>
  9. </view>
  10. </view>
  11. <view class="c-row">
  12. <view class="title">买方</view>
  13. <view class="con-list">
  14. <view class="title">{{purchaseOrder.buyer}}</view>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="transaction">
  19. <view class="c-row b-b margin-top">
  20. <view class="title">收货地区</view>
  21. <view class="con-list">
  22. <view class="title">{{purchaseOrder.receivePrivate}}{{purchaseOrder.receiveCity}}{{purchaseOrder.receiveArea}}</view>
  23. </view>
  24. </view>
  25. <view class="c-row b-b ">
  26. <view class="title">收货库</view>
  27. <view class="con-list">
  28. <view class="title">{{purchaseOrder.receiveWarehouse}}</view>
  29. </view>
  30. </view>
  31. <view v-if='companyId!=2' class="c-row b-b">
  32. <view class="title">货名</view>
  33. <view class="con-list">
  34. <text>{{purchaseOrder.goodsName}}</text>
  35. </view>
  36. </view>
  37. <view class="c-row b-b">
  38. <view class="title">最小成交量(吨)</view>
  39. <view class="con-list">
  40. <text>{{purchaseOrder.minimumVolume}}</text>
  41. </view>
  42. </view>
  43. <view v-if="purchaseOrder.procurementPlanType=='期货'" class="c-row">
  44. <view class="title">今日基差(元/吨)</view>
  45. <view class="con-list">
  46. <view class="picker">
  47. <text>{{purchaseOrder.basis}}</text>
  48. </view>
  49. </view>
  50. </view>
  51. <view v-else class="c-row ">
  52. <view class="title">采购单价(元/吨)</view>
  53. <view class="con-list">
  54. <view class="picker">
  55. <text>{{purchaseOrder.procurementPrice}}</text>
  56. </view>
  57. </view>
  58. </view>
  59. </view >
  60. <view class="transaction">
  61. <view class="c-row b-b margin-top">
  62. <view class="title">发票类型</view>
  63. <view class="con-list">
  64. <picker @change="invoiceChange" :value="invoiceIndex" :range="invoiceType">
  65. <view class="picker">
  66. {{invoiceIndex>-1?invoiceType[invoiceIndex]:'请选择'}}
  67. </view>
  68. </picker>
  69. </view>
  70. </view>
  71. <view class="c-row b-b">
  72. <view class="title">出售数量(吨)</view>
  73. <view class="con-list">
  74. <input v-model='purchaseOrder.transactionsNumber' placeholder="请填写出售数量" placeholder-style="font-size: 12px;" name="input"></input>
  75. </view>
  76. </view>
  77. <view class="c-row b-b">
  78. <view class="title">包装方式</view>
  79. <view class="con-list">
  80. <picker @change="packingChange" :value="packingIndex" :range="packingType">
  81. <view class="picker">
  82. {{packingIndex>-1?packingType[packingIndex]:'请选择'}}
  83. </view>
  84. </picker>
  85. </view>
  86. </view>
  87. <view v-if='packingIndex!=0' class=" beizhu align-start">
  88. <view class="title">袋装备注</view>
  89. <view >
  90. <textarea maxlength="-1" v-model='purchaseOrder.baggingNotes' placeholder="请填写包装规格、质量、包装物要求。例:50kg袋装、大粒、彩包" placeholder-style="font-size: 12px;" class="textareas"></textarea>
  91. </view>
  92. </view>
  93. <view v-if="purchaseOrder.procurementPlanType=='期货'" class="c-row b-b align-start">
  94. <view class="title">点价(元/吨)</view>
  95. <view class="con-list">
  96. <input placeholder="请填写点价" name="input" placeholder-style="font-size: 12px;" @input='someprice' v-model="purchaseOrder.pointPrice"></input>
  97. </view>
  98. </view>
  99. <view v-if="purchaseOrder.procurementPlanType=='期货'" class="c-row b-b align-start">
  100. <view class="title">发票费用(元/吨)</view>
  101. <view class="con-list">
  102. <input disabled placeholder="请填写发票费用" name="input" @input='someprice' v-model="purchaseOrder.invoiceFee"></input>
  103. </view>
  104. </view>
  105. <view v-if="purchaseOrder.procurementPlanType=='期货'" class="c-row b-b align-start">
  106. <view class="title">包装费(元/吨)</view>
  107. <view class="con-list">
  108. <input placeholder="请填写包装费" name="input" @input='someprice' v-model="purchaseOrder.packingFee"></input>
  109. </view>
  110. </view>
  111. <view v-if="purchaseOrder.procurementPlanType=='期货'" class=" align-start ">
  112. <view class="titles">结算价格</view>
  113. <text class="textA">结算价格=点价+基差+发票费用+包装费</text>
  114. <text style="font-size: 18px;color: #FD714F;margin-left: 25px;">¥{{purchaseOrder.settlementPrice}}</text>
  115. <!-- <input placeholder="请填写 例:袋装XX斤/散装" name="input" @input='packingInput' v-model="purchaseOrder.settlementPrice"></input> -->
  116. </view>
  117. </view>
  118. <button class="btn" @click="commit()">提交</button>
  119. </view>
  120. </template>
  121. <script>
  122. import {
  123. mapState
  124. } from 'vuex';
  125. export default {
  126. data() {
  127. return {
  128. tradeInfo:{
  129. salebuyId:0,
  130. packing:'',
  131. memo:'',
  132. buyer:'',
  133. buyerPhone:'',
  134. procurementPrice:0,
  135. address:'',
  136. count:0,
  137. province:'',
  138. area:'',
  139. priceType:'',
  140. invoiceType:'',
  141. acceptType:'',
  142. seller:'',
  143. sellerPhone:'',
  144. packingMoney:0,
  145. type:0,
  146. modalName:"",
  147. },
  148. purchaseOrder: {
  149. invoiceFee:0,
  150. packingFee:0,
  151. packingType:"散装",
  152. packingTypeKey:1,
  153. type:'不开发票',
  154. typeKey:1
  155. },
  156. invoiceTypeIndex:0,
  157. invoiceTypeIndex1:0,
  158. acceptTypeIndex:0,
  159. priceTypeIndex:0,
  160. bankNameIndex:0,
  161. packingIndex:0,
  162. invoiceIndex:0,
  163. packingType: ['散粮','大袋','小袋'],
  164. // invoiceType: ['不开发票', '普通发票', '增值税发票'],
  165. invoiceType: ['不开发票','增值税发票'],
  166. acceptType: ['第三方检验(国家检验资质)', '交收地库或港出具的检验', '现场看货','其他'],
  167. priceType: ['库内价', '到库价', '到港价'],
  168. priceTypeIndex1:'库内价',
  169. region: [],
  170. salebuyId:0,
  171. memo:'',
  172. buyer:'',
  173. buyerPhone:'',
  174. procurementPrice:0,
  175. address:'',
  176. count:0,
  177. id:0,
  178. price:'库内价',
  179. invoice:'不开发票',
  180. accept:'',
  181. seller:'',
  182. sellerPhone:'',
  183. minSale:'',
  184. province:'',
  185. city:'',
  186. area:'',
  187. storeName:'',
  188. exsitCount:0,
  189. isFutures:'',
  190. bankNameList:'',
  191. Company:[],
  192. goods:{},
  193. companyId:'',
  194. tradeCompanyId:'',
  195. basis:0,
  196. basisBig:0,
  197. basisSmall:0,
  198. invoiceMoney:0,
  199. unloadingFee:0,
  200. packingMoney:0,
  201. packing:'散装'
  202. };
  203. },
  204. onLoad(options) {
  205. this.id=options.id
  206. this.purchaseOrder.planId=options.id
  207. this.purchaseOrder.seller = options.seller
  208. this.purchaseOrder.goodsName = options.goodsName
  209. this.purchaseOrder.receivePrivate = options.receivePrivate
  210. this.purchaseOrder.receiveCity = options.receiveCity
  211. this.purchaseOrder.receiveArea = options.receiveArea
  212. this.purchaseOrder.minimumVolume = options.minimumVolume
  213. this.purchaseOrder.buyer = options.buyer
  214. this.purchaseOrder.customer = options.customerName
  215. this.purchaseOrder.basis = options.basisPrice
  216. this.purchaseOrder.procurementPrice = options.procurementPrice
  217. this.purchaseOrder.receiveWarehouse = options.receiveWarehouse
  218. this.purchaseOrder.settlementPrice = options.basisPrice
  219. this.purchaseOrder.procurementPlanType = options.procurementPlanType
  220. this.purchaseOrder.procurementPlan=options.procurementPlan
  221. this.purchaseOrder.compId=options.compId
  222. },
  223. computed: {
  224. ...mapState(['hasLogin','userInfo']),
  225. },
  226. onShow() {
  227. this.$api.doRequest('get', '/identityAuthenticationInfo/getInfo',{commonId:this.userInfo.id}).then(res => {
  228. if(res.data.code==200){
  229. this.goods=res.data.data
  230. if(this.goods.customerTypeFlag==1){
  231. this.purchaseOrder.invoiceFee=-20
  232. this.purchaseOrder.settlementPrice = Number(this.purchaseOrder.basis)+Number(this.purchaseOrder.invoiceFee)
  233. }else{
  234. this.purchaseOrder.invoiceFee=0
  235. this.purchaseOrder.settlementPrice = Number(this.purchaseOrder.basis)+Number(this.purchaseOrder.invoiceFee)
  236. }
  237. }
  238. uni.hideLoading()
  239. })
  240. },
  241. methods: {
  242. liang(){
  243. uni.navigateTo({
  244. url: `/pageA/product/Identity_switching?goodsName=${this.purchaseOrder.goodsName}
  245. &receivePrivate=${this.purchaseOrder.receivePrivate}&receiveCity=${this.purchaseOrder.receiveCity}
  246. &receiveArea=${this.purchaseOrder.receiveArea}&minimumVolume=${this.purchaseOrder.minimumVolume}
  247. &buyer=${this.purchaseOrder.buyer}&basisPrice=${this.purchaseOrder.basis}&procurementPrice=${this.purchaseOrder.procurementPrice}
  248. &receiveWarehouse=${this.purchaseOrder.receiveWarehouse}&procurementPlanType=${this.purchaseOrder.procurementPlanType}
  249. &procurementPlanNo=${this.purchaseOrder.procurementPlan}`
  250. })
  251. },
  252. commit(){
  253. if(!this.purchaseOrder.transactionsNumber){
  254. this.$api.msg('出售数量不能为空')
  255. return
  256. }
  257. if(this.purchaseOrder.transactionsNumber>10000||this.purchaseOrder.transactionsNumber<1){
  258. this.$api.msg('出售数量输入错误')
  259. return
  260. }
  261. if(this.purchaseOrder.procurementPlanType=='期货'&&!this.purchaseOrder.pointPrice){
  262. this.$api.msg('点价不能为空')
  263. return
  264. }
  265. if(this.purchaseOrder.procurementPlanType=='期货'&&this.purchaseOrder.pointPrice>10000){
  266. this.$api.msg('点价输入错误')
  267. return
  268. }
  269. if(this.purchaseOrder.procurementPlanType=='期货'&&this.purchaseOrder.pointPrice.indexOf('.')!=-1){
  270. if(this.purchaseOrder.pointPrice.split(".")[1].length>2){
  271. this.$api.msg('点价输入错误')
  272. return
  273. }
  274. }
  275. this.purchaseOrder.packingFee=-this.purchaseOrder.packingFee
  276. if(this.purchaseOrder.packingFee>0||this.purchaseOrder.packingFee<-2000){
  277. this.$api.msg('包装费输入错误')
  278. return
  279. }
  280. if(!this.purchaseOrder.customer){
  281. if(this.goods.customerTypeFlag==1){
  282. this.purchaseOrder.customer=this.goods.customerName
  283. }else{
  284. this.purchaseOrder.customer=this.goods.compName
  285. }
  286. }
  287. if(!this.purchaseOrder.seller){
  288. if(this.goods.customerTypeFlag==1){
  289. this.purchaseOrder.seller=this.goods.customerName
  290. this.purchaseOrder.sellerPhone=this.goods.customerPhone
  291. }else{
  292. this.purchaseOrder.seller=this.goods.compName
  293. this.purchaseOrder.sellerPhone=this.goods.customerPhone
  294. }
  295. }
  296. var that=this
  297. this.purchaseOrder.commonId=that.userInfo.id
  298. this.purchaseOrder.pcFlag=0
  299. if(this.purchaseOrder.procurementPlanType == "期货"){
  300. this.purchaseOrder.unitPrice = this.purchaseOrder.settlementPrice
  301. }
  302. uni.showModal({
  303. content: '订单提交后将发送给买方,是否确定提交?',
  304. success: function (res) {
  305. if (res.confirm) {
  306. that.$api.doRequest('post','/purchaseOrder/api/insertPurchaseOrder', that.purchaseOrder).then(res => {
  307. if(res.data.code==200){
  308. that.$api.doRequest('post','/purchaseOrder/api/submitPurchaseOrder', {id:res.data.data}).then(res1 => {
  309. if(res1.data.code==200){
  310. uni.navigateTo({
  311. url: `/pages/business/business`
  312. })
  313. uni.showToast({
  314. title: '提交成功,等待买方回复',
  315. icon: 'none',
  316. duration: 2000
  317. })
  318. }else{
  319. uni.showToast({
  320. title: res.data.message,
  321. icon: 'none',
  322. duration: 2000
  323. })
  324. }
  325. }).catch(res => {
  326. uni.showToast({
  327. title: res.data.message,
  328. icon: 'none',
  329. duration: 2000
  330. })
  331. })
  332. // uni.navigateBack();
  333. }else{
  334. uni.showToast({
  335. title: '提交失败:'+res.data.message,
  336. icon: 'none',
  337. duration: 2000
  338. })
  339. }
  340. }).catch(res => {
  341. if(res.errmsg){
  342. uni.showToast({
  343. title: res.errmsg,
  344. icon: 'none',
  345. duration: 2000
  346. })
  347. }
  348. else{
  349. uni.showToast({
  350. title: "系统异常,请联系管理员",
  351. icon: 'none',
  352. duration: 2000
  353. })
  354. }
  355. })
  356. }
  357. }
  358. })
  359. },
  360. someprice(e){
  361. if(this.purchaseOrder.pointPrice&&this.purchaseOrder.invoiceFee&&this.purchaseOrder.packingFee){
  362. this.purchaseOrder.settlementPrice=Number(this.purchaseOrder.basis)+Number(this.purchaseOrder.pointPrice)+Number(this.purchaseOrder.invoiceFee)+Number(-this.purchaseOrder.packingFee)
  363. }else if(this.purchaseOrder.pointPrice&&this.purchaseOrder.invoiceFee){
  364. this.purchaseOrder.settlementPrice=Number(this.purchaseOrder.basis)+Number(this.purchaseOrder.pointPrice)+Number(this.purchaseOrder.invoiceFee)
  365. }else if(this.purchaseOrder.pointPrice&&this.purchaseOrder.packingFee){
  366. this.purchaseOrder.settlementPrice=Number(this.purchaseOrder.basis)+Number(this.purchaseOrder.pointPrice)+Number(-this.purchaseOrder.packingFee)
  367. }else if(this.purchaseOrder.pointPrice){
  368. this.purchaseOrder.settlementPrice=Number(this.purchaseOrder.basis)+Number(this.purchaseOrder.pointPrice)
  369. }else if(this.purchaseOrder.packingFee){
  370. this.purchaseOrder.settlementPrice=Number(this.purchaseOrder.basis)+Number(-this.purchaseOrder.packingFee)
  371. }else if(this.purchaseOrder.invoiceFee){
  372. this.purchaseOrder.settlementPrice=Number(this.purchaseOrder.basis)+Number(this.purchaseOrder.invoiceFee)
  373. }else{
  374. this.purchaseOrder.settlementPrice=this.purchaseOrder.basis
  375. }
  376. },
  377. bankNameChange(e){
  378. this.bankNameIndex=e.detail.value
  379. this.buyer =this.Company[e.detail.value].companyName
  380. this.buyerPhone=this.Company[e.detail.value].companyPhone
  381. this.tradeCompanyId=this.Company[e.detail.value].id
  382. },
  383. AcceptTypeChange(e) {
  384. this.acceptTypeIndex = e.detail.value
  385. this.accept = this.acceptType[this.acceptTypeIndex];
  386. },
  387. packingChange(e){
  388. this.packingIndex = e.detail.value
  389. this.purchaseOrder.packingTypeKey=e.detail.value+1
  390. this.purchaseOrder.packingType = this.packingType[this.packingIndex];
  391. },
  392. invoiceChange(e){
  393. this.invoiceIndex = e.detail.value
  394. this.purchaseOrder.typeKey=e.detail.value+1
  395. this.purchaseOrder.type = this.invoiceType[this.invoiceIndex];
  396. if(this.invoiceIndex == 0){
  397. if(this.goods.customerTypeFlag==1){
  398. this.purchaseOrder.invoiceFee=-20
  399. }else{
  400. this.purchaseOrder.invoiceFee=0
  401. }
  402. }
  403. else{
  404. this.purchaseOrder.invoiceFee=0
  405. }
  406. },
  407. changeZhihang(){
  408. uni.navigateTo({
  409. url: '/pageA/pages/newcompany'
  410. })
  411. },
  412. PriceTypeChange(e) {
  413. this.priceTypeIndex = e.detail.value
  414. this.price = this.priceType[this.priceTypeIndex]
  415. },
  416. RegionChange(e) {
  417. this.region = e.detail.value
  418. this.province = this.region[0];
  419. this.area = this.region[0]+this.region[1]+this.region[2];
  420. },
  421. textareaInput(e) {
  422. this.memo = e.detail.value
  423. },
  424. buyerInput(e){
  425. this.buyer = e.detail.value
  426. },
  427. buyerPhoneInput(e){
  428. this.buyerPhone = e.detail.value
  429. },
  430. addressInput(e){
  431. this.address = e.detail.value
  432. },
  433. countInput(e){
  434. this.count = e.detail.value
  435. },
  436. }
  437. }
  438. </script>
  439. <style scoped>
  440. .center {
  441. padding: 10px 20px;
  442. background-color: #F5F6FA;
  443. }
  444. .cu-form-group input {
  445. text-align: right;
  446. }
  447. .cu-form-group textarea {
  448. text-align: right;
  449. }
  450. .margin-bottom{
  451. margin-bottom:30px;
  452. }
  453. .c-row {
  454. display: -webkit-box;
  455. display: -webkit-flex;
  456. display: flex;
  457. -webkit-box-align: center;
  458. -webkit-align-items: center;
  459. align-items: center;
  460. padding: 20rpx 30rpx;
  461. position: relative;
  462. }
  463. .con-list {
  464. -webkit-box-flex: 1;
  465. -webkit-flex: 1;
  466. flex: 1;
  467. display: -webkit-box;
  468. display: -webkit-flex;
  469. display: flex;
  470. -webkit-box-orient: vertical;
  471. -webkit-box-direction: normal;
  472. -webkit-flex-direction: column;
  473. flex-direction: column;
  474. color: #303133;
  475. line-height: 40rpx;
  476. text-align: right;
  477. padding-right: 20rpx;
  478. }
  479. .transaction{
  480. background-color: #FFFFFF;
  481. margin-top: 10px;
  482. padding-bottom: 10px;
  483. border-radius: 20px;
  484. }
  485. .btn{
  486. width: 100%;
  487. background-color: #22C572;
  488. border-radius: 20px;
  489. margin-top: 10px;
  490. }
  491. .textareas{
  492. width: 95%;
  493. background-color: #F9F9FA;
  494. padding: 10px 20px 0px 20px;
  495. border-radius: 10px;
  496. }
  497. .beizhu{
  498. margin-left: 15px;
  499. margin-bottom: 20px;
  500. /* margin: 10px; */
  501. margin-top: 10px;
  502. }
  503. .titles{
  504. margin-left: 20px;
  505. margin-top: 10px;
  506. }
  507. .textA{
  508. margin-left: 20px;
  509. color: #AFB3BF;
  510. font-size: 10px;
  511. }
  512. </style>