business_sale.vue 15 KB

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