business_buy.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  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. console.log(res)
  342. uni.showToast({
  343. title: res.errMsg,
  344. icon: 'none',
  345. duration: 2000
  346. })
  347. })
  348. }
  349. }
  350. })
  351. },
  352. someprice(e){
  353. if(this.purchaseOrder.pointPrice&&this.purchaseOrder.invoiceFee&&this.purchaseOrder.packingFee){
  354. this.purchaseOrder.settlementPrice=Number(this.purchaseOrder.basis)+Number(this.purchaseOrder.pointPrice)+Number(this.purchaseOrder.invoiceFee)+Number(-this.purchaseOrder.packingFee)
  355. }else if(this.purchaseOrder.pointPrice&&this.purchaseOrder.invoiceFee){
  356. this.purchaseOrder.settlementPrice=Number(this.purchaseOrder.basis)+Number(this.purchaseOrder.pointPrice)+Number(this.purchaseOrder.invoiceFee)
  357. }else if(this.purchaseOrder.pointPrice&&this.purchaseOrder.packingFee){
  358. this.purchaseOrder.settlementPrice=Number(this.purchaseOrder.basis)+Number(this.purchaseOrder.pointPrice)+Number(-this.purchaseOrder.packingFee)
  359. }else if(this.purchaseOrder.pointPrice){
  360. this.purchaseOrder.settlementPrice=Number(this.purchaseOrder.basis)+Number(this.purchaseOrder.pointPrice)
  361. }else if(this.purchaseOrder.packingFee){
  362. this.purchaseOrder.settlementPrice=Number(this.purchaseOrder.basis)+Number(-this.purchaseOrder.packingFee)
  363. }else if(this.purchaseOrder.invoiceFee){
  364. this.purchaseOrder.settlementPrice=Number(this.purchaseOrder.basis)+Number(this.purchaseOrder.invoiceFee)
  365. }else{
  366. this.purchaseOrder.settlementPrice=this.purchaseOrder.basis
  367. }
  368. },
  369. bankNameChange(e){
  370. this.bankNameIndex=e.detail.value
  371. this.buyer =this.Company[e.detail.value].companyName
  372. this.buyerPhone=this.Company[e.detail.value].companyPhone
  373. this.tradeCompanyId=this.Company[e.detail.value].id
  374. },
  375. AcceptTypeChange(e) {
  376. this.acceptTypeIndex = e.detail.value
  377. this.accept = this.acceptType[this.acceptTypeIndex];
  378. },
  379. packingChange(e){
  380. this.packingIndex = e.detail.value
  381. this.purchaseOrder.packingTypeKey=e.detail.value+1
  382. this.purchaseOrder.packingType = this.packingType[this.packingIndex];
  383. },
  384. invoiceChange(e){
  385. this.invoiceIndex = e.detail.value
  386. this.purchaseOrder.typeKey=e.detail.value+1
  387. this.purchaseOrder.type = this.invoiceType[this.invoiceIndex];
  388. if(this.invoiceIndex == 0){
  389. if(this.goods.customerTypeFlag==1){
  390. this.purchaseOrder.invoiceFee=-20
  391. }else{
  392. this.purchaseOrder.invoiceFee=0
  393. }
  394. }
  395. else{
  396. this.purchaseOrder.invoiceFee=0
  397. }
  398. },
  399. changeZhihang(){
  400. uni.navigateTo({
  401. url: '/pageA/pages/newcompany'
  402. })
  403. },
  404. PriceTypeChange(e) {
  405. this.priceTypeIndex = e.detail.value
  406. this.price = this.priceType[this.priceTypeIndex]
  407. },
  408. RegionChange(e) {
  409. this.region = e.detail.value
  410. this.province = this.region[0];
  411. this.area = this.region[0]+this.region[1]+this.region[2];
  412. },
  413. textareaInput(e) {
  414. this.memo = e.detail.value
  415. },
  416. buyerInput(e){
  417. this.buyer = e.detail.value
  418. },
  419. buyerPhoneInput(e){
  420. this.buyerPhone = e.detail.value
  421. },
  422. addressInput(e){
  423. this.address = e.detail.value
  424. },
  425. countInput(e){
  426. this.count = e.detail.value
  427. },
  428. }
  429. }
  430. </script>
  431. <style scoped>
  432. .center {
  433. padding: 10px 20px;
  434. background-color: #F5F6FA;
  435. }
  436. .cu-form-group input {
  437. text-align: right;
  438. }
  439. .cu-form-group textarea {
  440. text-align: right;
  441. }
  442. .margin-bottom{
  443. margin-bottom:30px;
  444. }
  445. .c-row {
  446. display: -webkit-box;
  447. display: -webkit-flex;
  448. display: flex;
  449. -webkit-box-align: center;
  450. -webkit-align-items: center;
  451. align-items: center;
  452. padding: 20rpx 30rpx;
  453. position: relative;
  454. }
  455. .con-list {
  456. -webkit-box-flex: 1;
  457. -webkit-flex: 1;
  458. flex: 1;
  459. display: -webkit-box;
  460. display: -webkit-flex;
  461. display: flex;
  462. -webkit-box-orient: vertical;
  463. -webkit-box-direction: normal;
  464. -webkit-flex-direction: column;
  465. flex-direction: column;
  466. color: #303133;
  467. line-height: 40rpx;
  468. text-align: right;
  469. padding-right: 20rpx;
  470. }
  471. .transaction{
  472. background-color: #FFFFFF;
  473. margin-top: 10px;
  474. padding-bottom: 10px;
  475. border-radius: 20px;
  476. }
  477. .btn{
  478. width: 100%;
  479. background-color: #22C572;
  480. border-radius: 20px;
  481. margin-top: 10px;
  482. }
  483. .textareas{
  484. width: 95%;
  485. background-color: #F9F9FA;
  486. padding: 10px 20px 0px 20px;
  487. border-radius: 10px;
  488. }
  489. .beizhu{
  490. margin-left: 15px;
  491. margin-bottom: 20px;
  492. /* margin: 10px; */
  493. margin-top: 10px;
  494. }
  495. .titles{
  496. margin-left: 20px;
  497. margin-top: 10px;
  498. }
  499. .textA{
  500. margin-left: 20px;
  501. color: #AFB3BF;
  502. font-size: 10px;
  503. }
  504. </style>