|
@@ -3,14 +3,14 @@
|
|
|
<!-- 基础信息 -->
|
|
|
<view class="sales-info-con">
|
|
|
<u-section @click="infoModal=true" title="基础信息" sub-title="查看更多" :line-color="$config('primaryColor')"></u-section>
|
|
|
- <view class="info-item-box">
|
|
|
- <text class="info-item-tit color_6">销售单号</text>
|
|
|
- <text>{{detailData && detailData.salesBillNo || '--'}}</text>
|
|
|
- </view>
|
|
|
<view class="info-item-box">
|
|
|
<text class="info-item-tit color_6">客户名称</text>
|
|
|
<text>{{detailData && detailData.buyerName || '--'}}</text>
|
|
|
</view>
|
|
|
+ <view class="info-item-box">
|
|
|
+ <text class="info-item-tit color_6">销售单号</text>
|
|
|
+ <text>{{detailData && detailData.salesBillNo || '--'}}</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<!-- 产品列表 -->
|
|
|
<view class="sales-product-con">
|
|
@@ -20,19 +20,21 @@
|
|
|
</view>
|
|
|
<view class="flex flex_column" v-show="current == 0">
|
|
|
<!-- 合计 -->
|
|
|
- <view ref="salesTotal" class="sales-total-box border-b font_13 flex justify_between">
|
|
|
- <view class="sales-total-con flex_1" :style="{height: toggle ? 'auto' : '44upx'}">
|
|
|
+ <view ref="salesTotal" v-if="detailData" class="sales-total-box border-b font_13 flex justify_between">
|
|
|
+ <view class="sales-total-con flex_1">
|
|
|
<view>
|
|
|
总款数:<text class="sales-total-num" :style="{ color: $config('warringColor') }">
|
|
|
- {{ detailData && (detailData.totalCategory || detailData.totalCategory == 0) ? toThousands(detailData.totalCategory) : '--' }}</text>;总数量:<text class="sales-total-num" :style="{ color: $config('warringColor') }">
|
|
|
- {{ detailData && (detailData.totalQty || detailData.totalQty == 0) ? toThousands(detailData.totalQty) : '--' }}
|
|
|
+ {{ (detailData.totalCategory || detailData.totalCategory == 0) ? toThousands(detailData.totalCategory) : '--' }}</text>;
|
|
|
+ 总数量:<text class="sales-total-num" :style="{ color: $config('warringColor') }">
|
|
|
+ {{ (detailData.totalQty || detailData.totalQty == 0) ? toThousands(detailData.totalQty) : '--' }}
|
|
|
</text>;
|
|
|
</view>
|
|
|
<view>
|
|
|
总售价:<text class="sales-total-num" :style="{ color: $config('warringColor') }">
|
|
|
- ¥{{ detailData && (detailData.totalAmount || detailData.totalAmount == 0) ? toThousands(detailData.totalAmount, 2) : '--' }}
|
|
|
- </text>;折后总售价:<text class="sales-total-num" :style="{ color: $config('warringColor') }">
|
|
|
- ¥{{ detailData && (detailData.discountedAmount || detailData.discountedAmount == 0) ? toThousands(detailData.discountedAmount, 2) : '--' }}
|
|
|
+ ¥{{ detailData.totalAmount || detailData.totalAmount == 0 ? toThousands(detailData.totalAmount, 2) : '--' }}
|
|
|
+ </text>;
|
|
|
+ 折后总售价:<text class="sales-total-num" :style="{ color: $config('warringColor') }">
|
|
|
+ ¥{{ detailData.discountedAmount || detailData.discountedAmount == 0 ? toThousands(detailData.discountedAmount, 2) : '--' }}
|
|
|
</text>;
|
|
|
</view>
|
|
|
</view>
|
|
@@ -51,24 +53,24 @@
|
|
|
<view class="sales-item-main flex_1">
|
|
|
<view class="sales-item-name">{{item.productName || '--'}}</view>
|
|
|
<view class="sales-item-txt">{{item.productCode || '--'}}</view>
|
|
|
- <view class="sales-item-txt color_6" style="font-size: 24upx;" v-if="item.warehouseEntity&&item.warehouseEntity.name || item.warehouseLocationEntity&&item.warehouseLocationEntity.name">{{item.warehouseEntity&&item.warehouseEntity.name}} > {{item.warehouseLocationEntity&&item.warehouseLocationEntity.name}}</view>
|
|
|
+ <!-- <view class="sales-item-txt color_6" style="font-size: 24upx;" v-if="item.warehouseEntity&&item.warehouseEntity.name || item.warehouseLocationEntity&&item.warehouseLocationEntity.name">{{item.warehouseEntity&&item.warehouseEntity.name}} > {{item.warehouseLocationEntity&&item.warehouseLocationEntity.name}}</view> -->
|
|
|
<view class="sales-item-txt flex align_center justify_between">
|
|
|
<view class="sales-item-priceInfo">
|
|
|
<view :style="{color: $config('errorColor'), display: 'inline-block'}">¥<text style="font-size: 30upx;">{{toThousands(item.price||0, 2)}}</text></view>
|
|
|
<text style="display: inline-block;margin: 0 10upx;">X</text>
|
|
|
<text style="font-size: 30upx;">{{toThousands(item.qty||0)}}</text>
|
|
|
- {{item.productUnit}}
|
|
|
+ <!-- {{item.productUnit}} -->
|
|
|
</view>
|
|
|
- <view class="sales-item-price">¥{{toThousands(item.totalAmount||0, 2)}}</view>
|
|
|
+ <view class="sales-item-price">¥{{item.totalAmount || item.totalAmount == 0?toThousands(item.totalAmount, 2):0}}</view>
|
|
|
</view>
|
|
|
- <view class="sales-item-price" v-if="detailData&&detailData.discountAmount">折后:¥{{toThousands(item.discountedAmount||0, 2)}}</view>
|
|
|
+ <!-- <view class="sales-item-price" v-if="detailData&&detailData.discountAmount">折后:¥{{toThousands(item.discountedAmount||0, 2)}}</view> -->
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view v-if="listData && listData.length == 0">
|
|
|
<u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="150" :text="noDataText" mode="list" :margin-top="50"></u-empty>
|
|
|
</view>
|
|
|
- <view style="padding: 20upx;">
|
|
|
+ <view style="padding: 20upx;" v-else>
|
|
|
<u-loadmore v-if="totalNum>listData.length || status=='loading'" :status="status" />
|
|
|
</view>
|
|
|
</scroll-view>
|
|
@@ -76,28 +78,20 @@
|
|
|
</view>
|
|
|
<!-- 收款记录列表 -->
|
|
|
<view class="flex flex_column" v-show="current == 1">
|
|
|
- <!-- <view ref="salesTotal" class="sales-total-box border-b font_13 flex justify_between">
|
|
|
- <view class="sales-total-con flex_1" :style="{height: toggle ? 'auto' : '44upx'}">
|
|
|
- 应收:<text class="sales-total-num" :style="{color: $config('warringColor')}">{{detailData && (detailData.totalCategory || detailData.totalCategory==0) ? toThousands(detailData.totalCategory) : '--'}}</text>;已收:<text class="sales-total-num" :style="{color: $config('warringColor')}">{{detailData && (detailData.totalQty || detailData.totalQty==0) ? toThousands(detailData.totalQty) : '--'}}</text>;待收:<text class="sales-total-num" :style="{color: $config('warringColor')}">¥{{detailData && (detailData.discountAmount || detailData.discountAmount==0) ? toThousands(detailData.discountAmount, 2) : '--'}}</text>;
|
|
|
- </view>
|
|
|
- </view> -->
|
|
|
<view class="sales-list-box">
|
|
|
<scroll-view class="sales-list-con" :style="{height:scrollH+'upx'}" scroll-y>
|
|
|
<view class="sales-list-item flex align_center justify_between" v-for="(con,i) in payRecode" :key="">
|
|
|
<view class="sales-list-l">
|
|
|
<view>{{con.createDate}}</view>
|
|
|
- <view>微信支付(线上)</view>
|
|
|
+ <view>{{con.payType}}</view>
|
|
|
</view>
|
|
|
<view class="sales-list-r income" >
|
|
|
- +¥32.00
|
|
|
+ {{con.price *1 > 0?'+':'-'}}¥{{con.price}}
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view v-if="false">
|
|
|
+ <view v-if="payRecode.length==0">
|
|
|
<u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="150" :text="noDataText" mode="list" :margin-top="50"></u-empty>
|
|
|
</view>
|
|
|
- <view style="padding: 20upx;">
|
|
|
- <u-loadmore v-if="totalNum>listData.length || status=='loading'" :status="status" />
|
|
|
- </view>
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -108,15 +102,12 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import commonModal from '@/pages/common/commonModal.vue'
|
|
|
+
|
|
|
import OrderInfoModal from './orderInfoModal.vue'
|
|
|
- import DiscountModal from './discountModal.vue'
|
|
|
- import ProductModal from './productModal.vue'
|
|
|
import { toThousands } from '@/libs/tools'
|
|
|
- import { stockByProductSn } from '@/api/stock'
|
|
|
import { salesDetailList, salesDetailDel, salesDel, salesDetailBySn, salesSubmit, salesDiscount, salesDetailUpdate,queryFlowByBizSn } from '@/api/sales'
|
|
|
export default{
|
|
|
- components: { OrderInfoModal, DiscountModal, commonModal, ProductModal },
|
|
|
+ components: { OrderInfoModal },
|
|
|
data(){
|
|
|
return{
|
|
|
tabsList:[{
|
|
@@ -129,24 +120,16 @@
|
|
|
color:this.$config('primaryColor'),
|
|
|
borderBottom:'4rpx solid '+this.$config('primaryColor')
|
|
|
},
|
|
|
- pageData: {
|
|
|
- type: 'edit',
|
|
|
- data: null
|
|
|
- },
|
|
|
- toggle: true,
|
|
|
toThousands,
|
|
|
- customBtnStyle: { // 自定义按钮样式
|
|
|
- borderColor: this.$config('primaryColor'),
|
|
|
- backgroundColor: this.$config('primaryColor'),
|
|
|
- color: '#fff'
|
|
|
- },
|
|
|
+
|
|
|
listData: [],
|
|
|
pageNo: 1,
|
|
|
- pageSize: 6,
|
|
|
+ pageSize: 10,
|
|
|
totalNum: 0,
|
|
|
status: 'loadmore',
|
|
|
noDataText: '暂无数据',
|
|
|
scrollH: 916,
|
|
|
+
|
|
|
infoModal: false,
|
|
|
discountModal: false,
|
|
|
commonModal: false,
|
|
@@ -157,7 +140,7 @@
|
|
|
productInfo: null, // 编辑产品需要的参数
|
|
|
editInfo: null, // 添加/编辑 提交的值
|
|
|
commonType: 1, // 公共弹框类型 1删除产品,2删除销售单,3编辑产品时库存不足
|
|
|
- payRecode:null
|
|
|
+ payRecode:[]
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
@@ -175,26 +158,11 @@
|
|
|
if (pageNo) {
|
|
|
this.pageNo = pageNo
|
|
|
}
|
|
|
- let params = {
|
|
|
- pageNo: this.pageNo,
|
|
|
- pageSize: this.pageSize,
|
|
|
- bizSn: this.salesBillSn
|
|
|
- }
|
|
|
- this.status = "loading"
|
|
|
- queryFlowByBizSn(params).then(res => {
|
|
|
+ queryFlowByBizSn({bizSn: this.salesBillSn}).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
- if (this.pageNo > 1) {
|
|
|
- this.payRecode = this.payRecode.concat(res.data.list || []);
|
|
|
- } else {
|
|
|
- this.payRecode = res.data.list || [];
|
|
|
- }
|
|
|
- this.totalNum = res.data.count || 0;
|
|
|
- } else {
|
|
|
- this.payRecode = [];
|
|
|
- this.totalNum = 0;
|
|
|
- this.noDataText = res.message;
|
|
|
+ this.payRecode =res.data
|
|
|
}
|
|
|
- this.status = 'loadmore';
|
|
|
+
|
|
|
})
|
|
|
},
|
|
|
changeTabs(index){
|
|
@@ -205,6 +173,17 @@
|
|
|
this.getDetail()
|
|
|
this.getRecodeData(1)
|
|
|
},
|
|
|
+ // 销售单详情
|
|
|
+ getDetail(){
|
|
|
+ salesDetailBySn({ salesBillSn: this.salesBillSn }).then(res => {
|
|
|
+ if(res.status == 200){
|
|
|
+ this.detailData = res.data
|
|
|
+ }else{
|
|
|
+ this.detailData = null
|
|
|
+ }
|
|
|
+ this.toggle = false
|
|
|
+ })
|
|
|
+ },
|
|
|
// 列表
|
|
|
getList(pageNo){
|
|
|
const _this = this
|
|
@@ -249,181 +228,6 @@
|
|
|
this.getList()
|
|
|
this.getRecodeData()
|
|
|
}
|
|
|
- },
|
|
|
- // 折扣金额
|
|
|
- discountConfirm(amount){
|
|
|
- let params = {
|
|
|
- discountAmount: amount,
|
|
|
- salesBillSn: this.detailData.salesBillSn,
|
|
|
- id: this.detailData.id
|
|
|
- }
|
|
|
- salesDiscount(params).then(res => {
|
|
|
- if(res.status == 200){
|
|
|
- this.init()
|
|
|
- this.discountModal = false
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 提交
|
|
|
- handleSubmit(){
|
|
|
- salesSubmit({ id: this.detailData.id }).then(res => {
|
|
|
- if(res.status == 200){
|
|
|
- this.toashMsg(res.message)
|
|
|
- uni.$emit('refreshSalesBL')
|
|
|
- uni.navigateBack()
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 编辑
|
|
|
- handleEdit(data){
|
|
|
- this.productInfo = {
|
|
|
- productName: data.productName,
|
|
|
- productMainImage: data.productMainImage,
|
|
|
- productCode: data.productCode,
|
|
|
- productOrigCode: data.productOrigCode,
|
|
|
- warehouseName: data.warehouseEntity && data.warehouseEntity.name,
|
|
|
- warehouseLocationName: data.warehouseLocationEntity && data.warehouseLocationEntity.name,
|
|
|
- price: data.price,
|
|
|
- qty: data.qty
|
|
|
- }
|
|
|
- this.openProductModal = true
|
|
|
- this.productData = data
|
|
|
- },
|
|
|
- // 确认产品信息
|
|
|
- productConfirm(data){
|
|
|
- this.editInfo = data
|
|
|
- this.validateStock() //验证 库存是否不足
|
|
|
- },
|
|
|
- // 库存不足
|
|
|
- validateStock(){
|
|
|
- // 校验库存
|
|
|
- stockByProductSn({ productSn: this.productData.productSn }).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- if (res.data && (!res.data.currentStockQty || this.editInfo.qty <= res.data.currentStockQty)) {
|
|
|
- this.editProduct()
|
|
|
- } else { // 库存不足
|
|
|
- this.commonType = 3
|
|
|
- this.modalText = '库存不足,将产生急件,确认修改吗?'
|
|
|
- this.commonModal = true
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 编辑产品
|
|
|
- editProduct(){
|
|
|
- let params = {
|
|
|
- id: this.productData.id,
|
|
|
- qty: this.editInfo.qty,
|
|
|
- price: this.editInfo.price,
|
|
|
- productSn: this.productData.productSn,
|
|
|
- salesBillSn: this.detailData.salesBillSn,
|
|
|
- }
|
|
|
- salesDetailUpdate(params).then(res => {
|
|
|
- if(res.status == 200){
|
|
|
- this.toashMsg(res.message)
|
|
|
- this.init()
|
|
|
- this.commonModal = false
|
|
|
- this.openProductModal = false
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 删除
|
|
|
- handleDel(item){
|
|
|
- if(item){ // 删除产品
|
|
|
- this.commonType = 1
|
|
|
- this.productData = item
|
|
|
- this.modalText = '确认要删除吗?'
|
|
|
- this.commonModal = true
|
|
|
- }else{ // 整单删除
|
|
|
- this.commonType = 2
|
|
|
- this.productData = null
|
|
|
- this.modalText = '确认删除该销售单吗?'
|
|
|
- this.commonModal = true
|
|
|
- }
|
|
|
- },
|
|
|
- // 公共弹框 确定
|
|
|
- handleCommon(){
|
|
|
- if(this.commonType == 1){ // 删除产品
|
|
|
- this.delFun()
|
|
|
- }else if(this.commonType == 2){ // 整单删除
|
|
|
- this.delFun()
|
|
|
- }else if(this.commonType == 3){ // 编辑产品时库存不足
|
|
|
- this.editProduct()
|
|
|
- }
|
|
|
- },
|
|
|
- // 公共弹框 取消
|
|
|
- handleCancel(){
|
|
|
- this.openProductModal = false
|
|
|
- },
|
|
|
- // 删除
|
|
|
- delFun(){
|
|
|
- let url = salesDetailDel
|
|
|
- let params = {}
|
|
|
- console.log(this.commonType)
|
|
|
- if(this.commonType == 1){ // 删除产品
|
|
|
- url = salesDetailDel
|
|
|
- params = { id: this.productData.id }
|
|
|
- }else if(this.commonType == 2){ // 整单删除
|
|
|
- console.log('整单删除', this.detailData)
|
|
|
- url = salesDel
|
|
|
- params = { id: this.detailData && this.detailData.id }
|
|
|
- }
|
|
|
- url(params).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- if(this.productData){ // 删除产品
|
|
|
- this.toashMsg(res.message)
|
|
|
- this.init()
|
|
|
- }else{ // 整单删除
|
|
|
- this.toashMsg(res.message)
|
|
|
- uni.$emit('refreshSalesBL')
|
|
|
- uni.navigateBack()
|
|
|
- }
|
|
|
- this.commonModal = false
|
|
|
- } else {
|
|
|
- this.commonModal = false
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 选择产品
|
|
|
- handleProduct(){
|
|
|
- uni.navigateTo({ url: '/pages/sales/chooseProduct?data='+JSON.stringify(this.detailData) })
|
|
|
- },
|
|
|
- // 编辑
|
|
|
- goPage(){
|
|
|
- uni.redirectTo({ url: '/pages/sales/edit?pageType=edit&data='+JSON.stringify(this.detailData) })
|
|
|
- },
|
|
|
- // 销售单详情
|
|
|
- getDetail(){
|
|
|
- salesDetailBySn({ salesBillSn: this.salesBillSn }).then(res => {
|
|
|
- if(res.status == 200){
|
|
|
- this.detailData = res.data
|
|
|
- }else{
|
|
|
- this.detailData = null
|
|
|
- }
|
|
|
- this.toggle = false
|
|
|
- })
|
|
|
- },
|
|
|
- changeScrollH(){
|
|
|
- const _this = this
|
|
|
- uni.getSystemInfo({
|
|
|
- success: function (res) {
|
|
|
- const winH = res.windowHeight * 2
|
|
|
- let totalH = _this.$refs.salesTotal && _this.$refs.salesTotal.$el && _this.$refs.salesTotal.$el.offsetHeight || 0
|
|
|
- if(_this.toggle){
|
|
|
- _this.scrollH = winH - 656 - totalH
|
|
|
- }else{
|
|
|
- _this.scrollH = winH - 522 - totalH
|
|
|
- }
|
|
|
- // if(_this.detailData&&_this.detailData.billStatus=='FINISH'){
|
|
|
- _this.scrollH = _this.scrollH + 100
|
|
|
- // }
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- watch: {
|
|
|
- toggle (newValue, oldValue) {
|
|
|
- this.changeScrollH()
|
|
|
}
|
|
|
}
|
|
|
}
|