business_sale.vue 16 KB

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