|
@@ -2,7 +2,7 @@
|
|
|
<view class="sales-edit-wrap">
|
|
|
<!-- 基础信息 -->
|
|
|
<view class="sales-info-con">
|
|
|
- <u-section @click="infoModal=true" title="基础信息" sub-title="查看全部" :line-color="$config('primaryColor')"></u-section>
|
|
|
+ <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>{{pageData.data && pageData.data.salesBillNo || '--'}}</text>
|
|
@@ -16,10 +16,13 @@
|
|
|
<view class="sales-product-con">
|
|
|
<!-- 标题 -->
|
|
|
<view class="sales-product-header border-b flex align_center justify_between">
|
|
|
- <u-section title="产品列表" :line-color="$config('primaryColor')">
|
|
|
- <template slot="right">
|
|
|
+ <u-section title="产品列表" :right="pageData.type=='edit'" :line-color="$config('primaryColor')">
|
|
|
+ <template slot="right" v-if="pageData.type=='edit'">
|
|
|
<view class="sales-product-operation">
|
|
|
- <u-button @click="discountModal=true" size="mini" :hair-line="false" plain type="primary" hover-class="none">打折</u-button>
|
|
|
+ <u-button @click="discountModal=true" size="mini" :hair-line="false" plain type="primary" hover-class="none">
|
|
|
+ 打折
|
|
|
+ <text v-if="discountAmount">:¥{{discountAmount}}</text>
|
|
|
+ </u-button>
|
|
|
<u-button @click="" size="mini" :hair-line="false" plain type="primary" hover-class="none">选择产品</u-button>
|
|
|
</view>
|
|
|
</template>
|
|
@@ -57,7 +60,7 @@
|
|
|
<view class="sales-item-name">{{item.productName || '--'}}</view>
|
|
|
<view class="sales-item-txt flex align_center justify_between">
|
|
|
<view>{{item.productCode || '--'}}</view>
|
|
|
- <u-icon name="trash-fill" :color="$config('errorColor')" size="34"></u-icon>
|
|
|
+ <u-icon v-if="pageData.type=='edit'" @click="handleDel(item)" name="trash-fill" :color="$config('errorColor')" size="34"></u-icon>
|
|
|
</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">
|
|
@@ -79,24 +82,29 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 操作按钮 -->
|
|
|
- <view class="sales-btn-box flex align_center justify_between">
|
|
|
- <u-button class="handle-btn" size="medium" hover-class="none" @click="resetForm">整单删除</u-button>
|
|
|
- <u-button class="handle-btn search-btn" size="medium" hover-class="none" :custom-style="customBtnStyle" @click="handleSearch">提交</u-button>
|
|
|
+ <view class="sales-btn-box">
|
|
|
+ <view v-if="pageData.type=='edit'" class="flex align_center justify_between">
|
|
|
+ <u-button class="handle-btn" size="medium" hover-class="none" @click="handleDel()">整单删除</u-button>
|
|
|
+ <u-button class="handle-btn search-btn" size="medium" hover-class="none" :custom-style="customBtnStyle" @click="handleSearch">提交</u-button>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<!-- 基础信息 -->
|
|
|
<orderInfoModal :openModal="infoModal" :infoData="pageData.data" @close="infoModal=false" />
|
|
|
<!-- 折扣 -->
|
|
|
- <discountModal :openModal="discountModal" :infoData="pageData.data" @close="discountModal=false" />
|
|
|
+ <discountModal :openModal="discountModal" :infoData="pageData.data" :amount="discountAmount" @confirm="discountConfirm" @close="discountModal=false" />
|
|
|
+ <!-- 删除产品/整单删除弹框 -->
|
|
|
+ <common-modal :openModal="delModal" :content="delText" @confirm="handleConfirm" @close="delModal=false" />
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import commonModal from '@/pages/common/commonModal.vue'
|
|
|
import OrderInfoModal from './orderInfoModal.vue'
|
|
|
import DiscountModal from './discountModal.vue'
|
|
|
import { toThousands } from '@/libs/tools'
|
|
|
- import { salesDetailList } from '@/api/sales'
|
|
|
+ import { salesDetailList, salesDetailDel, salesDel } from '@/api/sales'
|
|
|
export default{
|
|
|
- components: { OrderInfoModal, DiscountModal },
|
|
|
+ components: { OrderInfoModal, DiscountModal, commonModal },
|
|
|
data(){
|
|
|
return{
|
|
|
pageData: {
|
|
@@ -116,9 +124,13 @@
|
|
|
totalNum: 0,
|
|
|
noDataText: '暂无数据',
|
|
|
theme: '',
|
|
|
- scrollH: 836,
|
|
|
+ scrollH: 1036,
|
|
|
infoModal: false,
|
|
|
- discountModal: false
|
|
|
+ discountModal: false,
|
|
|
+ discountAmount: 0,
|
|
|
+ delModal: false,
|
|
|
+ delText: '确认要删除吗?',
|
|
|
+ dataInfo: null,
|
|
|
}
|
|
|
},
|
|
|
onLoad(opt) {
|
|
@@ -174,12 +186,67 @@
|
|
|
this.getList()
|
|
|
}
|
|
|
},
|
|
|
+ discountConfirm(amount){
|
|
|
+ this.discountAmount = amount
|
|
|
+ this.discountModal = false
|
|
|
+ },
|
|
|
+ // 删除
|
|
|
+ handleDel(item){
|
|
|
+ if(item){ // 删除产品
|
|
|
+ this.dataInfo = item
|
|
|
+ this.delText = '确认要删除吗?'
|
|
|
+ this.delModal = true
|
|
|
+ }else{ // 整单删除
|
|
|
+ this.dataInfo = null
|
|
|
+ this.delText = '确认删除该销售单吗?'
|
|
|
+ this.delModal = true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 删除
|
|
|
+ handleConfirm(){
|
|
|
+ let url = salesDetailDel
|
|
|
+ let params = {}
|
|
|
+ if(this.dataInfo){ // 删除产品
|
|
|
+ url = salesDetailDel
|
|
|
+ params = { id: this.dataInfo.id }
|
|
|
+ }else{ // 整单删除
|
|
|
+ url = salesDel
|
|
|
+ params = { id: this.pageData.data && this.pageData.data.id }
|
|
|
+ }
|
|
|
+ url(params).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ if(this.dataInfo){ // 删除产品
|
|
|
+ this.toashMsg(res.message)
|
|
|
+ this.getList(1)
|
|
|
+ }else{ // 整单删除
|
|
|
+ this.toashMsg(res.message)
|
|
|
+ uni.$emit('refreshBL')
|
|
|
+ uni.navigateBack()
|
|
|
+ }
|
|
|
+ this.delModal = false
|
|
|
+ } else {
|
|
|
+ this.delModal = 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 - 556 - totalH
|
|
|
+ }else{
|
|
|
+ _this.scrollH = winH - 416 - totalH
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
toggle (newValue, oldValue) {
|
|
|
- const winH = window.innerHeight * 2
|
|
|
- let totalH = this.$refs.salesTotal && this.$refs.salesTotal.$el && this.$refs.salesTotal.$el.offsetHeight || 0
|
|
|
- this.scrollH = winH - 396 - totalH
|
|
|
+ this.changeScrollH()
|
|
|
}
|
|
|
}
|
|
|
}
|