123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487 |
- <template>
- <view class="center">
- <view class="transaction">
-
- <view class="c-row b-b">
- <view class="title">买方</view>
- <view class="con-list">
- <view v-if='goods.customerTypeFlag==1' class="title" @click="liang">{{purchaseOrder.customer?purchaseOrder.customer:goods.customerName}}></view>
- <view v-if='goods.customerTypeFlag==2' class="title" @click="liang">{{purchaseOrder.compName?purchaseOrder.compName:goods.compName}}></view>
- </view>
- </view>
- <view class="c-row">
- <view class="title">卖方</view>
- <view class="con-list">
- {{purchaseOrder.seller}}
- </view>
- </view>
-
- </view>
- <view class="transaction">
- <view class="c-row b-b margin-top">
- <view class="title">出库地区</view>
- <view class="con-list">
- <view class="title">{{purchaseOrder.sendPrivate}}{{purchaseOrder.sendCity}}{{purchaseOrder.sendArea}}</view>
- </view>
- </view>
- <view class="c-row b-b ">
- <view class="title">出货库</view>
- <view class="con-list">
- <view class="title">{{purchaseOrder.sendWarehouse}}</view>
- </view>
- </view>
- <view v-if='companyId!=2' class="c-row b-b">
- <view class="title">货名</view>
- <view class="con-list">
- <text>{{purchaseOrder.goodsName}}</text>
- </view>
- </view>
- <view class="c-row b-b">
- <view class="title">最小成交量(吨)</view>
- <view class="con-list">
- <text>{{purchaseOrder.minimumVolume}}</text>
- </view>
- </view>
- <view v-if="purchaseOrder.salePlanType=='期货'" class="c-row">
- <view class="title">今日基差(元/吨)</view>
- <view class="con-list">
- <view class="picker">
- <text>{{purchaseOrder.basis}}</text>
- </view>
- </view>
- </view>
-
- <view v-else class="c-row ">
- <view class="title">销售单价(元/吨)</view>
- <view class="con-list">
- <view class="picker">
- <text>{{purchaseOrder.salePrice}}</text>
- </view>
- </view>
- </view>
- </view >
- <view class="transaction">
- <view class="c-row b-b margin-top">
- <view class="title">发票类型</view>
- <view class="con-list">
- <picker @change="invoiceChange" :value="invoiceIndex" :range="invoiceType">
- <view class="picker">
- {{invoiceIndex>-1?invoiceType[invoiceIndex]:'请选择'}}
- </view>
- </picker>
- </view>
- </view>
- <view class="c-row b-b">
- <view class="title">采购数量(吨)</view>
- <view class="con-list">
- <input v-model='purchaseOrder.transactionsNumber' type="number" placeholder-style="font-size: 12px;" placeholder="请填写采购数量" name="input"></input>
- </view>
- </view>
- <view class="c-row b-b">
- <view class="title">包装方式</view>
- <view class="con-list">
- <picker @change="packingChange" :value="packingIndex" :range="packingType">
- <view class="picker">
- {{packingIndex>-1?packingType[packingIndex]:'请选择'}}
- </view>
- </picker>
- </view>
- </view>
- <view v-if='purchaseOrder.packingType =="大袋" || purchaseOrder.packingType =="小袋"' class="beizhu align-start">
- <view class="title">袋装备注</view>
- <view >
- <textarea maxlength="-1" v-model='purchaseOrder.baggingNotes' placeholder-style="font-size: 12px;" placeholder="请填写包装规格、质量、包装物要求。例:50kg袋装、大粒、彩包" class="textareas"></textarea>
- </view>
- </view>
- <view v-if="purchaseOrder.salePlanType=='期货'" class="c-row b-b align-start">
- <view class="title">点价(元/吨)</view>
- <view class="con-list">
- <input placeholder="请填写点价" type="number" placeholder-style="font-size: 12px;" name="input" @input='someprice' v-model="purchaseOrder.pointPrice"></input>
- </view>
- </view>
- <view v-if="purchaseOrder.salePlanType=='期货'" class="c-row b-b align-start">
- <view class="title">发票费用(元/吨)</view>
- <view class="con-list">
- <input disabled placeholder="请填写发票费用" placeholder-style="font-size: 12px;" name="input" @input='someprice' v-model="purchaseOrder.invoiceFee"></input>
- </view>
- </view>
- <!-- <view v-if="purchaseOrder.salePlanType=='期货'" class="c-row b-b align-start">
- <view class="title">包装费(元/吨)</view>
- <view class="con-list">
- <input placeholder="请填写包装费" name="input" type="number" placeholder-style="font-size: 12px;" @input='someprice' v-model="purchaseOrder.packingFee"></input>
- </view>
- </view> -->
- <view v-if="purchaseOrder.salePlanType=='期货'" class=" align-start ">
- <view class="titles">结算价格</view>
- <text class="textA">结算价格=点价+基差+发票费用</text>
- <!-- <text class="textA">结算价格=点价+基差+发票费用+包装费</text> -->
- <text style="font-size: 18px;color: #FD714F;margin-left: 25px;">¥{{purchaseOrder.settlementPrice}}</text>
- <!-- <input placeholder="请填写 例:袋装XX斤/散装" name="input" @input='packingInput' v-model="purchaseOrder.settlementPrice"></input> -->
- </view>
- <!-- <view style='background:#fff;'>
- 结算价格=点价+基差+发票费用+包装费
- </view> -->
- </view>
-
- <button class="btn" @click="commit()">提交</button>
-
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- export default {
- data() {
- return {
- tradeInfo:{
- salebuyId:0,
- packing:'',
- memo:'',
- buyer:'',
- buyerPhone:'',
- salePrice:0,
- address:'',
- count:0,
- province:'',
- area:'',
- priceType:'',
- invoiceType:'',
- acceptType:'',
- seller:'',
- sellerPhone:'',
- packingMoney:0,
- type:0,
- modalName:"",
- },
- purchaseOrder: {
- invoiceFee:0,
- packingFee:null,
- packingType:"散装",
- packingTypeKey:1,
- type:'不开发票',
- typeKey:1
- },
- invoiceTypeIndex:0,
- invoiceTypeIndex1:0,
- acceptTypeIndex:0,
- priceTypeIndex:0,
- bankNameIndex:0,
- packingIndex:0,
- invoiceIndex:0,
- packingType: ['散粮','大袋','小袋'],
- // invoiceType: ['不开发票', '普通发票', '增值税发票'],
- invoiceType: ['不开发票','增值税发票'],
- acceptType: ['第三方检验(国家检验资质)', '交收地库或港出具的检验', '现场看货','其他'],
- priceType: ['库内价', '到库价', '到港价'],
- priceTypeIndex1:'库内价',
- region: [],
- salebuyId:0,
- memo:'',
- buyer:'',
- buyerPhone:'',
- salePrice:0,
- address:'',
- count:0,
- id:0,
- price:'库内价',
- invoice:'不开发票',
- accept:'',
- seller:'',
- sellerPhone:'',
- minSale:'',
- province:'',
- city:'',
- area:'',
- storeName:'',
- exsitCount:0,
- isFutures:'',
- bankNameList:'',
- Company:[],
- goods:{},
- companyId:'',
- tradeCompanyId:'',
- basis:0,
- basisBig:0,
- basisSmall:0,
- invoiceMoney:0,
- unloadingFee:0,
- packingMoney:0,
- packing:'散装',
- invoiceFeeCompany:0,
- invoiceFeePerson:0
- };
- },
- onLoad(options) {
- this.id=options.id
- this.purchaseOrder.planId=options.id
- this.purchaseOrder.seller = options.seller
- this.purchaseOrder.goodsName = options.goodsName
- this.purchaseOrder.sendPrivate = options.sendPrivate
- this.purchaseOrder.sendCity = options.sendCity
- this.purchaseOrder.sendArea = options.sendArea
- this.purchaseOrder.minimumVolume = options.minimumVolume
- this.purchaseOrder.buyer = options.buyer
- this.purchaseOrder.customer = options.customerName
- this.purchaseOrder.basis = options.basisPrice
- this.purchaseOrder.salePrice = options.salePrice
- this.purchaseOrder.receiveWarehouse = options.receiveWarehouse
- this.purchaseOrder.settlementPrice = options.basisPrice
- this.purchaseOrder.salePlanType = options.salePlanType
- this.purchaseOrder.salePlan=options.salePlan
- // this.purchaseOrder.baggingNotes=options.baggingNotes
- this.purchaseOrder.sendWarehouse = options.sendWarehouse
- this.purchaseOrder.compId=options.compId
- this.invoiceFeeCompany = options.invoiceFeeCompany
- this.invoiceFeePerson = options.invoiceFeePerson
- },
- computed: {
- ...mapState(['hasLogin','userInfo']),
- },
- onShow() {
- if( this.$store.state.choice != "" ){
- if(this.goods.customerTypeFlag==1){
- this.goods.customerName = this.$store.state.choice
- }else if(this.goods.customerTypeFlag==2){
- this.goods.compName = this.$store.state.choice
- }
- }else{
- this.$api.doRequest('get', '/identityAuthenticationInfo/getInfo',{commonId:this.userInfo.id}).then(res => {
- if(res.data.code==200){
- this.goods=res.data.data
- if(this.goods.customerTypeFlag==1){
- this.purchaseOrder.invoiceFee = this.invoiceFeePerson
- this.purchaseOrder.settlementPrice = Number(this.purchaseOrder.basis)+Number(this.purchaseOrder.invoiceFee)
- }else{
- this.purchaseOrder.invoiceFee = this.invoiceFeeCompany
- this.purchaseOrder.settlementPrice = Number(this.purchaseOrder.basis)+Number(this.purchaseOrder.invoiceFee)
- }
- }
- uni.hideLoading()
- })
- }
- },
- methods: {
- liang(){
- uni.navigateTo({
- url: `/pageA/product/Identity_switching?goodsName=${this.purchaseOrder.goodsName}
- &receivePrivate=${this.purchaseOrder.receivePrivate}&receiveCity=${this.purchaseOrder.receiveCity}
- &receiveArea=${this.purchaseOrder.receiveArea}&minimumVolume=${this.purchaseOrder.minimumVolume}
- &buyer=${this.purchaseOrder.buyer}&basisPrice=${this.purchaseOrder.basis}&salePrice=${this.purchaseOrder.salePrice}
- &receiveWarehouse=${this.purchaseOrder.receiveWarehouse}&salePlanType=${this.purchaseOrder.salePlanType}
- &salePlanNo=${this.purchaseOrder.salePlan}`
- })
- },
- commit(){
- if(!this.purchaseOrder.transactionsNumber){
- this.$api.msg('采购数量不能为空')
- return
- }
- if(this.purchaseOrder.transactionsNumber>10000||this.purchaseOrder.transactionsNumber<1){
- this.$api.msg('采购数量输入错误')
- return
- }
- if(this.purchaseOrder.salePlanType=='期货'){
- if(!this.purchaseOrder.pointPrice){
- this.$api.msg('点价不能为空')
- return
- }
- if(this.purchaseOrder.pointPrice>10000){
- this.$api.msg('点价输入错误')
- return
- }
- if(this.purchaseOrder.pointPrice.indexOf('.')!=-1){
- if(this.purchaseOrder.pointPrice.split(".")[1].length>2){
- this.$api.msg('点价输入错误')
- return
- }
- }
- // this.purchaseOrder.packingFee=-this.purchaseOrder.packingFee
- // if(this.purchaseOrder.packingFee>0||this.purchaseOrder.packingFee<-2000){
- // this.$api.msg('包装费输入错误')
- // return
- // }
- }
- if(!this.purchaseOrder.customer){
- if(this.goods.customerTypeFlag==1){
- this.purchaseOrder.customer=this.goods.customerName
- }else{
- this.purchaseOrder.customer=this.goods.compName
- }
- }
- if(!this.purchaseOrder.buyer){
- if(this.goods.customerTypeFlag==1){
- this.purchaseOrder.buyer=this.goods.customerName
- this.purchaseOrder.buyerPhone=this.goods.customerPhone
- }else{
- this.purchaseOrder.buyer=this.goods.compName
- this.purchaseOrder.buyerPhone=this.goods.customerPhone
- }
- }
- var that=this
- this.purchaseOrder.commonId=that.userInfo.id
- this.purchaseOrder.pcFlag=0
- if(this.purchaseOrder.salePlanType == "期货"){
- this.purchaseOrder.unitPrice = this.purchaseOrder.settlementPrice
- }
- uni.showModal({
- content: '订单提交后将发送给卖方,是否确定提交?',
- success: function (res) {
- if (res.confirm) {
- that.$api.doRequest('post','/saleOrder/api/insertSaleOrder', that.purchaseOrder).then(res => {
- if(res.data.code==200){
- uni.showToast({
- title: '提交成功,等待卖方回复',
- icon: 'none',
- duration: 1500,
- success() {
- setTimeout(()=>{
- uni.navigateBack(1)
- },1500)
- }
- })
- // uni.navigateTo({
- // url: `/pages/business/business`
- // })
- }else{
- uni.showToast({
- title: '提交失败:'+res.data.message,
- icon: 'none',
- duration: 2000
- })
- }
- }).catch(res => {
- uni.showToast({
- title: res.data.message,
- icon: 'none',
- duration: 2000
- })
- })
- }
- }
- })
- },
- someprice(e){
- if(this.purchaseOrder.pointPrice&&this.purchaseOrder.invoiceFee&&this.purchaseOrder.packingFee){
- this.purchaseOrder.settlementPrice=Number(this.purchaseOrder.basis)+Number(this.purchaseOrder.pointPrice)+Number(this.purchaseOrder.invoiceFee)+Number(-this.purchaseOrder.packingFee)
- }else if(this.purchaseOrder.pointPrice&&this.purchaseOrder.invoiceFee){
- this.purchaseOrder.settlementPrice=Number(this.purchaseOrder.basis)+Number(this.purchaseOrder.pointPrice)+Number(this.purchaseOrder.invoiceFee)
- }else if(this.purchaseOrder.pointPrice&&this.purchaseOrder.packingFee){
- this.purchaseOrder.settlementPrice=Number(this.purchaseOrder.basis)+Number(this.purchaseOrder.pointPrice)+Number(-this.purchaseOrder.packingFee)
- }else if(this.purchaseOrder.pointPrice){
- this.purchaseOrder.settlementPrice=Number(this.purchaseOrder.basis)+Number(this.purchaseOrder.pointPrice)
- }else if(this.purchaseOrder.packingFee){
- this.purchaseOrder.settlementPrice=Number(this.purchaseOrder.basis)+Number(-this.purchaseOrder.packingFee)
- }else if(this.purchaseOrder.invoiceFee){
- this.purchaseOrder.settlementPrice=Number(this.purchaseOrder.basis)+Number(this.purchaseOrder.invoiceFee)
- }else{
- this.purchaseOrder.settlementPrice=this.purchaseOrder.basis
- }
- },
- bankNameChange(e){
- this.bankNameIndex=e.detail.value
- this.buyer =this.Company[e.detail.value].companyName
- this.buyerPhone=this.Company[e.detail.value].companyPhone
- this.tradeCompanyId=this.Company[e.detail.value].id
- },
- AcceptTypeChange(e) {
- this.acceptTypeIndex = e.detail.value
- this.accept = this.acceptType[this.acceptTypeIndex];
- },
- packingChange(e){
- this.packingIndex = e.detail.value
- this.purchaseOrder.packingTypeKey=e.detail.value+1
- this.purchaseOrder.packingType = this.packingType[this.packingIndex];
- },
- invoiceChange(e){
- this.invoiceIndex = e.detail.value
- this.purchaseOrder.typeKey=e.detail.value+1
- this.purchaseOrder.type = this.invoiceType[this.invoiceIndex];
- if(this.invoiceIndex == 1){
- if(this.purchaseOrder.goodsName=='玉米'){
- this.purchaseOrder.invoiceFee=10
- }else if(this.purchaseOrder.goodsName=='大豆'){
- this.purchaseOrder.invoiceFee=20
- }
- }
- },
- }
- }
- </script>
- <style scoped>
- .center {
- padding: 10px 20px;
- background-color: #F5F6FA;
- }
- .cu-form-group input {
- text-align: right;
- }
- .cu-form-group textarea {
- text-align: right;
- }
- .margin-bottom{
- margin-bottom:30px;
- }
- .c-row {
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-align: center;
- -webkit-align-items: center;
- align-items: center;
- padding: 20rpx 30rpx;
- position: relative;
- }
- .con-list {
- -webkit-box-flex: 1;
- -webkit-flex: 1;
- flex: 1;
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-orient: vertical;
- -webkit-box-direction: normal;
- -webkit-flex-direction: column;
- flex-direction: column;
- color: #303133;
- line-height: 40rpx;
- text-align: right;
- padding-right: 20rpx;
- }
- .transaction{
- background-color: #FFFFFF;
- margin-top: 10px;
- border-radius: 20px;
- }
- .btn{
- width: 100%;
- background-color: #22C572;
- border-radius: 20px;
- margin-top: 10px;
- color: white;
- }
- .textareas{
- width: 260px;
- height: 130px;
- background-color: #F9F9FA;
- margin: 10px;
- padding: 10px 20px;
- border-radius: 10px;
- }
- .beizhu{
- margin-left: 20px;
- /* margin: 10px; */
- margin-top: 10px;
- }
- .titles{
- margin-left: 20px;
- margin-top: 10px;
- }
- .textA{
- margin-left: 20px;
- color: #AFB3BF;
- font-size: 10px;
- }
- </style>
|