trade.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  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 v-if='' 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. procurementPlanType:'',
  138. minimumVolume:0,
  139. basisPrice:0,
  140. pcFlag:0,
  141. list:{
  142. transactionsNumber:0,
  143. baggingNotes:'',
  144. pointPrice:0,
  145. packingFee:'',
  146. settlementPrice:0
  147. },
  148. invoiceTypeIndex:0,
  149. invoiceTypeIndex1:0,
  150. acceptTypeIndex:0,
  151. priceTypeIndex:0,
  152. bankNameIndex:0,
  153. packingIndex:0,
  154. packingType: ['散装', '大装','小袋'],
  155. invoiceType: ['不开发票', '普通发票', '增值税发票'],
  156. invoiceType1: ['不开发票','增值税发票'],
  157. acceptType: ['第三方检验(国家检验资质)', '交收地库或港出具的检验', '现场看货','其他'],
  158. priceType: ['库内价', '到库价', '到港价'],
  159. priceTypeIndex1:'库内价',
  160. region: [],
  161. id:0,
  162. packing:'',
  163. memo:'',
  164. buyer:'',
  165. buyerPhone:'',
  166. unitPrice:0,
  167. address:'',
  168. count:0,
  169. price:'库内价',
  170. invoice:'不开发票',
  171. accept:'',
  172. seller:'',
  173. sellerPhone:'',
  174. minSale:'',
  175. province:'',
  176. city:'',
  177. area:'',
  178. storeName:'',
  179. exsitCount:0,
  180. isFutures:'',
  181. bankNameList:'',
  182. Company:[],
  183. companyId:'',
  184. tradeCompanyId:'',
  185. basis:0,
  186. basisBig:0,
  187. basisSmall:0,
  188. invoiceMoney:0,
  189. unloadingFee:0,
  190. packingMoney:0,
  191. packingIndex:0,
  192. packing:'散装'
  193. };
  194. },
  195. onLoad(options) {
  196. this.procurementPlanType = options.procurementPlanType
  197. this.receiveWarehouse=options.receiveWarehouse
  198. this.receivePrivate=options.receivePrivate
  199. this.receiveCity=options.receiveCity
  200. this.receiveArea=options.receiveArea
  201. this.minimumVolume=options.minimumVolume
  202. this.basisPrice=options.basisPrice
  203. this.id = options.id
  204. this.pcFlag = options.pcFlag
  205. this.goodsName = options.goodsName
  206. this.seller = options.seller
  207. this.isFutures = options.isFutures
  208. this.minSale = options.minSale
  209. this.companyId=options.companyId
  210. this.province = options.province
  211. this.city = options.city
  212. this.area = options.area
  213. this.storeName=options.storeName
  214. this.exsitCount = Math.floor(options.exsitCount * 100) / 100
  215. this.basis = options.basis
  216. this.basisBig = options.basisBig
  217. this.basisSmall = options.basisSmall
  218. this.unloadingFee = options.unloadingFee
  219. },
  220. onShow() {
  221. this.$api.doRequest('get', '/identityAuthenticationInfo/getInfo',{commonId:111111}).then(res => {
  222. if(res.data.code==200){
  223. this.goods=res.data.data
  224. }
  225. uni.hideLoading()
  226. })
  227. // var that=this
  228. // this.$api.request('company', 'getCompany', failres => {
  229. // that.$api.msg(failres.errmsg)
  230. // uni.hideLoading()
  231. // }).then(res => {
  232. // if(res.data.code=='SUCCESS'){
  233. // var data=[]
  234. // this.Company=res.data.data
  235. // if(res.data.data){
  236. // for(let i=0;i<res.data.data.length;i++){
  237. // data.push(res.data.data[i].companyName+' '+res.data.data[i].companyPhone)
  238. // }
  239. // }
  240. // if(this.Company){
  241. // this.buyer =this.Company[0].companyName
  242. // this.buyerPhone=this.Company[0].companyPhone
  243. // this.tradeCompanyId=this.Company[0].id
  244. // }
  245. // that.bankNameList=data
  246. // uni.hideLoading()
  247. // }else{
  248. // that.$api.msg(res.data.code)
  249. // uni.hideLoading()
  250. // }
  251. // })
  252. // uni.getLocation({
  253. // type: 'wgs84',
  254. // geocode:true,
  255. // success: function (res) {
  256. // console.log('当前位置的经度:' + res.longitude);
  257. // console.log('当前位置的纬度:' + res.latitude);
  258. // }
  259. // });
  260. },
  261. methods: {
  262. InvoiceTypeChange(e) {
  263. this.invoiceTypeIndex = e.detail.value
  264. this.invoice = this.invoiceType[this.invoiceTypeIndex];
  265. },
  266. InvoiceTypeChange1(e) {
  267. this.invoiceTypeIndex1 = e.detail.value
  268. this.invoice = this.invoiceType1[this.invoiceTypeIndex1];
  269. if(this.invoiceTypeIndex1 == 0){
  270. this.invoiceMoney = 0
  271. }
  272. else{
  273. this.invoiceMoney = 20
  274. }
  275. },
  276. bankNameChange(e){
  277. this.bankNameIndex=e.detail.value
  278. this.buyer =this.Company[e.detail.value].companyName
  279. this.buyerPhone=this.Company[e.detail.value].companyPhone
  280. this.tradeCompanyId=this.Company[e.detail.value].id
  281. },
  282. AcceptTypeChange(e) {
  283. this.acceptTypeIndex = e.detail.value
  284. this.accept = this.acceptType[this.acceptTypeIndex];
  285. },
  286. packingChange(e){
  287. this.packingIndex = e.detail.value
  288. this.packing = this.packingType[this.packingIndex];
  289. if(this.packingIndex == 0){
  290. this.packingMoney = 0
  291. }
  292. else if(this.packingIndex == 1){
  293. this.packingMoney = this.basisBig - this.basis
  294. }
  295. else if(this.packingIndex == 2){
  296. this.packingMoney = this.basisSmall - this.basis
  297. }
  298. },
  299. changeZhihang(){
  300. uni.navigateTo({
  301. url: '/pageA/pages/newcompany'
  302. })
  303. },
  304. PriceTypeChange(e) {
  305. this.priceTypeIndex = e.detail.value
  306. this.price = this.priceType[this.priceTypeIndex]
  307. },
  308. RegionChange(e) {
  309. this.region = e.detail.value
  310. this.province = this.region[0];
  311. this.area = this.region[0]+this.region[1]+this.region[2];
  312. },
  313. textareaInput(e) {
  314. this.memo = e.detail.value
  315. },
  316. packingInput(e){
  317. this.packing = e.detail.value
  318. },
  319. buyerInput(e){
  320. this.buyer = e.detail.value
  321. },
  322. buyerPhoneInput(e){
  323. this.buyerPhone = e.detail.value
  324. },
  325. unitPriceInput(e){
  326. this.unitPrice = e.detail.value
  327. },
  328. addressInput(e){
  329. this.address = e.detail.value
  330. },
  331. countInput(e){
  332. this.count = e.detail.value
  333. },
  334. commit(){
  335. const that = this
  336. if ( that.companyId !=2 && !that.area ) {
  337. that.$api.msg('请选择省市区');
  338. return
  339. }
  340. if ( that.companyId !=2&& !that.address) {
  341. that.$api.msg('请填写详细交收地址')
  342. return
  343. }
  344. if (!that.price) {
  345. that.$api.msg('请选择价格类型')
  346. return
  347. }
  348. if (!that.invoice) {
  349. that.$api.msg('请选择发票类型')
  350. return
  351. }
  352. // if(!that.accept&&that.isFutures==0){
  353. // that.$api.msg('请选择质量验收方式');
  354. // return
  355. // }
  356. if(!that.unitPrice){
  357. that.$api.msg('请填写协议价格(元/吨)');
  358. return
  359. }
  360. if(!that.count){
  361. that.$api.msg('请填写购买数量(吨)');
  362. return
  363. }
  364. if(Number(that.count) < Number(that.minSale)){
  365. that.$api.msg('购买数量不能小于最小成交量');
  366. return
  367. }
  368. if(!that.tradeCompanyId){
  369. that.$api.msg('请选择公司名头');
  370. return
  371. }
  372. // if(that.count > that.exsitCount){
  373. // that.$api.msg('购买数量大于库存量');
  374. // return
  375. // }
  376. //this.$api.prePage()获取上一页实例,可直接调用上页所有数据和方法,在App.vue定义
  377. //this.$api.msg(`地址${this.manageType=='edit' ? '修改': '添加'}成功`);
  378. that.tradeInfo.salebuyId = that.salebuyId
  379. that.tradeInfo.buyer = that.buyer
  380. that.tradeInfo.buyerPhone = that.buyerPhone
  381. that.tradeInfo.priceType = that.price
  382. that.tradeInfo.unitPrice = that.unitPrice
  383. that.tradeInfo.province = that.province
  384. that.tradeInfo.area = that.area
  385. that.tradeInfo.address = that.address
  386. that.tradeInfo.count = that.count
  387. that.tradeInfo.acceptType = that.accept
  388. that.tradeInfo.invoiceType = that.invoice
  389. that.tradeInfo.packing = that.packing
  390. that.tradeInfo.packingMoney = that.packingMoney
  391. that.tradeInfo.memo = that.memo
  392. that.tradeInfo.seller = that.seller
  393. that.tradeInfo.sellerPhone = that.sellerPhone
  394. that.tradeInfo.tradeCompanyId = that.tradeCompanyId
  395. that.tradeInfo.invoiceMoney = that.invoiceMoney
  396. // that.tradeInfo.unloadingFee = that.unloadingFee
  397. uni.showLoading({
  398. title: '正在提交',
  399. mask:true
  400. })
  401. that.$api.request('trade', 'addTrade',that.tradeInfo, failres => {
  402. uni.hideLoading()
  403. that.$api.msg(failres.errmsg);
  404. }).then(res => {
  405. uni.hideLoading()
  406. uni.showModal({
  407. title: '提示',
  408. content: "交易申请提交成功",
  409. showCancel: false,
  410. confirmText: '确定',
  411. success: () => {
  412. uni.navigateBack({
  413. delta: 2
  414. })
  415. }
  416. })
  417. // that.$api.prePage().refreshList(data, that.manageType);
  418. })
  419. }
  420. }
  421. }
  422. </script>
  423. <style scoped>
  424. .cu-form-group input {
  425. text-align: right;
  426. }
  427. .cu-form-group textarea {
  428. text-align: right;
  429. }
  430. .margin-bottom{
  431. margin-bottom:30px;
  432. }
  433. .c-row {
  434. display: -webkit-box;
  435. display: -webkit-flex;
  436. display: flex;
  437. -webkit-box-align: center;
  438. -webkit-align-items: center;
  439. align-items: center;
  440. padding: 20rpx 30rpx;
  441. position: relative;
  442. }
  443. .con-list {
  444. -webkit-box-flex: 1;
  445. -webkit-flex: 1;
  446. flex: 1;
  447. display: -webkit-box;
  448. display: -webkit-flex;
  449. display: flex;
  450. -webkit-box-orient: vertical;
  451. -webkit-box-direction: normal;
  452. -webkit-flex-direction: column;
  453. flex-direction: column;
  454. color: #303133;
  455. line-height: 40rpx;
  456. text-align: right;
  457. padding-right: 20rpx;
  458. }
  459. /* 详情 */
  460. .detail-desc {
  461. background: #fff;
  462. margin-top: 16upx;
  463. margin:10px;
  464. position:relative;
  465. z-index:4;
  466. border-radius:5px;
  467. .d-header {
  468. display: flex;
  469. padding:10px;
  470. font-size: $font-base + 2upx;
  471. color: $font-color-dark;
  472. position: relative;
  473. border-bottom:1px solid #EEEEEE;
  474. text {
  475. padding: 0 20upx;
  476. position: relative;
  477. z-index: 1;
  478. }
  479. }
  480. }
  481. .c-list picker .picker {
  482. line-height: 80rpx;
  483. font-size: 24rpx;
  484. text-overflow: ellipsis;
  485. white-space: nowrap;
  486. overflow: hidden;
  487. width: 100%;
  488. text-align: right;
  489. }
  490. .c-list picker {
  491. -webkit-box-flex: 1;
  492. -webkit-flex: 1;
  493. flex: 1;
  494. padding-right: 10px;
  495. overflow: hidden;
  496. position: relative;
  497. }
  498. .c-list {
  499. font-size: $font-sm + 2upx;
  500. color: $font-color-base;
  501. background: #fff;
  502. .c-row {
  503. display: flex;
  504. align-items: center;
  505. padding: 20upx 30upx;
  506. position: relative;
  507. }
  508. .tit {
  509. width: 220upx;
  510. }
  511. .con {
  512. flex: 1;
  513. color: $font-color-dark;
  514. .selected-text {
  515. margin-right: 10upx;
  516. }
  517. }
  518. .bz-list {
  519. height: 40upx;
  520. font-size: $font-sm+2upx;
  521. color: $font-color-dark;
  522. text {
  523. display: inline-block;
  524. margin-right: 30upx;
  525. }
  526. }
  527. .con-list {
  528. flex: 1;
  529. display: flex;
  530. flex-direction: column;
  531. color: $font-color-dark;
  532. line-height: 40upx;
  533. text-align: right;
  534. padding-right: 20upx;
  535. }
  536. .red {
  537. color: $uni-color-primary;
  538. }
  539. }
  540. .textarea{
  541. background:#F9F9FA;
  542. font-size:12px;
  543. text-align:left;
  544. width:100%;
  545. height:60px;
  546. padding:10px;
  547. border-radius:5px;
  548. margin-top:10px;
  549. }
  550. </style>