|
|
@@ -0,0 +1,248 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <div v-if="id == 0">
|
|
|
+ <div style="width:35vw;margin:0 auto;margin-top:10px;text-align:center;font-size:25px;">请选择订单</div>
|
|
|
+ </div>
|
|
|
+ <div style="width:62vw;margin:0 auto;margin-top:10px;" v-else>
|
|
|
+ <el-table :data="flowersList" style="width:100%">
|
|
|
+ <el-table-column prop="name" label="名称">
|
|
|
+
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="suggestHjPrice" label="大客价">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input placeholder="请填写大客价" @focus="scope.row.suggestHjPrice=''" v-model="scope.row.suggestHjPrice" size="small"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="suggestPrice" label="批发价">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input placeholder="请填写批发价" @focus="scope.row.suggestPrice=''" v-model="scope.row.suggestPrice" size="small" @input="linkChange(scope.$index)"
|
|
|
+ style="border:1px solid #CCCCCC;border-radius: 5px;"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="suggestSkPrice" label="零售价">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input placeholder="请填写零售价" @focus="scope.row.suggestSkPrice=''" v-model="scope.row.suggestSkPrice" size="small"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="bigPrice" label="进货价">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.bigPrice?parseFloat(scope.row.bigPrice):0 }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="cost" label="成本价">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.cost?parseFloat(scope.row.cost):0 }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="beforeModifyPrice" label="旧批发价">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.beforeModifyPrice?parseFloat(scope.row.beforeModifyPrice):0 }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="itemNum" label="入库数">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.itemNum?parseFloat(scope.row.itemNum):0 }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="beforeModifyStock" label="入库前库存">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.beforeModifyStock?parseFloat(scope.row.beforeModifyStock):0 }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div style="text-align:left;margin-top:18px;">
|
|
|
+ <el-button @click="goBackFn" plain>稍后入库</el-button>
|
|
|
+ <el-button v-if="info.status == 3" type="success" @click="savePrice">保存价格,稍后入库</el-button>
|
|
|
+ <el-button v-if="info.status == 3" type="danger" @click="confirmIn">仅入库不改价</el-button>
|
|
|
+ <el-button v-if="info.status != 3" type="primary" @click="commitChange(2)">确认改价</el-button>
|
|
|
+ <el-button v-if="info.status == 3" type="primary" @click="commitChange(1)">改价并入库</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import { mapGetters } from 'vuex';
|
|
|
+export default {
|
|
|
+ name: 'change',
|
|
|
+ components: {
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ flowersList:[],
|
|
|
+ info:{},
|
|
|
+ id:0,
|
|
|
+ orderSn:''
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(['shopInfo', 'userInfo'])
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ if(this.$route.query.id){
|
|
|
+ this.id = this.$route.query.id
|
|
|
+ this.getItemList()
|
|
|
+ }
|
|
|
+ if(this.$route.query.orderSn){
|
|
|
+ this.orderSn = this.$route.query.orderSn
|
|
|
+ this.getDetail()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ confirmIn(){
|
|
|
+ let that = this
|
|
|
+ this.$confirm('确认只入库不改价?', '提示', { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
|
|
+ //uni.showLoading({mask:true})
|
|
|
+ confirmPutIn
|
|
|
+ this.$service.purchaseOrder.confirmPutIn({id:that.id}).then(data => {
|
|
|
+ //uni.hideLoading()
|
|
|
+ if(data.status == 4){
|
|
|
+ that.$notify({ title: '成功', message: '操作成功', type: 'success'})
|
|
|
+ setTimeout(function(){
|
|
|
+ //that.pageTo({url: '/pagesPurchase/info?orderSn='+that.info.orderSn,type:2})
|
|
|
+ },1100)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ savePrice(){
|
|
|
+ let that = this
|
|
|
+ let hasError = false
|
|
|
+ let errorHint = ''
|
|
|
+ this.flowersList.forEach(function(item){
|
|
|
+ if(that.$util.isMoney(item.suggestPrice) == false){
|
|
|
+ let name = item.name
|
|
|
+ errorHint = '请填写 '+name+' 批发价'
|
|
|
+ hasError = true
|
|
|
+ }
|
|
|
+ if(that.$util.isMoney(item.suggestSkPrice) == false){
|
|
|
+ let name = item.name
|
|
|
+ errorHint = '请填写 '+name+' 零售价'
|
|
|
+ hasError = true
|
|
|
+ }
|
|
|
+ if(that.$util.isMoney(item.suggestHjPrice) == false){
|
|
|
+ let name = item.name
|
|
|
+ errorHint = '请填写 '+name+' 大客价'
|
|
|
+ hasError = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(hasError){
|
|
|
+ this.$msg(errorHint)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.$confirm('确认保存?', '提示', { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
|
|
+ let targetId = this.id ? this.id : 0
|
|
|
+ let newProduct = this.flowersList.map((ele) => {
|
|
|
+ return {id:ele.id,savePrice:ele.suggestPrice,saveSkPrice:ele.suggestSkPrice,saveHjPrice:ele.suggestHjPrice}
|
|
|
+ })
|
|
|
+ //uni.showLoading({mask:true})
|
|
|
+ this.$service.purchaseOrderItem.saveCgPrice({data:JSON.stringify(newProduct),cgId:targetId}).then(data => {
|
|
|
+ //uni.hideLoading()
|
|
|
+ that.$notify({ title: '成功', message: '操作成功', type: 'success'})
|
|
|
+ setTimeout(function(){
|
|
|
+ //uni.navigateBack()
|
|
|
+ },1300)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ goBackFn() {
|
|
|
+ //uni.navigateBack({})
|
|
|
+ },
|
|
|
+ commitChange(type){
|
|
|
+ let that = this
|
|
|
+ let hasError = false
|
|
|
+ let errorHint = ''
|
|
|
+ this.flowersList.forEach(function(item){
|
|
|
+ if(that.$util.isMoney(item.suggestPrice) == false){
|
|
|
+ let name = item.name
|
|
|
+ errorHint = '请填写 '+name+' 批发价'
|
|
|
+ hasError = true
|
|
|
+ }
|
|
|
+ if(that.$util.isMoney(item.suggestSkPrice) == false){
|
|
|
+ let name = item.name
|
|
|
+ errorHint = '请填写 '+name+' 零售价'
|
|
|
+ hasError = true
|
|
|
+ }
|
|
|
+ if(that.$util.isMoney(item.suggestHjPrice) == false){
|
|
|
+ let name = item.name
|
|
|
+ errorHint = '请填写 '+name+' 大客价'
|
|
|
+ hasError = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(hasError){
|
|
|
+ this.$msg(errorHint)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let hint = '确认提交?'
|
|
|
+ if(type == 1){
|
|
|
+ hint = '确认改价并入库?'
|
|
|
+ }
|
|
|
+ if(type == 2){
|
|
|
+ hint = '确认改价?'
|
|
|
+ }
|
|
|
+ this.$confirm(hint, '提示', { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
|
|
+ that.commitModify()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ commitModify(){
|
|
|
+ let that = this
|
|
|
+ let targetId = this.id ||0
|
|
|
+ let newProduct = this.flowersList.map((ele) => {
|
|
|
+ return {id:ele.productId,price:ele.suggestPrice,skPrice:ele.suggestSkPrice,hjPrice:ele.suggestHjPrice}
|
|
|
+ })
|
|
|
+ //uni.showLoading({mask:true})
|
|
|
+ that.$service.product.batchChangePrice({data:JSON.stringify(newProduct),changeType:'cg',targetId:targetId,appVersion:1}).then(data => {
|
|
|
+ //uni.hideLoading()
|
|
|
+ that.$notify({ title: '成功', message: '操作成功', type: 'success'})
|
|
|
+ setTimeout(function(){
|
|
|
+ //that.pageTo({url: '/pagesPurchase/info?orderSn='+that.info.orderSn,type:2})
|
|
|
+ },1100)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ linkChange(i){
|
|
|
+ if(this.flowersList[i].suggestPrice && Number(this.flowersList[i].suggestPrice)>0){
|
|
|
+ let skMore = this.flowersList[i].skMore ? Number(this.flowersList[i].skMore) : 0
|
|
|
+ let hjAddPrice = this.flowersList[i].hjAddPrice ? Number(this.flowersList[i].hjAddPrice) : 0
|
|
|
+ let addPrice = this.flowersList[i].addPrice ? Number(this.flowersList[i].addPrice) : 0
|
|
|
+
|
|
|
+ let skAddNum = Number(skMore) - Number(addPrice)
|
|
|
+ skAddNum = skAddNum.toFixed(2)
|
|
|
+ let skAmount = Number(skAddNum) + Number(this.flowersList[i].suggestPrice)
|
|
|
+ if(skAmount>0){
|
|
|
+ skAmount = skAmount.toFixed(2)
|
|
|
+ skAmount = parseFloat(skAmount)
|
|
|
+ this.flowersList[i].suggestSkPrice = skAmount
|
|
|
+ }else{
|
|
|
+ this.flowersList[i].suggestSkPrice = ''
|
|
|
+ }
|
|
|
+
|
|
|
+ let hjSubNum = Number(addPrice) - Number(hjAddPrice)
|
|
|
+ hjSubNum = hjSubNum.toFixed(2)
|
|
|
+ let hjAmount = Number(this.flowersList[i].suggestPrice) - Number(hjSubNum)
|
|
|
+ if(hjAmount > 0){
|
|
|
+ hjAmount = hjAmount.toFixed(2)
|
|
|
+ hjAmount = parseFloat(hjAmount)
|
|
|
+ this.flowersList[i].suggestHjPrice = hjAmount
|
|
|
+ }else{
|
|
|
+ this.flowersList[i].suggestHjPrice = ''
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.flowersList[i].suggestSkPrice = ''
|
|
|
+ this.flowersList[i].suggestHjPrice = ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getItemList(){
|
|
|
+ this.$service.purchaseOrderItem.getItemList({id:this.id}).then(data => {
|
|
|
+ this.flowersList = data.list
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getDetail(){
|
|
|
+ this.$service.purchaseOrder.detail({orderSn:this.orderSn}).then(data => {
|
|
|
+ this.info = data
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+</style>
|