sale_trade.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. <template>
  2. <view class="container">
  3. <view class="detail-desc">
  4. <view class="c-list">
  5. <view class="c-row b-b">
  6. <text class="tit">卖方</text>
  7. <view class="con-list">
  8. <view v-if='goods.customerTypeFlag==1' class="title">{{goods.customerName}}</view>
  9. <view v-if='goods.customerTypeFlag==2' class="title">{{goods.compName}}</view>
  10. </view>
  11. </view>
  12. <view class="c-row">
  13. <text class="tit">买方</text>
  14. <view class="con-list">
  15. <view class="title">{{seller}}</view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="detail-desc">
  21. <view class="c-list">
  22. <view class="c-row b-b">
  23. <text class="tit">收货地区</text>
  24. <view class="con-list">
  25. <view class="title">{{receivePrivate}}{{receiveCity}}{{receiveArea}}</view>
  26. </view>
  27. </view>
  28. <view v-if='pcFlag==1' class="c-row b-b">
  29. <text class="tit">收货库</text>
  30. <view class="con-list">
  31. <view class="title">{{receiveWarehouse}}</view>
  32. </view>
  33. </view>
  34. <view class="c-row b-b">
  35. <text class="tit">货名</text>
  36. <view class="con-list">
  37. <view class="title">{{goodsName}}</view>
  38. </view>
  39. </view>
  40. <view class="c-row b-b">
  41. <text class="tit">最小成交量(吨)</text>
  42. <view class="con-list">
  43. <view class="title">{{minimumVolume}}</view>
  44. </view>
  45. </view>
  46. <view class="c-row">
  47. <text class="tit">今日基差(元/吨)</text>
  48. <view class="con-list">
  49. <view class="title">{{basisPrice}}</view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="detail-desc">
  55. <view class="c-list">
  56. <view class="c-row b-b">
  57. <text class="tit">发票类型</text>
  58. <picker style="text-align:right;" @change="InvoiceTypeChange1" :value="invoiceTypeIndex1" :range="invoiceType1">
  59. <view class="picker">
  60. {{invoiceTypeIndex1>-1?invoiceType1[invoiceTypeIndex1]:'请选择'}}
  61. </view>
  62. </picker>
  63. </view>
  64. <view class="c-row b-b">
  65. <text class="tit">出售数量(吨)<text style='color:#FC3535;'>*</text></text>
  66. <view class="con-list">
  67. <input v-model='list.transactionsNumber' type="digit">
  68. </view>
  69. </view>
  70. <view class="c-row b-b">
  71. <text class="tit">发票类型</text>
  72. <picker style="text-align:right;" @change="packingChange" :value="packingIndex" :range="packingType">
  73. <view class="picker">
  74. {{packingIndex>-1?packingType[packingIndex]:'请选择'}}
  75. </view>
  76. </picker>
  77. </view>
  78. <view class='b-b' style='padding:10px 15px;'>
  79. <text class="tit">袋装备注</text>
  80. <view style='position:relative;' class='con-list'>
  81. <textarea maxlength='30' v-model='list.baggingNotes' placeholder="请输入袋装备注,如王中王彩袋,49公斤,大粒" class='textarea' name="" id="" cols="30" rows="3"></textarea>
  82. <text style='position:absolute;right:0;bottom:2px;'>{{list.baggingNotes.length}}/30个字</text>
  83. </view>
  84. </view>
  85. <view class="c-row b-b">
  86. <text class="tit">点价(元/吨)<text style='color:#FC3535;'>*</text></text>
  87. <view class="con-list">
  88. <input v-model='list.pointPrice' placeholder="请输入出售数量" type="digit">
  89. </view>
  90. </view>
  91. <view v-if='invoiceTypeIndex1==0&&goods.customerTypeFlag==1' class="c-row b-b">
  92. <text class="tit">发票费用(元/吨)</text>
  93. <view class="con-list">
  94. <input disabled value='-20' placeholder="请输入出售数量" type="digit">
  95. </view>
  96. </view>
  97. <view class="c-row b-b">
  98. <text class="tit">包装费(元/吨)</text>
  99. <view class="con-list">
  100. <input v-model='list.packingFee' placeholder="请输入包装费" type="digit">
  101. </view>
  102. </view>
  103. <view style='padding:10px 15px;'>
  104. <view class='flex justify-between'>
  105. <text class="tit">结算价格(元/吨)</text>
  106. <view class="con-list">
  107. <input disabled v-model='list.settlementPrice' placeholder="请输入包装费" type="digit">
  108. </view>
  109. </view>
  110. <view style='font-size:11px;color:#AFB3BF;'>结算价格=点价+基差+发票费用+包装费</view>
  111. </view>
  112. </view>
  113. </view>
  114. <!-- <view v-if='isFutures==0' class="cu-form-group margin-top margin-bottom">
  115. <view class="title">质量验收方式</view>
  116. <picker @change="AcceptTypeChange" :value="acceptTypeIndex" :range="acceptType">
  117. <view class="picker">
  118. {{acceptTypeIndex>-1?acceptType[acceptTypeIndex]:'请选择'}}
  119. </view>
  120. </picker>
  121. </view> -->
  122. <view class="padding flex flex-direction">
  123. <button class="cu-btn bg-red margin-tb-sm lg" @click="commit">提交</button>
  124. </view>
  125. </view>
  126. </template>
  127. <script>
  128. export default {
  129. data() {
  130. return {
  131. goodsName:'',
  132. goods:{},
  133. receiveWarehouse:'',
  134. receivePrivate:'',
  135. receiveCity:'',
  136. receiveArea:'',
  137. minimumVolume:0,
  138. basisPrice:0,
  139. pcFlag:0,
  140. list:{
  141. transactionsNumber:0,
  142. baggingNotes:'',
  143. pointPrice:0,
  144. packingFee:'',
  145. settlementPrice:0
  146. },
  147. invoiceTypeIndex:0,
  148. invoiceTypeIndex1:0,
  149. acceptTypeIndex:0,
  150. priceTypeIndex:0,
  151. bankNameIndex:0,
  152. packingIndex:0,
  153. packingType: ['散装', '大装','小袋'],
  154. invoiceType: ['不开发票', '普通发票', '增值税发票'],
  155. invoiceType1: ['不开发票','增值税发票'],
  156. acceptType: ['第三方检验(国家检验资质)', '交收地库或港出具的检验', '现场看货','其他'],
  157. priceType: ['库内价', '到库价', '到港价'],
  158. priceTypeIndex1:'库内价',
  159. region: [],
  160. id:0,
  161. packing:'',
  162. memo:'',
  163. buyer:'',
  164. buyerPhone:'',
  165. unitPrice:0,
  166. address:'',
  167. count:0,
  168. price:'库内价',
  169. invoice:'不开发票',
  170. accept:'',
  171. seller:'',
  172. sellerPhone:'',
  173. minSale:'',
  174. province:'',
  175. city:'',
  176. area:'',
  177. storeName:'',
  178. exsitCount:0,
  179. isFutures:'',
  180. bankNameList:'',
  181. Company:[],
  182. companyId:'',
  183. tradeCompanyId:'',
  184. basis:0,
  185. basisBig:0,
  186. basisSmall:0,
  187. invoiceMoney:0,
  188. unloadingFee:0,
  189. packingMoney:0,
  190. packingIndex:0,
  191. packing:'散装'
  192. };
  193. },
  194. onLoad(options) {
  195. this.receiveWarehouse=options.receiveWarehouse
  196. this.receivePrivate=options.receivePrivate
  197. this.receiveCity=options.receiveCity
  198. this.receiveArea=options.receiveArea
  199. this.minimumVolume=options.minimumVolume
  200. this.basisPrice=options.basisPrice
  201. this.id = options.id
  202. this.pcFlag = options.pcFlag
  203. this.goodsName = options.goodsName
  204. this.seller = options.seller
  205. this.isFutures = options.isFutures
  206. this.minSale = options.minSale
  207. this.companyId=options.companyId
  208. this.province = options.province
  209. this.city = options.city
  210. this.area = options.area
  211. this.storeName=options.storeName
  212. this.exsitCount = Math.floor(options.exsitCount * 100) / 100
  213. this.basis = options.basis
  214. this.basisBig = options.basisBig
  215. this.basisSmall = options.basisSmall
  216. this.unloadingFee = options.unloadingFee
  217. },
  218. onShow() {
  219. this.$api.doRequest('get', '/identityAuthenticationInfo/getInfo',{commonId:111111}).then(res => {
  220. if(res.data.code==200){
  221. this.goods=res.data.data
  222. }
  223. uni.hideLoading()
  224. })
  225. // var that=this
  226. // this.$api.request('company', 'getCompany', failres => {
  227. // that.$api.msg(failres.errmsg)
  228. // uni.hideLoading()
  229. // }).then(res => {
  230. // if(res.data.code=='SUCCESS'){
  231. // var data=[]
  232. // this.Company=res.data.data
  233. // if(res.data.data){
  234. // for(let i=0;i<res.data.data.length;i++){
  235. // data.push(res.data.data[i].companyName+' '+res.data.data[i].companyPhone)
  236. // }
  237. // }
  238. // if(this.Company){
  239. // this.buyer =this.Company[0].companyName
  240. // this.buyerPhone=this.Company[0].companyPhone
  241. // this.tradeCompanyId=this.Company[0].id
  242. // }
  243. // that.bankNameList=data
  244. // uni.hideLoading()
  245. // }else{
  246. // that.$api.msg(res.data.code)
  247. // uni.hideLoading()
  248. // }
  249. // })
  250. // uni.getLocation({
  251. // type: 'wgs84',
  252. // geocode:true,
  253. // success: function (res) {
  254. // console.log('当前位置的经度:' + res.longitude);
  255. // console.log('当前位置的纬度:' + res.latitude);
  256. // }
  257. // });
  258. },
  259. methods: {
  260. InvoiceTypeChange(e) {
  261. this.invoiceTypeIndex = e.detail.value
  262. this.invoice = this.invoiceType[this.invoiceTypeIndex];
  263. },
  264. InvoiceTypeChange1(e) {
  265. this.invoiceTypeIndex1 = e.detail.value
  266. this.invoice = this.invoiceType1[this.invoiceTypeIndex1];
  267. if(this.invoiceTypeIndex1 == 0){
  268. this.invoiceMoney = 0
  269. }
  270. else{
  271. this.invoiceMoney = 20
  272. }
  273. },
  274. bankNameChange(e){
  275. this.bankNameIndex=e.detail.value
  276. this.buyer =this.Company[e.detail.value].companyName
  277. this.buyerPhone=this.Company[e.detail.value].companyPhone
  278. this.tradeCompanyId=this.Company[e.detail.value].id
  279. },
  280. AcceptTypeChange(e) {
  281. this.acceptTypeIndex = e.detail.value
  282. this.accept = this.acceptType[this.acceptTypeIndex];
  283. },
  284. packingChange(e){
  285. this.packingIndex = e.detail.value
  286. this.packing = this.packingType[this.packingIndex];
  287. if(this.packingIndex == 0){
  288. this.packingMoney = 0
  289. }
  290. else if(this.packingIndex == 1){
  291. this.packingMoney = this.basisBig - this.basis
  292. }
  293. else if(this.packingIndex == 2){
  294. this.packingMoney = this.basisSmall - this.basis
  295. }
  296. },
  297. changeZhihang(){
  298. uni.navigateTo({
  299. url: '/pageA/pages/newcompany'
  300. })
  301. },
  302. PriceTypeChange(e) {
  303. this.priceTypeIndex = e.detail.value
  304. this.price = this.priceType[this.priceTypeIndex]
  305. },
  306. RegionChange(e) {
  307. this.region = e.detail.value
  308. this.province = this.region[0];
  309. this.area = this.region[0]+this.region[1]+this.region[2];
  310. },
  311. textareaInput(e) {
  312. this.memo = e.detail.value
  313. },
  314. packingInput(e){
  315. this.packing = e.detail.value
  316. },
  317. buyerInput(e){
  318. this.buyer = e.detail.value
  319. },
  320. buyerPhoneInput(e){
  321. this.buyerPhone = e.detail.value
  322. },
  323. unitPriceInput(e){
  324. this.unitPrice = e.detail.value
  325. },
  326. addressInput(e){
  327. this.address = e.detail.value
  328. },
  329. countInput(e){
  330. this.count = e.detail.value
  331. },
  332. commit(){
  333. const that = this
  334. if ( that.companyId !=2 && !that.area ) {
  335. that.$api.msg('请选择省市区');
  336. return
  337. }
  338. if ( that.companyId !=2&& !that.address) {
  339. that.$api.msg('请填写详细交收地址')
  340. return
  341. }
  342. if (!that.price) {
  343. that.$api.msg('请选择价格类型')
  344. return
  345. }
  346. if (!that.invoice) {
  347. that.$api.msg('请选择发票类型')
  348. return
  349. }
  350. // if(!that.accept&&that.isFutures==0){
  351. // that.$api.msg('请选择质量验收方式');
  352. // return
  353. // }
  354. if(!that.unitPrice){
  355. that.$api.msg('请填写协议价格(元/吨)');
  356. return
  357. }
  358. if(!that.count){
  359. that.$api.msg('请填写购买数量(吨)');
  360. return
  361. }
  362. if(Number(that.count) < Number(that.minSale)){
  363. that.$api.msg('购买数量不能小于最小成交量');
  364. return
  365. }
  366. if(!that.tradeCompanyId){
  367. that.$api.msg('请选择公司名头');
  368. return
  369. }
  370. // if(that.count > that.exsitCount){
  371. // that.$api.msg('购买数量大于库存量');
  372. // return
  373. // }
  374. //this.$api.prePage()获取上一页实例,可直接调用上页所有数据和方法,在App.vue定义
  375. //this.$api.msg(`地址${this.manageType=='edit' ? '修改': '添加'}成功`);
  376. that.tradeInfo.salebuyId = that.salebuyId
  377. that.tradeInfo.buyer = that.buyer
  378. that.tradeInfo.buyerPhone = that.buyerPhone
  379. that.tradeInfo.priceType = that.price
  380. that.tradeInfo.unitPrice = that.unitPrice
  381. that.tradeInfo.province = that.province
  382. that.tradeInfo.area = that.area
  383. that.tradeInfo.address = that.address
  384. that.tradeInfo.count = that.count
  385. that.tradeInfo.acceptType = that.accept
  386. that.tradeInfo.invoiceType = that.invoice
  387. that.tradeInfo.packing = that.packing
  388. that.tradeInfo.packingMoney = that.packingMoney
  389. that.tradeInfo.memo = that.memo
  390. that.tradeInfo.seller = that.seller
  391. that.tradeInfo.sellerPhone = that.sellerPhone
  392. that.tradeInfo.tradeCompanyId = that.tradeCompanyId
  393. that.tradeInfo.invoiceMoney = that.invoiceMoney
  394. // that.tradeInfo.unloadingFee = that.unloadingFee
  395. uni.showLoading({
  396. title: '正在提交',
  397. mask:true
  398. })
  399. that.$api.request('trade', 'addTrade',that.tradeInfo, failres => {
  400. uni.hideLoading()
  401. if(failres.errmsg){
  402. uni.showToast({
  403. title: failres.errmsg,
  404. icon: 'none',
  405. duration: 2000
  406. })
  407. }
  408. else{
  409. uni.showToast({
  410. title: "系统异常,请联系管理员",
  411. icon: 'none',
  412. duration: 2000
  413. })
  414. }
  415. }).then(res => {
  416. uni.hideLoading()
  417. uni.showModal({
  418. title: '提示',
  419. content: "交易申请提交成功",
  420. showCancel: false,
  421. confirmText: '确定',
  422. success: () => {
  423. uni.navigateBack({
  424. delta: 2
  425. })
  426. }
  427. })
  428. // that.$api.prePage().refreshList(data, that.manageType);
  429. })
  430. }
  431. }
  432. }
  433. </script>
  434. <style scoped>
  435. .cu-form-group input {
  436. text-align: right;
  437. }
  438. .cu-form-group textarea {
  439. text-align: right;
  440. }
  441. .margin-bottom{
  442. margin-bottom:30px;
  443. }
  444. .c-row {
  445. display: -webkit-box;
  446. display: -webkit-flex;
  447. display: flex;
  448. -webkit-box-align: center;
  449. -webkit-align-items: center;
  450. align-items: center;
  451. padding: 20rpx 30rpx;
  452. position: relative;
  453. }
  454. .con-list {
  455. -webkit-box-flex: 1;
  456. -webkit-flex: 1;
  457. flex: 1;
  458. display: -webkit-box;
  459. display: -webkit-flex;
  460. display: flex;
  461. -webkit-box-orient: vertical;
  462. -webkit-box-direction: normal;
  463. -webkit-flex-direction: column;
  464. flex-direction: column;
  465. color: #303133;
  466. line-height: 40rpx;
  467. text-align: right;
  468. padding-right: 20rpx;
  469. }
  470. /* 详情 */
  471. .detail-desc {
  472. background: #fff;
  473. margin-top: 16upx;
  474. margin:10px;
  475. position:relative;
  476. z-index:4;
  477. border-radius:5px;
  478. .d-header {
  479. display: flex;
  480. padding:10px;
  481. font-size: $font-base + 2upx;
  482. color: $font-color-dark;
  483. position: relative;
  484. border-bottom:1px solid #EEEEEE;
  485. text {
  486. padding: 0 20upx;
  487. position: relative;
  488. z-index: 1;
  489. }
  490. }
  491. }
  492. .c-list picker .picker {
  493. line-height: 80rpx;
  494. font-size: 24rpx;
  495. text-overflow: ellipsis;
  496. white-space: nowrap;
  497. overflow: hidden;
  498. width: 100%;
  499. text-align: right;
  500. }
  501. .c-list picker {
  502. -webkit-box-flex: 1;
  503. -webkit-flex: 1;
  504. flex: 1;
  505. padding-right: 10px;
  506. overflow: hidden;
  507. position: relative;
  508. }
  509. .c-list {
  510. font-size: $font-sm + 2upx;
  511. color: $font-color-base;
  512. background: #fff;
  513. .c-row {
  514. display: flex;
  515. align-items: center;
  516. padding: 20upx 30upx;
  517. position: relative;
  518. }
  519. .tit {
  520. width: 220upx;
  521. }
  522. .con {
  523. flex: 1;
  524. color: $font-color-dark;
  525. .selected-text {
  526. margin-right: 10upx;
  527. }
  528. }
  529. .bz-list {
  530. height: 40upx;
  531. font-size: $font-sm+2upx;
  532. color: $font-color-dark;
  533. text {
  534. display: inline-block;
  535. margin-right: 30upx;
  536. }
  537. }
  538. .con-list {
  539. flex: 1;
  540. display: flex;
  541. flex-direction: column;
  542. color: $font-color-dark;
  543. line-height: 40upx;
  544. text-align: right;
  545. padding-right: 20upx;
  546. }
  547. .red {
  548. color: $uni-color-primary;
  549. }
  550. }
  551. .textarea{
  552. background:#F9F9FA;
  553. font-size:12px;
  554. text-align:left;
  555. width:100%;
  556. height:60px;
  557. padding:10px;
  558. border-radius:5px;
  559. margin-top:10px;
  560. }
  561. </style>