vue-cli init

This commit is contained in:
2025-08-15 16:25:44 +08:00
parent e81805b4c0
commit 8e22afd798
590 changed files with 103286 additions and 213 deletions
+298
View File
@@ -0,0 +1,298 @@
<template>
<view>
<topDropdown :isSxShow="true" :isPaiXu="true" :dropdown1="dropdown1" :options1="options1" :optionsSx="sxList" :optionsPx="optionsPx" :isDuoXuan="true" searchLabel1="报价名称" searchPh1="请输入报价单名称" @searchBoxEmitFun="searchBoxEmitFun" @dropDownFun1="dropDownFun1" @optionSxFun="optionSxFun" @optionPxFun="optionPxFun" :isKhShow="true"></topDropdown>
<dataNull v-if="list.length == 0" src="/static/img/chahua/gjNull.png" title="暂无相关合同" title1="请添加或者更换搜索添加"></dataNull>
<scroll-view v-else scroll-y="true" :style="{height: scrollHeight}" @scrolltolower="selectDataFun"
refresher-enabled :refresher-threshold="200" :refresher-triggered="triggered" refresher-background="gray" @refresherrefresh="onRefresh" @refresherrestore="onRestore">
<view v-for="(item, index) in list" :key="index" @click="cardClickFun(item, index)">
<baojiadan :item="item" :isSelect="isSelect" :index="index"></baojiadan>
</view>
<getMore :isMore="isMore"></getMore>
</scroll-view>
<addBtn url="./addBjd"></addBtn>
</view>
</template>
<script>
let that = '';
import { crmBaoJiaDanApi } from '../../../static/utils/api.js'
import { tyDropDown, dropDownByUser, bjdDatePxData, bjdSxDropDownData } from '../../../static/utils/dropdown.js'
import {
getDayFun, getDayByNumFun
} from '@/static/utils/date.js'
import dataNull from '@/components/dataNull/dataNull.vue'
import addBtn from '@/components/addBtn/addBtn.vue'
import baojiadan from '@/components/card/baojiadan.vue'
import getMore from '@/components/getMore/getMore.vue'
import topDropdown from '../../../components/topDropdown/topDropdown.vue'
export default {
components: {
dataNull,
addBtn,
getMore,
baojiadan,
topDropdown
},
data() {
return {
dropdown1: '全部',
options1: [],
optionsPx: bjdDatePxData,
sxList: [],
list: [],
pageIndex: 1,
isMore: true,
scrollHeight: '667px',
triggered: false,
isSelect: false,
pageType: '',
sortObj: {
update_date: -1
},
optionsReq: {}, // 第一个下拉框请求参数
dateReq: [], // 日期相关请求参数
sxReq: JSON.stringify({}), // 筛选想请求参数
matchObj: {},
searchValue: '',
clientIdArr: [],
tabNoEqualArr: [], //标签页不等于数据
depId: undefined
}
},
onLoad(e) {
that = this;
let sxList = JSON.stringify(bjdSxDropDownData);
that.sxList = JSON.parse(sxList);
let obj = {};
if(uni.$userInfo.isDepManager) {
that.options1 = tyDropDown;
that.depId = uni.$userInfo.depManager_Id;
} else {
that.options1 = dropDownByUser;
obj.fuZeRenId = uni.$userInfo._id;
}
if(e.clientId) {
that.clientIdArr = [e.clientId]
}
that.matchObj = obj;
that.optionsReq = JSON.stringify(obj);
that.pageType = e.type ? e.type : '';
if(e.type) {
that.isSelect = true;
}
uni.getSystemInfo({
success(res) {
that.scrollHeight = res.windowHeight - 40 + 'px';
}
})
if(e.next_gjDate) {
let dateArr = getDayByNumFun(e.next_gjDate);
let dateObj = {
field: 'next_gjDate',
sTime: dateArr[1],
eTime: dateArr[0]
};
let arr = that.sxList;
arr[0].current = 0;
that.sxList = arr;
that.dateReq.push(dateObj)
} else {
let arr = that.sxList;
arr[0].current = '';
that.sxList = arr;
}
that.selectDataFun();
uni.$on('deleteCardFun', that.deleteCardFun);
uni.$on('updateBjdListByIndex', that.updateBjdListByIndex)
uni.$on('addBjdItemInListFun', that.addBjdItemInListFun)
},
onBackPress() {
uni.$off('deleteCardFun', that.deleteCardFun);
uni.$off('updateBjdListByIndex', that.updateBjdListByIndex)
uni.$off('addBjdItemInListFun', that.addBjdItemInListFun);
},
methods: {
// 查询报价单
selectDataFun: function() {
if (!that.isMore) {
return
}
uni.showLoading({
title: '加载中...',
mask: true
})
let reqObj = {
matchObj: that.matchObj,
dateReq: that.dateReq,
pageIndex: that.pageIndex,
sortObj: that.sortObj,
depId: that.depId,
tabNoEqualArr: that.tabNoEqualArr,
clientIdArr: that.clientIdArr,
searchValue: that.searchValue
}
let reqData = {
action: 'getBaoJiaDan',
params: reqObj
}
crmBaoJiaDanApi(reqData)
.then(res => {
this.triggered = false;
let data = res.result.data;
if (that.pageIndex == 1) {
that.list = [];
}
if (data.length == 20) {
that.pageIndex += 1;
that.isMore = true;
} else {
that.isMore = false;
}
that.list = that.list.concat(data);
console.log(">>>>===" + JSON.stringify(data));
})
},
// 卡片点击方法
cardClickFun: function(item, index) {
if(that.pageType == 'genjin') {
uni.$emit('gjOrderBindFun', item)
uni.navigateBack()
} else if(that.pageType != '') {
uni.$emit('baoJiaDanBindFun', item)
uni.navigateBack()
}
},
// 下拉框回调函数
dropDownFun1: function(e) {
let optionsReq = {};
let tabNoEqualArr = [];
let userInfo = uni.$userInfo;
that.depId = undefined;
if(e.label == '全部') {
that.depId = userInfo.depManager_Id;
} else if(e.label == '我负责的') {
optionsReq.fuZeRenId = userInfo._id;
} else if(e.label == '我创建的') {
optionsReq.cjRenId = userInfo._id;
} else if(e.label == '下属负责') {
that.depId = userInfo.depManager_Id;
tabNoEqualArr = [{
field: 'fuZeRenId',
value: userInfo._id
}]
optionsReq.department = userInfo.departmentId;
} else if(e.label == '下属创建') {
that.depId = userInfo.depManager_Id;
tabNoEqualArr = [{
field: 'cjRenId',
value: userInfo._id
}]
}
that.tabNoEqualArr = tabNoEqualArr;
that.optionsReq = JSON.stringify(optionsReq);
that.matchObj = Object.assign(optionsReq, JSON.parse(that.sxReq));
that.cxGetDataFun();
},
// 筛选框回调函数
optionSxFun: function(e) {
let arr = e.arr;
that.clientIdArr = e.selectKhList;
console.log(that.clientIdArr)
let matchReq = [];
let dateReq = [];
for (var i = 0; i < arr.length; i++) {
if(arr[i].current !== '' && !arr[i].isDate) {
matchReq.push({
field: arr[i].field,
value: arr[i].arr[arr[i].current]
})
} else if(arr[i].current !== '' && arr[i].isDate) {
dateReq.push({
field: arr[i].field,
sTime: arr[i].sTime,
eTime: arr[i].eTime
})
}
}
let reqObj = {};
// 动态生成请求对象
for(var i = 0; i < matchReq.length; i++) {
reqObj[matchReq[i].field] = matchReq[i].value
}
that.dateReq = dateReq;
that.sxReq = JSON.stringify(reqObj);
// 合并对象
that.matchObj = Object.assign(reqObj, JSON.parse(that.optionsReq));
that.cxGetDataFun();
},
// 排序筛选框回调函数
optionPxFun: function(arr) {
let sortObj = {
update_date: -1
}
for (var i = 0; i < arr.length; i++) {
if (arr[i].current !== '') {
sortObj = {}
if (arr[i].field == 'create_date') {
sortObj.create_date = arr[i].current == 1 ? 1 : -1
}
if (arr[i].field == 'update_date') {
sortObj.update_date = arr[i].current == 1 ? 1 : -1
}
if (arr[i].field == 'chengJiao_date') {
sortObj.chengJiao_date = arr[i].current == 1 ? 1 : -1
}
if (arr[i].field == 'bjPrice') {
sortObj.bjPrice = arr[i].current == 1 ? 1 : -1
}
that.sortObj = sortObj;
break;
}
}
that.cxGetDataFun();
},
// 搜索框回调方法
searchBoxEmitFun: function(e) {
that.searchValue = e.searchValue1;
that.cxGetDataFun()
},
// 下拉刷新
onRefresh: function() {
if(that.triggered) return
that.triggered = true;
that.cxGetDataFun();
},
onRestore: function(e) {
that.triggered = false; // 需要重置
},
// 重新获取数据
cxGetDataFun: function() {
that.pageIndex = 1;
that.isMore = true;
that.selectDataFun();
},
deleteCardFun: function(e) {
let arr = that.list;
arr.splice(e.index, 1);
that.list = arr;
},
// add页面新增数据
addBjdItemInListFun: function(e) {
that.cxGetDataFun()
},
// 通过下标更新list数据
updateBjdListByIndex: function(e) {
that.$set(that.list, parseInt(e.index), e.obj)
},
}
}
</script>
<style>
page {
background-color: #F8F8F8;
}
</style>
+400
View File
@@ -0,0 +1,400 @@
<!-- 滚动吸附效果演示 -->
<template>
<view class="content">
<z-paging ref="paging" :auto-clean-list-when-reload="false" :auto-scroll-to-top-when-reload="false" style="height: calc(100% - 55px);" @scrolltolower="scrollToBottomFun">
<!--客户基本信息-->
<baojiadan :item="infoObj" :isDetail="true"></baojiadan>
<!--tab-->
<view class="uTabsView">
<u-tabs :list="tabList" :is-scroll="true" duration="0.08" :current="tabIndex" :show-bar="false" font-size="32" @change="tabChange"></u-tabs>
</view>
<view class="contentView">
<!--详细信息-->
<view v-if="tabIndex == 0">
<bjDetail :infoObj="infoObj"></bjDetail>
</view>
<!--产品信息-->
<view v-if="tabIndex == 1">
<view class="myCard" v-if="tabList[1].arr.length > 0">
<view class="cardTopName">产品汇总</view>
<view class="flexRow">
<view>
<view>总数量:</view>
<view>{{cpHzObj.totalNum}}</view>
</view>
<view>
<view>价格合计:</view>
<view>{{(cpHzObj.price).toFixed(2)}}元</view>
</view>
</view>
<view class="flexRow">
<view>
<view>总折扣%:</view>
<view>{{(cpHzObj.discount).toFixed(2)}}</view>
</view>
<view>
<view>最终价格:</view>
<view>{{(cpHzObj.sumPrice).toFixed(2)}}</view>
</view>
</view>
</view>
<view v-for="(item, index) in tabList[1].arr" :key="index">
<cp1Card :item="item"></cp1Card>
</view>
</view>
<!--跟进记录-->
<view v-if="tabIndex == 2">
<view v-for="(item, index) in tabList[2].arr" :key="index">
<genjin :item="item"></genjin>
</view>
</view>
<!--操作记录-->
<view v-if="tabIndex == 3">
<view>
<czjl :infoObj="infoObj" fl="报价单" :dataId="infoObj._id"></czjl>
</view>
</view>
<!--加载更多-->
<getMore :isMore="tabList[tabIndex].isMore"></getMore>
</view>
</z-paging>
<bottomBox :sheetList="sheetList" @pageGenjinFun="pageGenjinFun" @pageDeleteShowFun="pageDeleteShowFun" @pageBianjiFun="pageBianjiFun"></bottomBox>
<u-select v-model="selectShow" :list="selectList" @confirm="selectConfirmFun"></u-select>
</view>
</template>
<script>
let that = '';
import { crmGenJinApi, crmLianXiRenApi, crmShangJiApi, crmBaoJiaDanApi, crmHeTongApi } from '../../../static/utils/api.js'
import bottomBox from '@/components/bottomBox/bottomBox'
import baojiadan from '@/components/card/baojiadan.vue'
import cp1Card from '@/components/card/cp1Card.vue'
import bjDetail from '@/components/detail/bjDetail.vue'
import czjl from '@/components/detail/czjl.vue'
import genjin from '@/components/card/genjin.vue'
import getMore from '@/components/getMore/getMore.vue'
export default {
components: {
baojiadan,
bottomBox,
cp1Card,
bjDetail,
czjl,
genjin,
getMore
},
data() {
return {
selectList: [],
selectShow: false,
infoObj: {},
dataList: [
],
tabList: [
{ name: '详细信息', arr: [], pageIndex: 1, isMore: false },
{ name: '产品信息', arr: [], pageIndex: 1, isMore: true },
{ name: '跟进记录', arr: [], pageIndex: 1, isMore: true },
{ name: '操作记录', arr: [], pageIndex: 1, isMore: true }
],
sheetList: [
{ text: '更换负责人' },
{ text: '放入客户池' },
{ text: '删除' }
],
tabIndex: 0,
refresherStatus: 0,
cardIndex: 0,
isLoadSelectById: false
}
},
onLoad(e) {
that = this;
that.cardIndex = e.index;
if(e.fromDetail) {
that.selectDetailByIdFun(e._id)
} else {
that.infoObj = uni.$bjInfo || {};
let infoObj = that.infoObj;
// if(infoObj.cpList && infoObj.cpList.length > 0) {
// let cpItem = that.tabList[1];
// cpItem.arr = infoObj.cpList;
// cpItem.name += '(' + infoObj.cpList.length + ')';
// that.$set(that.tabList, 1, cpItem)
// }
}
},
onShow() {
if(that.isLoadSelectById) {
that.selectDetailByIdFun();
}
},
onBackPress(e) {
if(e.from == 'backbutton' && this.cardIndex != -1) {
let obj = this.infoObj;
uni.$emit('updateBjdListByIndex', { index: this.cardIndex, obj})
}
},
methods: {
tabChange(index) {
this.tabIndex = index;
let item = that.tabList[index];
if(item.arr && item.arr.length > 0) {
return
}
if(index == 1) {
that.getCpByIdFun()
}
if(index == 2) {
that.getGenJinFun()
}
},
scrollToBottomFun: function(e) {
let index = that.tabIndex;
let isMore = that.tabList[index].isMore;
if(!isMore) {
return
}
if(index == 2) {
that.getGenJinFun()
} else if(index == 2) {
}
},
// 获取跟进记录
getGenJinFun: function() {
uni.showLoading({
title: '加载中...',
mask: true
})
let item = that.tabList[that.tabIndex];
let reqData = {
action: 'selectLGenjinJl',
params: {
matchObj: {
clientId: that.infoObj.clientId,
glOrderId: that.infoObj._id
},
sortObj: {
update_date: -1
},
pageIndex: item.pageIndex
}
}
crmGenJinApi(reqData)
.then(res => {
that.setTabArrFun(res.result.data, item)
})
},
// 给tabList中的arr赋值
setTabArrFun: function(data, item) {
if (item.pageIndex == 1) {
item.arr = [];
}
if (data.length >= 10) {
item.pageIndex += 1;
item.isMore = true;
} else {
item.isMore = false;
}
item.arr = item.arr.concat(data);
that.$set(that.tabList, that.tabIndex, item)
},
// 新增跟进信息
pageGenjinFun: function() {
that.isLoadSelectById = true;
uni.navigateTo({
url: '../genJin/add?clientName=' + that.infoObj.clientName + '&clientId=' + that.infoObj.clientId + '&glkhLxr=' + that.infoObj.clientLxr + '&glkhLxrId=' + that.infoObj.clientLxrId + '&orderType=报价单' + '&glOrderId=' + that.infoObj._id + '&glOrder=' + that.infoObj.bjdCode
})
},
// 修改信息
pageBianjiFun: function() {
that.isLoadSelectById = true;
uni.$infoObj = that.infoObj;
uni.navigateTo({
url: './addBjd?type=update'
})
},
// 更多回调方法
pageDeleteShowFun: function(e) {
uni.showModal({
title: '提示',
content: '是否确认删除报价单名称为:' + that.infoObj.bjName + '的报价单吗?',
success(res) {
if(res.confirm) {
uni.showLoading({
title: '删除中...',
mask: true
})
let reqData = {
action: 'update',
params: {
_id: that.infoObj._id,
req: {
isDelete: 1,
update_date: new Date().getTime()
}
}
}
crmBaoJiaDanApi(reqData)
.then(res => {
uni.showToast({
title: '删除成功!',
duration: 888,
icon: 'none'
})
uni.$emit('deleteCardFun', {index: that.cardIndex})
that.addCzjlFun();
setTimeout(()=> {
uni.navigateBack()
}, 666)
})
}
}
})
},
addCzjlFun: function() {
let czjlObj = {
create_date: new Date().getTime(),
czRen: uni.$userInfo._id,
pageType: 'quotation',
dataId: this.infoObj._id,
type: '删除'
}
uni.$czjlApiAddFun(czjlObj);
},
// 根据id查询
selectDetailByIdFun: function(_id) {
uni.showLoading({
title: '加载中...',
mask: true
})
let reqData = {
action: 'selectDetailById',
params: {
_id: ''
}
}
if(_id) {
reqData.params._id = _id;
} else {
reqData.params._id = that.infoObj._id;
}
crmBaoJiaDanApi(reqData)
.then(res => {
let data = res.result.data;
if(data.length > 0) {
that.infoObj = data[0]
} else {
uni.showModal({
title: '提示',
content: '相关内容不存在,或者已被删除!',
showCancel: false,
success() {
uni.navigateBack()
}
})
}
})
},
// 根据id查询产品
getCpByIdFun: function() {
let reqData = {
action: 'getCp',
params: {
bjdId: that.infoObj._id
}
}
crmBaoJiaDanApi(reqData)
.then(res => {
let data = res.result.data;
let cpHzObj = {
discount: 0,
price: 0,
sumPrice: 0,
totalNum: 0
};
for(var i = 0; i < data.length; i++) {
var obj = data[i];
obj.discount = (obj.sellingPrice / obj.price * 100).toFixed(2);
obj.totalPrice = (obj.sellingPrice * obj.num).toFixed(2);
data[i] = obj;
cpHzObj.price += parseFloat(obj.price) * obj.num;
cpHzObj.sumPrice += parseFloat(obj.sellingPrice) * obj.num;
cpHzObj.totalNum += obj.num;
}
cpHzObj.discount = cpHzObj.sumPrice / cpHzObj.price * 100;
that.cpHzObj = cpHzObj;
let item = that.tabList[that.tabIndex];
item.arr = data;
item.isMore = false;
that.$set(that.tabList, that.tabIndex, item)
})
}
}
}
</script>
<style>
page {
height: 100%;
background-color: #F8F8F8;
}
.content {
height: 100%;
/* 父节点建议开启flex布局 */
display: flex;
flex-direction: column;
}
.uTabsView {
border-bottom: 1rpx solid #DDDDDD;
z-index: 100;
position: sticky;
top :0;
}
.contentView {
/* background-color: #FFFFFF; */
min-height: calc(100vh - 45px);
}
.flexRow {
display: flex;
font-size: 30rpx;
margin-bottom: 8rpx;
}
.flexRow>view {
width: 50%;
display: flex;
}
.flexRow>view>text:first-child {
width: 166rpx;
}
.item {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
}
.item-detail {
padding: 5rpx 15rpx;
border-radius: 10rpx;
font-size: 28rpx;
color: white;
background-color: #007AFF;
}
.item-line {
position: absolute;
bottom: 0rpx;
left: 0rpx;
height: 1px;
width: 100%;
background-color: #eeeeee;
}
.uTabsView {
top: -2px !important;
}
</style>
+35
View File
@@ -0,0 +1,35 @@
/*!
* Copyright (c) 2013-Now http://aidex.vip All rights reserved.
* @author aidex
* @version 2020-9-1
*/
.toolbar {
background-color: #fff;
}
.wrap .box .item{
margin: 0 0 0px;
border-radius: 0;
.title {
padding-left:0;
.text {
font-size: 30rpx;
font-weight:500;
margin: 0;
color: #202328;
}
}
}
.grid {
.grid-icon {
color: #666;
}
.grid-text {
font-size: 24rpx;
padding: 15rpx;
color: #202328;
}
}
+216
View File
@@ -0,0 +1,216 @@
<template>
<view>
<button type="primary" @click="onShowDatePicker('range')">单据日期 {{range[0]}} - {{range[1]}}</button>
<view class="u-demo-block">
<view class="u-page__tag-item">
<u-search v-model="searchBillNo" :show-action="false"
@custom="onTabChange" @search="onTabChange"
placeholder="请输入单号或往来单位">
</u-search>
</view>
</view>
<u-sticky>
<div style="height: 43px; border-bottom: 1rpx solid #eeeeee; background-color: #FFFFFF;">
<u-tabs :list="tabList" name="title" active-color="red" :is-scroll="false"
:current="activeTabIndex" @change="onTabChange"></u-tabs>
</div>
</u-sticky>
<dataNull v-if="ItemDataList.length == 0" src="/static/img/chahua/gjNull.png" title="暂无相关销售付运资料" title1="请添加或者更换搜索添加">
</dataNull>
<scroll-view v-else scroll-y="true" :style="{height: scrollHeight}"
refresher-enabled :refresher-threshold="200" :refresher-triggered="triggered" refresher-background="gray">
<view v-for="(item, index) in ItemDataList" :key="index" @click="cardClickFun(item, index)">
<saleShipmentOutView :item="item" :isSelect="isSelect" :index="index"></saleShipmentOutView>
</view>
</scroll-view>
<addBtn url="./saleShipmentOutAdd"></addBtn>
<mx-date-picker :show="showPicker" :type="BillDatetype" :value="BillDatevalue"
:show-tips="true" :begin-text="'开始'" :end-text="'结束'"
:show-seconds="false" @confirm="BillDateConfirm" @cancel="BillDateConfirm" />
</view>
</template>
<script>
let that = '';
import addBtn from '@/components/addBtn/addBtn.vue'
import saleShipmentOutView from '@/pages/saleship/saleShipmentOutView.vue';
import util from '../../common/util';
import MxDatePicker from "@/components/mx-datepicker/mx-datepicker.vue";
export default {
components: {
saleShipmentOutView,
MxDatePicker
},
data() {
return {
tabList: [
{title: '未审核', status: '0'},
{title: '已审核', status: '1'},
],
activeTabIndex: 0,
ItemDataList: [],
pageIndex: 1,
isMore: true,
scrollHeight: '667px',
triggered: false,
isSelect: false,
searchBillNo: '',
showPicker: false,
BillBeginDate: new Date(new Date()-24*60*60*1000).toLocaleDateString(),
BillEndDate: new Date().toLocaleDateString(),
range: [new Date(new Date()-24*60*60*1000).toLocaleDateString(), new Date().toLocaleDateString()],
BillDatetype: 'range',
}
},
onLoad(e) {
that = this;
uni.getSystemInfo({
success(res) {
that.scrollHeight = res.windowHeight - 40 + 'px';
}
})
that.SaleShipmentOutData();
},
watch: {
activeTabIndex: {
deep: true, // 深度监听
handler(newVal, oldVal) {
console.log("activeTabIndex参数改变,即将刷新...", `新值:${newVal}`, `旧值:${oldVal}`);
this.onTabChange(newVal);
}
}
},
// 上拉加载
onReachBottom: function () {
console.log("activeTabIndex参数改变,即将刷新..." + this.activeTabIndex);
/*
if (this.pagination.hasNextPage) {
this.doInfinite()
}
*/
},
onBackPress() {
/*uni.$off('deleteCardFun', that.deleteCardFun);
uni.$off('updateBjdListByIndex', that.updateBjdListByIndex)
uni.$off('addBjdItemInListFun', that.addBjdItemInListFun);*/
},
methods: {
onTabChange(index) {
const _self = this;
this.activeTabIndex = index;
if (this.activeTabIndex == 0) {
console.log("---->>未审核<<----");
this.StoreGoodsBusinessOutData();
} else {
console.log("---->>已审核<<----");
this.StoreGoodsBusinessOutDataCommit();
}
},
onShowDatePicker(type){//显示
this.BillDatetype = type;
this.showPicker = true;
this.BillDatevalue = this[type];
},
BillDateConfirm(e) {//选择
this.showPicker = false;
if(e) {
this[this.BillDatetype] = e.value;
this.BillBeginDate = e.value[0];
this.BillEndDate = e.value[1];
}
},
SaleShipmentOutData: function() {
let aCommitStatus = 0;
if (this.activeTabIndex == 0) {
aCommitStatus = 0
}
else if (this.activeTabIndex == 1) {
aCommitStatus = 1
};
uni.request({
url: util.apiurl + 'rest/db/opensql',
data: {
token: getApp().globalData.Token,
format: 'json',
data: {
db_name: getApp().globalData.AppDBName,
sql_command_id: 'APP.GetSaleShipmentOutDataSQL',
params: [{
name: 'CommitStatus',
value: aCommitStatus
}, {
name: 'LOGINID',
value: getApp().globalData.LoginID
}]
},
},
success: (res) => {
this.triggered = false;
let data = res.data.data;
console.log("---->" + JSON.stringify(res.data));
that.ItemDataList = that.ItemDataList.concat(data);
},
})
},
SaleShipmentOutDataCommit: function() {
let aCommitStatus = 0;
if (this.activeTabIndex == 0) {
aCommitStatus = 0
}
else if (this.activeTabIndex == 1) {
aCommitStatus = 1
};
uni.request({
url: util.apiurl + 'rest/db/opensql',
data: {
token: getApp().globalData.Token,
format: 'json',
data: {
db_name: getApp().globalData.AppDBName,
sql_command_id: 'APP.GetSaleShipmentOutDataCommitSQL',
params: [{
name: 'CommitStatus',
value: aCommitStatus
}, {
name: 'LOGINID',
value: getApp().globalData.LoginID
}]
},
},
success: (res) => {
this.triggered = false;
let data = res.data.data;
console.log("---->" + JSON.stringify(res.data));
that.ItemDataList = that.ItemDataList.concat(data);
},
})
},
// 卡片点击方法
cardClickFun: function(item, index) {
console.log("-BillMasterID-->>" + item.BillMasterID );
uni.navigateTo({
url: '/pages/saleship/saleShipmentOutDetail?billid=' + item.BillMasterID
})
},
}
}
</script>
<style>
page {
background-color: #F8F8F8;
}
button{
margin: 20upx;
font-size: 28upx;
}
</style>
+910
View File
@@ -0,0 +1,910 @@
<template>
<view>
<u-form ref="uForm">
<view class="flex-white-plr26 ptb10 mt32 bdb_f5">
<text class="mr26">付运凭证</text>
<u-input disabled placeholder="自动生成" v-model="SaleShipmentOutBillNo" />
<text class="mr26">付运日期</text> {{$u.timeFormat(SaleShipmentOutDate, 'yyyy-mm-dd')}}
</view>
<view @click="pickerSelectFun('仓库名称')" class="flex-white-plr26 ptb20 bdb_f5">
<text class="mr26">仓库名称<text class="redXingh">*</text></text>
<view :class="StoreName ? '' : 'cBlack'"> {{StoreName ? StoreName : '请选择'}}
<u-icon class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
</view>
</view>
<view @click="pickerSelectFun('司机名称')" class="flex-white-plr26 ptb20 bdb_f5">
<text class="mr26">司机名称</text>
<view :class="ShipCarUserName ? '' : 'cBlack'">
{{ShipCarUserName ? ShipCarUserName : '请选择'}}
<u-icon class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
</view>
</view>
<view @click="pickerSelectFun('车牌号码')" class="flex-white-plr26 ptb20 bdb_f5">
<text class="mr26">车牌号码</text>
<view :class="ShipCarNo ? '' : 'cBlack'">
{{ShipCarNo ? ShipCarNo : '请选择'}}
<u-icon class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
</view>
</view>
<view class="flex-white-plr26-column ptb20 mt32">
<view style="margin-bottom: 8rpx;">
<text>备注内容</text>
</view>
<u-input v-model="Remark" maxlength="-1" type="textarea" :border="true" :height="100"
:auto-height="true" />
</view>
<u-form-item label-width="150" label="条码资料:">
<input type="text" maxlength="-1" v-model="QRBarCode" :focus="QRBarCodeFocus"
style="width:200px;" @confirm="SaleShipmentOutDetailScan" />
<checkbox-group @change="BarCodeDelChange">
<checkbox ref="checkBoxRef" :checked="BarCodeDelStatus">删除</checkbox>
</checkbox-group>
</u-form-item>
<u-form-item>
<text class="title">{{BillDataMessage}}</text>
</u-form-item>
<u-form-item>
<text class="title" style="width:200px;">出仓单号:{{OutBillNo}}</text>
<text class="title" style="width:200px;">出仓日期:{{OutBillDate}}</text>
</u-form-item>
<u-form-item>
<text class="title" style="width:200px;">单据类型:{{BillTypeName}}</text>
<text class="title" style="width:200px;">配布单号:{{SaleBillNo}}</text>
</u-form-item>
<u-form-item>
<text class="title" style="width:200px;">往来单位:{{CustomerName}}</text>
<text class="title" style="width:200px;">销 售 员:{{SaleUserName}}</text>
</u-form-item>
<u-form-item>
<text class="title" style="width:200px;">付运单数:{{ShipOutBillNum}}单</text>
</u-form-item>
<u-form-item>
<text class="title" style="width:200px;">付运单据条数:{{ShipBillSumRoll}}条</text>
<text class="title" style="width:200px;">付运单据重量:{{ShipBillSumQty}}Kg</text>
</u-form-item>
<u-form-item>
<text class="title" style="width:200px;">出仓单据条数:{{OutBillSumRoll}}条</text>
<text class="title" style="width:200px;">出仓单据重量:{{OutBillSumQty}}Kg</text>
</u-form-item>
</u-form>
<view class="u-demo-area">
<u-toast ref="uToast"></u-toast>
<wyb-table ref="table" :headers="headersMaster" :contents="GoodsDetailList" />
</view>
<!--提交按钮-->
<view class="submitView">
<u-button type="primary" style="width:100px;" class="submitBtn"
:ripple="true" ripple-bg-color="#909399" @click="submitBtnFun">
{{pageType ? '保存' : '提交'}}
</u-button>
<u-button type="primary" style="width:100px;" class="commitBtn"
:ripple="true" ripple-bg-color="#909399" @click="commitBtnFun">
{{commitType ? '消审' : '审核'}}
</u-button>
</view>
<!--组件-->
<!-- <u-action-sheet :list="StoreNameDataList" v-model="actionSheetShow" @click="actionSheetCallback"></u-action-sheet> -->
<u-select v-model="selectShow" :list="selectList" @confirm="selectConfirmFun"></u-select>
</view>
</template>
<script>
let that = '';
import util, {
parFabricGoodsBarCode2D,
parYarnGoodsBarCode2D,
playSuccessAudio,
playErrorAudio
} from '../../common/util';
import wybTable from '@/components/wyb-table/wyb-table.vue';
export default {
data() {
return {
selectShow: false,
selectList: [],
selectType: '',
pageType: '',
commitType: '',
QRBarCodeFocus: true,
SaleShipmentOutBillID: 0,
SaleShipmentOutBillNo: '',
SaleShipmentOutDate: '',
OutBillNo: '',
OutBillDate: '',
SaleBillNo: '',
BillTypeName: '',
CustomerName: '',
SaleUserName: '',
StoreNameID: 0,
StoreName: '',
ShipCarID: 0,
ShipCarNo: '',
ShipCarUserID: 0,
ShipCarUserName: '',
actionSheetShow: false,
BarCodeDelStatus: false,
Remark: '',
GoodsDetailList: [],
StoreNameDataList: [],
ShipCarUserDataList: [],
ShipCarNoDataList: [],
QRBarCode: '',
ShipOutBillNum: 0,
OutBillSumRoll: 0,
OutBillSumQty: 0,
ShipBillSumRoll: 0,
ShipBillSumQty: 0,
BillDataMessage: '',
headersMaster: [{
label: '出仓单号',
key: 'OutBillNo'
},{
label: '配布单号',
key: 'SaleBillNo'
}, {
label: '出仓日期',
key: 'OutBillDate'
}, {
label: '往来单位',
key: 'CustomerName'
}, {
label: '销售员',
key: 'SaleUserName'
}, {
label: '单据类型',
key: 'BillTypeName'
}, {
label: '条数',
key: 'Roll'
}, {
label: '重量',
key: 'Qty'
}, {
label: '仓库名称',
key: 'StoreName'
}],
}
},
watch: {
cpList: function(val, old) {
that.cpCalcFun();
}
},
onLoad(e) {
that = this;
setTimeout(() => {
this.getStoreNameData();
}, 100);
setTimeout(() => {
this.getShipCarUserData();
}, 300);
setTimeout(() => {
this.getBaseDataShipCarNo();
}, 500);
if (getApp().globalData.StoreTypeNo.toUpperCase() == 'STOREFABRICGOODS') {
this.StoreNameID = getApp().globalData.StoreNameID;
this.StoreName = getApp().globalData.StoreName;
};
/* uni.$on('bjdKehuBindFun', that.bjdKehuBindFun)
uni.$on('chanpinBindFun', that.chanpinBindFun)
uni.$on('bjdLxrBindFun', that.bjdLxrBindFun)
uni.$on('shangjiBindFun', that.shangjiBindFun) */
},
onBackPress() {
/* uni.$off('bjdKehuBindFun', that.bjdKehuBindFun)
uni.$off('chanpinBindFun', that.chanpinBindFun)
uni.$off('bjdLxrBindFun', that.bjdLxrBindFun)
uni.$off('shangjiBindFun', that.shangjiBindFun) */
},
methods: {
playSuccess() {
util.playSuccessAudio();
},
playError() {
util.playErrorAudio();
},
BarCodeDelChange: function() {
this.BarCodeDelStatus = !this.BarCodeDelStatus;
},
// 展示相应数据选择框
pickerSelectFun: function(str) {
that.selectList = [];
if (str == '仓库名称') {
that.selectList = this.StoreNameDataList;
}
else if (str == '司机名称') {
that.selectList = this.ShipCarUserDataList;
}else if (str == '车牌号码') {
that.selectList = this.ShipCarNoDataList;
}
that.selectShow = true;
that.selectType = str;
},
// 选择框选中事件
selectConfirmFun: function(e) {
if (that.selectType == '仓库名称') {
that.StoreNameID = e[0].value;
that.StoreName = e[0].label;
} else if (that.selectType == '司机名称') {
that.ShipCarUserID = e[0].value;
that.ShipCarUserName = e[0].label;
}else if (that.selectType == '车牌号码') {
that.ShipCarID = e[0].value;
that.ShipCarNo = e[0].label;
}
},
getStoreNameData() {
uni.request({
url: util.apiurl + 'rest/db/opensql',
data: {
token: getApp().globalData.Token,
format: 'json',
data: {
db_name: getApp().globalData.AppDBName,
sql_command_id: 'APP.GetStoreNameList',
params: [{
name: 'TypeNo',
value: '%StoreFabricGoods%'
}]
},
},
success: (res) => {
if (res.data.status == 0 && res.data.count > 0) {
console.log("--->>仓库名称<<<--" + JSON.stringify(res.data));
var aResultData = res.data.data;
for (var i = 0; i < aResultData.length; i++) {
this.StoreNameDataList.push({
value: aResultData[i].StoreNameID,
label: aResultData[i].StoreName
});
}
} else if (res.data.status == 0 && res.data.count <= 0) {
this.StoreNameDataList = [];
} else {
this.StoreNameDataList = [];
}
},
fail: (error) => {
uni.showToast({
icon: 'none',
title: '连接服务器出错,请检查后台服务是否启动!' + res.data.msg
});
setTimeout(function() {
uni.hideLoading();
}, 5000);
},
})
},
getPlanDepatmentData() {
console.log("--->>" + getApp().globalData.LoginID);
uni.request({
url: util.apiurl + 'rest/db/opensql',
data: {
token: getApp().globalData.Token,
format: 'json',
data: {
db_name: getApp().globalData.AppDBName,
sql_command_id: 'APP.GetPlanDepartmentOwnerList',
params: [{
name: 'LoginID',
value: getApp().globalData.LoginID
}, {
name: 'DefaultLoginID',
value: getApp().globalData.LoginID
}]
},
},
success: (res) => {
if (res.data.status == 0 && res.data.count > 0) {
var aResultData = res.data.data;
for (var i = 0; i < aResultData.length; i++) {
if ((aResultData[0].DefaultPlanDepartmentID != "") && (i == 0)) {
this.PlanDepartmentID = aResultData[0].DefaultPlanDepartmentID,
this.PlanDepartmentName = aResultData[0].DefaultPlanDepartmentName
}
this.PlanDepartmentDataList.push({
value: aResultData[i].PlanDepartmentID,
label: aResultData[i].PlanDepartmentName
})
}
} else if (res.data.status == 0 && res.data.count <= 0) {
this.PlanDepartmentDataList = [];
} else {
this.PlanDepartmentDataList = [];
}
},
fail: (error) => {
uni.showToast({
icon: 'none',
title: '连接服务器出错,请检查后台服务是否启动!' + res.data.msg
});
setTimeout(function() {
uni.hideLoading();
}, 5000);
},
})
},
getShipCarUserData() {
console.log("--->>" + getApp().globalData.LoginID);
uni.request({
url: util.apiurl + 'rest/db/opensql',
data: {
token: getApp().globalData.Token,
format: 'json',
data: {
db_name: getApp().globalData.AppDBName,
sql_command_id: 'APP.BaseData.GetEmployeeList',
params: [{
name: 'DNo',
value: '%ShipCarDriver%'
}]
},
},
success: (res) => {
if (res.data.status == 0 && res.data.count > 0) {
console.log("--->>司机名称<<<--" + JSON.stringify(res.data));
var aResultData = res.data.data;
for (var i = 0; i < aResultData.length; i++) {
this.ShipCarUserDataList.push({
value: aResultData[i].EmployeeID,
label: aResultData[i].EmployeeName
})
}
} else if (res.data.status == 0 && res.data.count <= 0) {
this.ShipCarUserDataList = [];
} else {
this.ShipCarUserDataList = [];
}
},
fail: (error) => {
uni.showToast({
icon: 'none',
title: '连接服务器出错,请检查后台服务是否启动!' + res.data.msg
});
setTimeout(function() {
uni.hideLoading();
}, 5000);
},
})
},
getBaseDataShipCarNo() {
uni.request({
url: util.apiurl + 'rest/db/opensql',
data: {
token: getApp().globalData.Token,
format: 'json',
data: {
db_name: getApp().globalData.AppDBName,
sql_command_id: 'APP.BaseData.GetBaseData',
params: [{
name: 'TypeNo',
value: 'BaseData.ShipCarNo'
}]
},
},
success: (res) => {
if (res.data.status == 0 && res.data.count > 0) {
console.log("--->>车牌号码<<<--" + JSON.stringify(res.data));
var aResultData = res.data.data;
for (var i = 0; i < aResultData.length; i++) {
this.ShipCarNoDataList.push({
value: aResultData[i].BaseDataID,
label: aResultData[i].BaseDataName
});
}
} else if (res.data.status == 0 && res.data.count <= 0) {
this.ShipCarNoDataList = [];
} else {
this.ShipCarNoDataList = [];
}
},
fail: (error) => {
uni.showToast({
icon: 'none',
title: '连接服务器出错,请检查后台服务是否启动!' + res.data.msg
});
setTimeout(function() {
uni.hideLoading();
}, 5000);
},
})
},
SaleShipmentOutDetail: function() {
uni.request({
url: util.apiurl + 'rest/db/opensql',
data: {
token: getApp().globalData.Token,
format: 'json',
data: {
db_name: getApp().globalData.AppDBName,
sql_command_id: 'APP.GetSaleShipmentOutDataDetailSQL',
params: [{
name: 'BillID',
value: this.SaleShipmentOutBillID
}]
},
},
success: (res) => {
this.triggered = false;
let data = res.data.data;
console.log("---->" + JSON.stringify(res.data));
if (res.data.status == 0 && res.data.count > 0) {
var aResultData = res.data.data;
this.GoodsDetailList = res.data.data;
this.ShipOutBillNum = aResultData[0].ShipOutBillNum;
this.ShipBillSumRoll = 0;
this.ShipBillSumQty = 0;
for (var i = 0; i < aResultData.length; i++) {
if (parseFloat(aResultData[i].Roll) > 0) {
this.ShipBillSumRoll = this.ShipBillSumRoll + aResultData[i].Roll;
}
if (parseFloat(aResultData[i].Qty) > 0) {
this.ShipBillSumQty = this.ShipBillSumQty + aResultData[i].Qty;
}
};
this.ShipBillSumRoll = this.ShipBillSumRoll.toFixed(2);
this.ShipBillSumQty = this.ShipBillSumQty.toFixed(2);
} else if (res.data.status == 0 && res.data.count <= 0) {
this.GoodsDetailList = [];
} else {
this.GoodsDetailList = [];
}
},
})
},
// 提交按钮方法
submitBtnFun: function() {
if (this.StoreName == '') {
this.playError();
this.BillDataMessage = '仓库名称不能为空,请先输入仓库名称!';
return;
}
if (this.SaleShipmentOutBillID > 0) {
this.playError();
this.BillDataMessage = '当前单据已经提交,不能重复提交!';
return;
}
uni.request({
url: util.apiurl + 'rest/db/storedproc',
data: {
token: getApp().globalData.Token,
format: 'json',
data: {
db_name: getApp().globalData.AppDBName,
proc_name: 'Usp_APP_SaleShipmentOutBillMaster',
method: 'open_proc',
params: [{
name: '@BillMasterID',
value: this.SaleShipmentOutBillID
},{
name: '@StoreNameID',
value: this.StoreNameID
},{
name: '@ShipCarNo',
value: this.ShipCarNo
},{
name: '@ShipCarUserID',
value: this.ShipCarUserID
},{
name: '@Remark',
value: this.Remark
},{
name: '@UserName',
value: getApp().globalData.UserName
}
]
},
},
success: (res) => {
if (res.data.status == 0) {
var aResultData = JSON.parse(res.data.data);
if (aResultData.BillDataStatus == '0' && aResultData.BillDataMessage == 'SUCCESS') {
this.playSuccess();
this.SaleShipmentOutBillID = aResultData.SaleShipmentOutBillID;
this.SaleShipmentOutBillNo = aResultData.SaleShipmentOutBillNo;
this.QRBarCodeFocus = false;
this.$nextTick(() => {
this.QRBarCodeFocus = true;
});
} else {
this.playError();
this.BillDataMessage = '提交出错!' + aResultData.BillDataMessage;
return;
}
} else {
this.playError();
this.BillDataMessage = '提交出错,' + res.data.msg
return;
}
},
fail: (error) => {
this.playError();
this.BillDataMessage = '连接服务器出错,请检查后台服务是否启动!' + res.data.msg;
},
})
},
SaleShipmentOutDetailScan() {
if (this.StoreNameID == 0 && this.SaleShipmentOutBillNo == '') {
this.playError();
this.BillDataMessage = '请先新增单据';
return;
}
let aBarCodeDelStatus = '0';
if (this.BarCodeDelStatus){
aBarCodeDelStatus = '1';
};
console.log("this.this.QRBarCode ---->>" + this.QRBarCode);
uni.request({
url: util.apiurl + 'rest/db/storedproc',
data: {
token: getApp().globalData.Token,
data: {
db_name: getApp().globalData.AppDBName,
proc_name: 'Usp_APP_SaleShipmentOutBillDetail',
method: 'open_proc',
params: [{
name: '@BillMasterID',
value: this.SaleShipmentOutBillID
}, {
name: '@QRBarCode',
value: this.QRBarCode
}, {
name: '@BarCodeDelStatus',
value: aBarCodeDelStatus
}, {
name: '@UserName',
value: getApp().globalData.UserName
}
]
},
},
success: (res) => {
if (res.data.status == 0) {
console.log(res.data.data.toString());
var aResultData = JSON.parse(res.data.data);
if (aResultData.BillDataStatus == '0' && aResultData.BillDataMessage == 'SUCCESS') {
this.playSuccess();
this.OutBillNo = aResultData.OutBillNo;
this.SaleBillNo = aResultData.SaleBillNo;
this.OutBillDate = aResultData.OutBillDate;
this.BillTypeName = aResultData.BillTypeName;
this.CustomerName = aResultData.CustomerName;
this.SaleUserName = aResultData.SaleUserName;
this.OutBillSumRoll = parseFloat(aResultData.OutBillSumRoll);
this.OutBillSumQty = parseFloat(aResultData.OutBillSumQty);
this.ShipBillSumRoll = parseFloat(aResultData.ShipBillSumRoll);
this.ShipBillSumQty = parseFloat(aResultData.ShipBillSumQty);
this.QRBarCode = '';
this.BillDataMessage = '扫描成功!';
this.SaleShipmentOutDetail();
this.QRBarCodeFocus = false;
this.$nextTick(() => {
this.QRBarCodeFocus = true;
});
} else {
this.playError();
this.BillDataMessage = '出仓出错,' + aResultData.BillDataMessage;
this.QRBarCode = '';
this.QRBarCodeFocus = false;
this.$nextTick(() => {
this.QRBarCodeFocus = true;
});
return;
}
} else {
this.playError();
this.QRBarCode = '';
this.BillDataMessage = '盘点扫描出错,' + res.data.msg;
this.QRBarCodeFocus = false;
this.$nextTick(() => {
this.QRBarCodeFocus = true;
});
return;
}
},
fail: (error) => {
this.playError();
this.QRBarCode = '';
this.QRBarCodeFocus = false;
this.$nextTick(() => {
this.QRBarCodeFocus = true;
});
this.BillDataMessage = '盘点扫描出错,' + res.data.msg;
uni.showToast({
icon: 'none',
title: '连接服务器出错,请检查后台服务是否启动!' + res.data.msg
});
setTimeout(function() {
uni.hideLoading();
}, 5000);
},
})
},
addCzjlFun: function(action, _id) {
let czjlObj = {
create_date: new Date().getTime(),
czRen: uni.$userInfo._id,
pageType: 'quotation',
}
let xgInfoObj = that.xgInfoObj;
czjlObj.dataId = xgInfoObj._id;
czjlObj.type = '编辑';
czjlObj.newUpdate = new Date().getTime();
czjlObj.oldUpdate = xgInfoObj.update_date;
let content = [];
let str = '';
if (that.bjName != xgInfoObj.bjName) {
str = '修改 报价单名称 ,由 "' + xgInfoObj.bjName + '" 变更为 "' + that.bjName + '"'
content.push(str)
}
if (that.sjName != xgInfoObj.sjName) {
str = '修改 商机 ,由 "' + xgInfoObj.sjName + '" 变更为 "' + that.sjName + '"'
content.push(str)
}
if (that.clientName != xgInfoObj.clientName) {
str = '修改 客户 ,由 "' + xgInfoObj.clientName + '" 变更为 "' + that.clientName + '"'
content.push(str)
}
if (that.bjName != xgInfoObj.bjName) {
str = '修改 报价单名称 ,由 "' + xgInfoObj.bjName + '" 变更为 "' + that.bjName + '"'
content.push(str)
}
if (that.clientLxrId != xgInfoObj.clientLxrId) {
str = '修改 联系人 ,由 "' + xgInfoObj.clientLxr + '" 变更为 "' + that.clientLxr + '"'
content.push(str)
}
if (that.bjPrice != xgInfoObj.bjPrice) {
str = '修改 报价金额 ,由 "' + xgInfoObj.bjPrice + '" 变更为 "' + that.bjPrice + '"'
content.push(str)
}
if (that.describe != xgInfoObj.describe) {
str = '修改 备注 ,由 "' + xgInfoObj.describe + '" 变更为 "' + that.describe + '"'
content.push(str)
}
if (that.bjdDate != xgInfoObj.bjdDate) {
str = '修改 报价日期 ,由 "' + xgInfoObj.bjdDate + '" 变更为 "' + that.bjdDate + '"'
content.push(str)
}
if (that.fuZeRen != xgInfoObj.fuZeRen) {
str = '修改 负责人 ,由 "' + xgInfoObj.fuZeRen + '" 变更为 "' + that.fuZeRen + '"'
content.push(str)
}
czjlObj.content = content;
uni.$czjlApiAddFun(czjlObj);
},
// 数据恢复
setDataFun: function() {
let obj = uni.$infoObj
that.xgInfoObj = uni.$infoObj
that.bjName = obj.bjName
that.sjName = obj.sjName
that.sjId = obj.sjId
that.clientName = obj.clientName
that.clientId = obj.clientId
that.clientLxr = obj.clientLxr
that.clientLxrId = obj.clientLxrId
that.bjPrice = obj.bjPrice
that.describe = obj.describe
that.bjdDate = obj.bjdDate
that.bjdDateTime = obj.bjdDateTime
// that.cpList = obj.cpList
// that.cpHzObj = obj.cpHzObj || {}
that.fuZeRenId = obj.fuZeRenId
that.fuZeRen = obj.fuZeRen
that.getCpByIdFun()
},
getCpByIdFun: function() {
let reqData = {
action: 'getCp',
params: {
bjdId: that.xgInfoObj._id
}
}
uni.showLoading({
title: '加载中...'
})
crmBaoJiaDanApi(reqData)
.then(res => {
let data = res.result.data;
if (data.length > 0) {
let cpHzObj = {
discount: 0,
price: 0,
sumPrice: 0,
totalNum: 0
};
for (var i = 0; i < data.length; i++) {
var obj = data[i];
obj.discount = (obj.sellingPrice / obj.price * 100).toFixed(2);
obj.totalPrice = (obj.sellingPrice * obj.num).toFixed(2);
data[i] = obj;
cpHzObj.price += parseFloat(obj.price) * obj.num;
cpHzObj.sumPrice += parseFloat(obj.sellingPrice) * obj.num;
cpHzObj.totalNum += obj.num;
}
cpHzObj.discount = cpHzObj.sumPrice / cpHzObj.price * 100;
that.cpHzObj = cpHzObj;
that.cpList = data;
}
})
},
// 根据商机id查询产品
getCpBysjIdFun: function(sjId) {
let reqData = {
action: 'getCp',
params: {
sjId: sjId
}
}
uni.showLoading({
title: '加载中...'
})
crmShangJiApi(reqData)
.then(res => {
let data = res.result.data;
if (data.length > 0) {
let cpHzObj = {
discount: 0,
price: 0,
sumPrice: 0,
totalNum: 0
};
for (var i = 0; i < data.length; i++) {
var obj = data[i];
obj._id = '';
obj.discount = (obj.sellingPrice / obj.price * 100).toFixed(2);
obj.totalPrice = (obj.sellingPrice * obj.num).toFixed(2);
data[i] = obj;
cpHzObj.price += parseFloat(obj.price) * obj.num;
cpHzObj.sumPrice += parseFloat(obj.sellingPrice) * obj.num;
cpHzObj.totalNum += obj.num;
}
cpHzObj.discount = cpHzObj.sumPrice / cpHzObj.price * 100;
that.cpHzObj = cpHzObj;
that.cpList = data;
}
})
},
}
}
</script>
<style>
page {
background-color: #F8F8F8;
padding-bottom: 260rpx;
}
.u-radio {
width: 200rpx !important;
}
.submitView {
width: 100%;
padding: 16rpx 0 26rpx;
background-color: #FFFFFF;
position: fixed;
bottom: 0;
left: 0;
border-top: 1rpx solid #f1f1f1;
display: flex;
align-items: center;
justify-content: center;
z-index: 100;
}
.submitBtn {
width: 666rpx;
}
.productBox {
background-color: #FFFFFF;
margin-top: 32rpx;
padding: 26rpx 0;
}
.tjcpName {
width: 686rpx;
height: 40rpx;
font-size: 16px;
font-weight: bold;
border-left: 6rpx solid #007AFF;
padding-left: 12rpx;
margin-left: 26rpx;
margin-top: 26rpx;
}
.cpInput {
width: 150rpx !important;
margin-right: 12rpx;
}
.cpInput>input {
box-sizing: border-box;
border: 1rpx solid #DDDDDD;
width: 100%;
height: 60rpx;
border-radius: 10rpx;
padding: 0 10rpx;
}
.cpInput1 {
width: 200rpx !important;
margin-right: 12rpx;
}
.cpInput1>input {
box-sizing: border-box;
border: 1rpx solid #DDDDDD;
width: 100%;
height: 60rpx;
border-radius: 10rpx;
padding: 0 10rpx;
}
.clearIcon {
position: absolute;
right: 6rpx;
top: 6rpx;
}
.greenPrice {
font-size: 16px;
color: #19BE6B !important;
font-weight: bold;
}
.disFlex {
display: flex;
align-items: center;
margin-bottom: 8rpx;
}
.inputName {
color: #ADADAD;
font-size: 16px;
}
.addHKQS {
display: flex;
align-items: center;
padding: 16rpx 26rpx;
font-size: 15px;
font-weight: bold;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
</style>
@@ -0,0 +1,421 @@
<template>
<view class="wrap">
<u-form ref="uForm">
<u-form-item>
<text class="title" style="width:200px;">付运单号:{{SaleShipmentOutBillNo}}</text>
<text class="title" style="width:200px;">付运日期:{{SaleShipmentOutDate}}</text>
</u-form-item>
<u-form-item>
<text class="title" style="width:200px;">仓库名称:{{StoreName}}</text>
<text class="title" style="width:200px;">出车时间:{{ShipOutTime}}</text>
</u-form-item>
<u-form-item>
<text class="title" style="width:200px;">司机名称:{{ShipCarUserName}}</text>
<text class="title" style="width:200px;">车牌号码:{{ShipCarNo}}</text>
</u-form-item>
<u-form-item label-width="150" label="条码资料:">
<input type="text" maxlength="-1" v-model="QRBarCode" :focus="QRBarCodeFocus"
style="width:200px;" @confirm="SaleShipmentOutDetailScan" />
<checkbox-group @change="BarCodeDelChange">
<checkbox ref="checkBoxRef" :checked="BarCodeDelStatus">删除</checkbox>
</checkbox-group>
</u-form-item>
<u-form-item>
<text class="title">{{BillDataMessage}}</text>
</u-form-item>
<u-form-item>
<text class="title" style="width:200px;">出仓单号:{{OutBillNo}}</text>
<text class="title" style="width:200px;">出仓日期:{{OutBillDate}}</text>
</u-form-item>
<u-form-item>
<text class="title" style="width:200px;">单据类型:{{BillTypeName}}</text>
<text class="title" style="width:200px;">配布单号:{{SaleBillNo}}</text>
</u-form-item>
<u-form-item>
<text class="title" style="width:200px;">往来单位:{{CustomerName}}</text>
<text class="title" style="width:200px;">销 售 员:{{SaleUserName}}</text>
</u-form-item>
<u-form-item>
<text class="title" style="width:200px;">付运单数:{{ShipOutBillNum}}单</text>
</u-form-item>
<u-form-item>
<text class="title" style="width:200px;">付运单据条数:{{ShipBillSumRoll}}条</text>
<text class="title" style="width:200px;">付运单据重量:{{ShipBillSumQty}}Kg</text>
</u-form-item>
<u-form-item>
<text class="title" style="width:200px;">出仓单据条数:{{OutBillSumRoll}}条</text>
<text class="title" style="width:200px;">出仓单据重量:{{OutBillSumQty}}Kg</text>
</u-form-item>
</u-form>
<view class="u-demo-area">
<u-toast ref="uToast"></u-toast>
<wyb-table ref="table" :headers="headersMaster" :contents="GoodsDetailList"/>
<!-- <wyb-table ref="table" :headers="headersDetail" :contents="GoodsCrockNoDataList" height="600rpx" /> !-->
</view>
<!-- <u-action-sheet :list="InDetailList" v-model="actionSheetShow" @click="actionSheetCallback"></u-action-sheet> -->
</view>
</template>
<script>
import util, {
parFabricGoodsBarCode2D,
parYarnGoodsBarCode2D,
playSuccessAudio,
playErrorAudio
} from '../../common/util';
import wybTable from '@/components/wyb-table/wyb-table.vue';
let that = '';
export default {
data() {
return {
BillMasterID: 0,
borderColor: '#e4e7ed',
align: 'center',
index: 0,
actionSheetShow: false,
commitType: '',
QRBarCodeFocus: true,
SaleShipmentOutBillID: 0,
SaleShipmentOutBillNo: '',
SaleShipmentOutDate: '',
ShipOutTime: '',
OutBillNo: '',
OutBillDate: '',
SaleBillNo: '',
BillTypeName: '',
CustomerName: '',
SaleUserName: '',
StoreNameID: 0,
StoreName: '',
ShipCarID: 0,
ShipCarNo: '',
ShipCarUserID: 0,
ShipCarUserName: '',
actionSheetShow: false,
BarCodeDelStatus: false,
Remark: '',
GoodsDetailList: [],
StoreNameDataList: [],
ShipCarUserDataList: [],
ShipCarNoDataList: [],
QRBarCode: '',
ShipOutBillNum: 0,
OutBillSumRoll: 0,
OutBillSumQty: 0,
ShipBillSumRoll: 0,
ShipBillSumQty: 0,
BillDataMessage: '',
headersMaster: [{
label: '出仓单号',
key: 'OutBillNo'
}, {
label: '配布单号',
key: 'SaleBillNo'
}, {
label: '出仓日期',
key: 'OutBillDate'
}, {
label: '往来单位',
key: 'CustomerName'
}, {
label: '销售员',
key: 'SaleUserName'
}, {
label: '单据类型',
key: 'BillTypeName'
}, {
label: '条数',
key: 'Roll'
}, {
label: '重量',
key: 'Qty'
}, {
label: '仓库名称',
key: 'StoreName'
}],
}
},
onLoad(e) {
that = this;
if (e.billid) {
that.SaleShipmentOutBillID = e.billid;
}
console.log("---BillID->" + this.SaleShipmentOutBillID);
this.SaleShipmentOutDetail();
},
methods: {
playSuccess() {
util.playSuccessAudio();
},
playError() {
util.playErrorAudio();
},
SaleShipmentOutDetail: function() {
console.log("----SaleShipmentOutBillID--->>>>" + this.SaleShipmentOutBillID)
uni.request({
url: util.apiurl + 'rest/db/opensql',
data: {
token: getApp().globalData.Token,
format: 'json',
data: {
db_name: getApp().globalData.AppDBName,
sql_command_id: 'APP.GetSaleShipmentOutDataDetailSQL',
params: [{
name: 'BillID',
value: this.SaleShipmentOutBillID
}]
},
},
success: (res) => {
this.triggered = false;
let data = res.data.data;
console.log("---->" + JSON.stringify(res.data));
if (res.data.status == 0 && res.data.count > 0) {
var aResultData = res.data.data;
this.GoodsDetailList = res.data.data;
this.SaleShipmentOutBillNo = aResultData[0].SaleShipmentOutBillNo;
this.SaleShipmentOutDate = aResultData[0].SaleShipmentOutDate;
this.StoreName = aResultData[0].MasterStoreName;
this.ShipOutTime = aResultData[0].ShipOutTime;
this.ShipCarNo = aResultData[0].ShipCarNo;
this.ShipCarUserName = aResultData[0].ShipCarUserName;
this.ShipOutBillNum = aResultData[0].ShipOutBillNum;
this.ShipBillSumRoll = 0;
this.ShipBillSumQty = 0;
for (var i = 0; i < aResultData.length; i++) {
if (parseFloat(aResultData[i].Roll) > 0) {
this.ShipBillSumRoll = this.ShipBillSumRoll + aResultData[i].Roll;
}
if (parseFloat(aResultData[i].Qty) > 0) {
this.ShipBillSumQty = this.ShipBillSumQty + aResultData[i].Qty;
}
};
this.ShipBillSumRoll = this.ShipBillSumRoll.toFixed(2);
this.ShipBillSumQty = this.ShipBillSumQty.toFixed(2);
} else if (res.data.status == 0 && res.data.count <= 0) {
this.GoodsDetailList = [];
} else {
this.GoodsDetailList = [];
}
},
})
},
SaleShipmentOutDetailScan() {
if (this.StoreNameID == 0 && this.SaleShipmentOutBillNo == '') {
this.playError();
this.BillDataMessage = '请先新增单据';
return;
}
let aBarCodeDelStatus = '0';
if (this.BarCodeDelStatus){
aBarCodeDelStatus = '1';
};
console.log("this.this.QRBarCode ---->>" + this.QRBarCode);
uni.request({
url: util.apiurl + 'rest/db/storedproc',
data: {
token: getApp().globalData.Token,
data: {
db_name: getApp().globalData.AppDBName,
proc_name: 'Usp_APP_SaleShipmentOutBillDetail',
method: 'open_proc',
params: [{
name: '@BillMasterID',
value: this.SaleShipmentOutBillID
}, {
name: '@QRBarCode',
value: this.QRBarCode
}, {
name: '@BarCodeDelStatus',
value: aBarCodeDelStatus
}, {
name: '@UserName',
value: getApp().globalData.UserName
}
]
},
},
success: (res) => {
if (res.data.status == 0) {
console.log(res.data.data.toString());
var aResultData = JSON.parse(res.data.data);
if (aResultData.BillDataStatus == '0' && aResultData.BillDataMessage == 'SUCCESS') {
this.playSuccess();
this.OutBillNo = aResultData.OutBillNo;
this.SaleBillNo = aResultData.SaleBillNo;
this.OutBillDate = aResultData.OutBillDate;
this.BillTypeName = aResultData.BillTypeName;
this.CustomerName = aResultData.CustomerName;
this.SaleUserName = aResultData.SaleUserName;
this.OutBillSumRoll = parseFloat(aResultData.OutBillSumRoll);
this.OutBillSumQty = parseFloat(aResultData.OutBillSumQty);
this.ShipBillSumRoll = parseFloat(aResultData.ShipBillSumRoll);
this.ShipBillSumQty = parseFloat(aResultData.ShipBillSumQty);
this.QRBarCode = '';
this.BillDataMessage = '扫描成功!';
this.SaleShipmentOutDetail();
this.QRBarCodeFocus = false;
this.$nextTick(() => {
this.QRBarCodeFocus = true;
});
} else {
this.playError();
this.BillDataMessage = '出仓出错,' + aResultData.BillDataMessage;
this.QRBarCode = '';
this.QRBarCodeFocus = false;
this.$nextTick(() => {
this.QRBarCodeFocus = true;
});
return;
}
} else {
this.playError();
this.QRBarCode = '';
this.BillDataMessage = '盘点扫描出错,' + res.data.msg;
this.QRBarCodeFocus = false;
this.$nextTick(() => {
this.QRBarCodeFocus = true;
});
return;
}
},
fail: (error) => {
this.playError();
this.QRBarCode = '';
this.QRBarCodeFocus = false;
this.$nextTick(() => {
this.QRBarCodeFocus = true;
});
this.BillDataMessage = '盘点扫描出错,' + res.data.msg;
uni.showToast({
icon: 'none',
title: '连接服务器出错,请检查后台服务是否启动!' + res.data.msg
});
setTimeout(function() {
uni.hideLoading();
}, 5000);
},
})
},
}
}
</script>
<style>
page {
background-color: #F8F8F8;
padding-bottom: 260rpx;
}
.u-radio {
width: 200rpx !important;
}
.submitView {
width: 100%;
padding: 16rpx 0 26rpx;
background-color: #FFFFFF;
position: fixed;
bottom: 0;
left: 0;
border-top: 1rpx solid #f1f1f1;
display: flex;
align-items: center;
justify-content: center;
z-index: 100;
}
.submitBtn {
width: 666rpx;
}
.productBox {
background-color: #FFFFFF;
margin-top: 32rpx;
padding: 26rpx 0;
}
.tjcpName {
width: 686rpx;
height: 40rpx;
font-size: 16px;
font-weight: bold;
border-left: 6rpx solid #007AFF;
padding-left: 12rpx;
margin-left: 26rpx;
margin-top: 26rpx;
}
.cpInput {
width: 150rpx !important;
margin-right: 12rpx;
}
.cpInput>input {
box-sizing: border-box;
border: 1rpx solid #DDDDDD;
width: 100%;
height: 60rpx;
border-radius: 10rpx;
padding: 0 10rpx;
}
.cpInput1 {
width: 200rpx !important;
margin-right: 12rpx;
}
.cpInput1>input {
box-sizing: border-box;
border: 1rpx solid #DDDDDD;
width: 100%;
height: 60rpx;
border-radius: 10rpx;
padding: 0 10rpx;
}
.clearIcon {
position: absolute;
right: 6rpx;
top: 6rpx;
}
.greenPrice {
font-size: 16px;
color: #19BE6B !important;
font-weight: bold;
}
.disFlex {
display: flex;
align-items: center;
margin-bottom: 8rpx;
}
.inputName {
color: #ADADAD;
font-size: 16px;
}
.addHKQS {
display: flex;
align-items: center;
padding: 16rpx 26rpx;
font-size: 15px;
font-weight: bold;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
</style>
@@ -0,0 +1,86 @@
<template>
<view class="myCard" @click="gotoDetailFun">
<view class="cardTopName">付运单号:{{item.BillNo}}</view>
<view class="cardRow">
<view>付运日期:</view>
<view>{{item.BillDate}}</view>
</view>
<view class="cardRow">
<view>营销部门:</view>
<view>{{item.PlanDepartmentName}}</view>
</view>
<view class="cardRow">
<view>送货司机:</view>
<view>{{item.ShipCarUserName}}</view>
</view>
<view class="cardRow">
<view>车牌号码:</view>
<view>{{item.ShipCarNo}}</view>
</view>
<view class="cardRow">
<view>付运单数:</view>
<text class="fzrRight">{{item.ShipOutBillNum}}单</text>
</view>
<view class="cardRow">
<view>付运数量:</view>
<text class="fzrRight">{{item.ShipOutRoll}}条 {{item.ShipOutQty}}KG</text>
</view>
<view class="cardRow">
<view>创 建 人:</view>
<view>{{item.OpName}} {{item.OpDate}}</view>
</view>
<view class="cardRow">
<view>审 核 人:</view>
<view>{{item.CommitName}} {{item.CommitDate}}</view>
</view>
<view v-if="!isDetail && !isSelect" class="lookDetail">
<text>查看详情</text>
<u-icon name="arrow-right" size="36"></u-icon>
</view>
</view>
</template>
<script>
export default {
props: {
item: {
type: Object,
default: () => {}
},
index: {
type: Number,
default: 0
},
isSelect: {
type: Boolean,
default: false
},
isDetail: {
type: Boolean,
default: false
}
},
data() {
return {
}
},
methods: {
gotoDetailFun: function() {
if(this.isSelect) {
return
}
//uni.$bjInfo = this.item;
console.log("----->>>>" + this.index);
uni.navigateTo({
url: '/pages/saleship/detail?index=' + this.index
})
}
}
}
</script>
<style>
</style>
+389
View File
@@ -0,0 +1,389 @@
<template>
<view>
<!--<topDropdown :isSxShow="true" :isPaiXu="true" :dropdown1="dropdown1" :options1="options1" :optionsSx="sxList"
:optionsPx="optionsPx" :isDuoXuan="true" searchLabel1="报价名称" searchPh1="请输入报价单名称"
@searchBoxEmitFun="searchBoxEmitFun" @dropDownFun1="dropDownFun1" @optionSxFun="optionSxFun"
@optionPxFun="optionPxFun" :isKhShow="true"></topDropdown>!-->
<u-sticky>
<div style="height: 43px; border-bottom: 1rpx solid #eeeeee; background-color: #FFFFFF;">
<u-tabs :list="tabList" name="title" active-color="red" :is-scroll="false"
:current="activeTabIndex" @change="onTabChange"></u-tabs>
</div>
</u-sticky>
<dataNull v-if="list.length == 0" src="/static/img/chahua/gjNull.png" title="暂无相关销售预约单" title1="请添加或者更换搜索添加">
</dataNull>
<scroll-view v-else scroll-y="true" :style="{height: scrollHeight}" @scrolltolower="selectDataFun"
refresher-enabled :refresher-threshold="200" :refresher-triggered="triggered" refresher-background="gray"
@refresherrefresh="onRefresh" @refresherrestore="onRestore">
<view v-for="(item, index) in list" :key="index" @click="cardClickFun(item, index)">
<baojiadan :item="item" :isSelect="isSelect" :index="index"></baojiadan>
</view>
<getMore :isMore="isMore"></getMore>
</scroll-view>
<addBtn url="./saleallocatedadd"></addBtn>
</view>
</template>
<script>
let that = '';
import {tyDropDown,dropDownByUser,bjdDatePxData,bjdSxDropDownData} from '../../static/utils/dropdown.js'
import {getDayFun,getDayByNumFun} from '@/static/utils/date.js'
import dataNull from '@/components/dataNull/dataNull.vue'
import addBtn from '@/components/addBtn/addBtn.vue'
import baojiadan from '@/components/card/baojiadan.vue'
import getMore from '@/components/getMore/getMore.vue'
import topDropdown from '../../components/topDropdown/topDropdown.vue'
import util, {playSuccessAudio,playErrorAudio} from '../../common/util';
import {TbOrderCouponService} from "@/dev/services/tb-order-coupon.service";
export default {
components: {
dataNull,
addBtn,
getMore,
baojiadan,
topDropdown
},
data() {
return {
tbOrderCouponList: [],
tabList: [
{title: '未审核', status: null},
{title: '待配货', status: '1'},
{title: '配货中', status: '2'},
{title: '待出货', status: '3'},
{title: '已出货', status: '4'},
{title: '已完成', status: '5'},
],
activeTabIndex: 0,
dropdown1: '全部',
options1: [],
optionsPx: bjdDatePxData,
sxList: [],
list: [],
pageIndex: 1,
isMore: true,
scrollHeight: '667px',
triggered: false,
isSelect: false,
pageType: '',
sortObj: {
update_date: -1
},
optionsReq: {}, // 第一个下拉框请求参数
dateReq: [], // 日期相关请求参数
sxReq: JSON.stringify({}), // 筛选想请求参数
matchObj: {},
searchValue: '',
clientIdArr: [],
tabNoEqualArr: [], //标签页不等于数据
depId: undefined
}
},
onLoad(e) {
that = this;
//this.doRefresh(this.tbOrderCouponList);
let sxList = JSON.stringify(bjdSxDropDownData);
that.sxList = JSON.parse(sxList);
let obj = {};
/*
if(getApp().globalData.IsSaleUserStatus == 0) {
that.options1 = tyDropDown;
//that.depId = uni.$userInfo.depManager_Id;
} else {
that.options1 = dropDownByUser;
//obj.fuZeRenId = uni.$userInfo._id;
}*/
if (e.clientId) {
that.clientIdArr = [e.clientId]
}
that.matchObj = obj;
that.optionsReq = JSON.stringify(obj);
that.pageType = e.type ? e.type : '';
if (e.type) {
that.isSelect = true;
}
uni.getSystemInfo({
success(res) {
that.scrollHeight = res.windowHeight - 40 + 'px';
}
})
if (e.next_gjDate) {
let dateArr = getDayByNumFun(e.next_gjDate);
let dateObj = {
field: 'next_gjDate',
sTime: dateArr[1],
eTime: dateArr[0]
};
let arr = that.sxList;
arr[0].current = 0;
that.sxList = arr;
that.dateReq.push(dateObj)
} else {
let arr = that.sxList;
arr[0].current = '';
that.sxList = arr;
}
that.selectDataFun();
uni.$on('deleteCardFun', that.deleteCardFun);
uni.$on('updateBjdListByIndex', that.updateBjdListByIndex)
uni.$on('addBjdItemInListFun', that.addBjdItemInListFun)
},
watch: {
activeTabIndex: {
deep: true, // 深度监听
handler(newVal, oldVal) {
//console.log("activeTabIndex参数改变,即将刷新...", `新值:${newVal}`, `旧值:${oldVal}`);
that.selectDataFun(newVal);
//this.doRefresh(this.tbOrderCouponList)
}
}
},
// 上拉加载
onReachBottom: function () {
/*
if (this.pagination.hasNextPage) {
this.doInfinite()
}
*/
},
onBackPress() {
uni.$off('deleteCardFun', that.deleteCardFun);
uni.$off('updateBjdListByIndex', that.updateBjdListByIndex)
uni.$off('addBjdItemInListFun', that.addBjdItemInListFun);
},
methods: {
onTabChange(index) {
const _self = this;
this.activeTabIndex = index;
//this.urlParams.activeTabIndex = this.activeTabIndex;
},
/**
* 加载更多数据中
* @param infiniteScroll
*/
doInfinite(infiniteScroll) {
const _self = this;
new TbOrderCouponService().findTableTbOrderCouponList({
pagination: _self.pagination,
data: {
communityId: _self.globalVariable.userInfo.tbCommunity.id,
userId: _self.globalVariable.userInfo.id,
status: _self.tabList[_self.activeTabIndex].status,
orderBy: 'create_time desc',
},
}).then(result => {
_self.pagination.refreshPage(result);
_self.tbOrderCouponList = [..._self.tbOrderCouponList, ...result.list];
});
},
// 查询报价单
selectDataFun: function() {
/*
if (!that.isMore) {
return
}
uni.showLoading({
title: '加载中...',
mask: true
})*/
let aStatusName = "";
console.log("---->" +this.activeTabIndex + "<<<----" );
if (this.activeTabIndex == 0) {
aStatusName = "未审核"
}
else if (this.activeTabIndex == 1) {
aStatusName = "待配货"
}
else if (this.activeTabIndex == 2) {
aStatusName = "配货中"
}
else if (this.activeTabIndex == 3) {
aStatusName = "待出货"
}
else if (this.activeTabIndex == 4) {
aStatusName = "已出货"
}
else if (this.activeTabIndex == 5) {
aStatusName = "已完成"
};
uni.request({
url: util.apiurl + 'rest/db/opensql',
data: {
token: getApp().globalData.Token,
format: 'json',
data: {
db_name: getApp().globalData.AppDBName,
sql_command_id: 'APP.SaleShip.GetSaleAllocatedMaster',
params: [{
name: 'StatusName',
value: '%'+aStatusName+'%'
}, {
name: 'SUID',
value: getApp().globalData.EmployeeID
}, {
name: 'MUID',
value: getApp().globalData.EmployeeID
}]
},
},
success: (res) => {
this.triggered = false;
let data = res.data.data;
if (that.pageIndex == 1) {
that.list = [];
}
if (res.data == 20) {
that.pageIndex += 1;
that.isMore = true;
} else {
that.isMore = false;
}
that.list = that.list.concat(data);
},
})
},
// 卡片点击方法
cardClickFun: function(item, index) {
if (that.pageType == 'genjin') {
uni.$emit('gjOrderBindFun', item)
uni.navigateBack()
} else if (that.pageType != '') {
uni.$emit('baoJiaDanBindFun', item)
uni.navigateBack()
}
},
// 下拉框回调函数
dropDownFun1: function(e) {
let optionsReq = {};
let tabNoEqualArr = [];
let userInfo = uni.$userInfo;
that.depId = undefined;
if (e.label == '全部') {
that.depId = userInfo.depManager_Id;
} else if (e.label == '我负责的') {
optionsReq.fuZeRenId = userInfo._id;
} else if (e.label == '我创建的') {
optionsReq.cjRenId = userInfo._id;
} else if (e.label == '下属负责') {
that.depId = userInfo.depManager_Id;
tabNoEqualArr = [{
field: 'fuZeRenId',
value: userInfo._id
}]
optionsReq.department = userInfo.departmentId;
} else if (e.label == '下属创建') {
that.depId = userInfo.depManager_Id;
tabNoEqualArr = [{
field: 'cjRenId',
value: userInfo._id
}]
}
that.tabNoEqualArr = tabNoEqualArr;
that.optionsReq = JSON.stringify(optionsReq);
that.matchObj = Object.assign(optionsReq, JSON.parse(that.sxReq));
that.cxGetDataFun();
},
// 筛选框回调函数
optionSxFun: function(e) {
let arr = e.arr;
that.clientIdArr = e.selectKhList;
console.log(that.clientIdArr)
let matchReq = [];
let dateReq = [];
for (var i = 0; i < arr.length; i++) {
if (arr[i].current !== '' && !arr[i].isDate) {
matchReq.push({
field: arr[i].field,
value: arr[i].arr[arr[i].current]
})
} else if (arr[i].current !== '' && arr[i].isDate) {
dateReq.push({
field: arr[i].field,
sTime: arr[i].sTime,
eTime: arr[i].eTime
})
}
}
let reqObj = {};
// 动态生成请求对象
for (var i = 0; i < matchReq.length; i++) {
reqObj[matchReq[i].field] = matchReq[i].value
}
that.dateReq = dateReq;
that.sxReq = JSON.stringify(reqObj);
// 合并对象
that.matchObj = Object.assign(reqObj, JSON.parse(that.optionsReq));
that.cxGetDataFun();
},
// 排序筛选框回调函数
optionPxFun: function(arr) {
let sortObj = {
update_date: -1
}
for (var i = 0; i < arr.length; i++) {
if (arr[i].current !== '') {
sortObj = {}
if (arr[i].field == 'create_date') {
sortObj.create_date = arr[i].current == 1 ? 1 : -1
}
if (arr[i].field == 'update_date') {
sortObj.update_date = arr[i].current == 1 ? 1 : -1
}
if (arr[i].field == 'chengJiao_date') {
sortObj.chengJiao_date = arr[i].current == 1 ? 1 : -1
}
if (arr[i].field == 'bjPrice') {
sortObj.bjPrice = arr[i].current == 1 ? 1 : -1
}
that.sortObj = sortObj;
break;
}
}
that.cxGetDataFun();
},
// 搜索框回调方法
searchBoxEmitFun: function(e) {
that.searchValue = e.searchValue1;
that.cxGetDataFun()
},
// 下拉刷新
onRefresh: function() {
if (that.triggered) return
that.triggered = true;
that.cxGetDataFun();
},
onRestore: function(e) {
that.triggered = false; // 需要重置
},
// 重新获取数据
cxGetDataFun: function() {
that.pageIndex = 1;
that.isMore = true;
that.selectDataFun();
},
deleteCardFun: function(e) {
let arr = that.list;
arr.splice(e.index, 1);
that.list = arr;
},
// add页面新增数据
addBjdItemInListFun: function(e) {
that.cxGetDataFun()
},
// 通过下标更新list数据
updateBjdListByIndex: function(e) {
that.$set(that.list, parseInt(e.index), e.obj)
},
}
}
</script>
<style>
page {
background-color: #F8F8F8;
}
</style>
+792
View File
@@ -0,0 +1,792 @@
<template>
<view>
<view class="flex-white-plr26 ptb10 mt32 bdb_f5">
<text class="mr26">预约单号</text>
<u-input disabled placeholder="自动生成" v-model="AllocatedBillNo" />
<text class="mr26">预约日期</text> {{$u.timeFormat(AllocatedDate, 'yyyy-mm-dd')}}
</view>
<view class="flex-white-plr26 ptb20 bdb_f5" @click="selectCustomer">
<text class="mr26">客户名称<text class="redXingh">*</text></text>
<view :class="CustomerName ? '' : 'cBlack'">
{{CustomerName ? CustomerName : '请选择'}}
<u-icon class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
</view>
</view>
<view class="flex-white-plr26 ptb20 bdb_f5" @click="selectShangJiFun">
<text class="mr26">营销部门<text class="redXingh">*</text></text>
<view :class="PlanDepartmentName ? '' : 'cBlack'">
{{PlanDepartmentName ? PlanDepartmentName : '请选择'}}
<u-icon class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
</view>
</view>
<view class="flex-white-plr26 ptb20 bdb_f5" @click="selectShangJiFun">
<text class="mr26">销 售 员<text class="redXingh">*</text></text>
<view :class="SaleUserName ? '' : 'cBlack'">
{{SaleUserName ? SaleUserName : '请选择'}}
<u-icon class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
</view>
</view>
<view @click="pickerSelectFun('结算方式')" class="flex-white-plr26 ptb20 bdb_f5">
<text class="mr26">结算方式<text class="redXingh">*</text></text>
<view :class="PaymentTypeName ? '' : 'cBlack'">
{{PaymentTypeName ? PaymentTypeName : '请选择'}}
<u-icon class="ml26" name="arrow-right" size="40" color="#888888"></u-icon>
</view>
</view>
<view class="flex-white-plr26 ptb10 bdb_f5">
<text class="mr26">物流公司<text class="redXingh">*</text></text>
<u-input v-model="ShipCompanyName" />
</view>
<view class="flex-white-plr26 ptb10 bdb_f5">
<text class="mr26">收货地址<text class="redXingh">*</text></text>
<u-input v-model="SaleCustomerAddress" />
</view>
<view class="flex-white-plr26-column ptb20 mt32">
<view style="margin-bottom: 8rpx;">
<text>内部备注</text>
</view>
<u-input v-model="Remark" type="textarea" :border="true" :height="100" :auto-height="true" />
</view>
<view class="flex-white-plr26-column ptb20 mt32">
<view style="margin-bottom: 8rpx;">
<text>出货备注</text>
</view>
<u-input v-model="SaleOutRemark" type="textarea" :border="true" :height="100" :auto-height="true" />
</view>
<!--添加产品-->
<view class="tjcpName">
<text>添加产品</text>
</view>
<view class="productBox">
<view class="myCard" v-if="cpList.length > 0">
<view class="cardRow">
<view>总数量:</view>
<view>{{cpHzObj.totalNum}}</view>
</view>
<view class="cardRow">
<view>价格合计:</view>
<view>{{cpHzObj.price}}元</view>
</view>
<view class="cardRow">
<view>总折扣%:</view>
<view class="cpInput1">
<u-input v-model="cpHzObj.discount" type="number" height="50" :border="true" :clearable="false" placeholder="请输入" @input="cpzzkXgFun"/>
</view>
</view>
<view class="cardRow">
<view>最终价格:</view>
<view class="cpInput1">
<u-input v-model="cpHzObj.sumPrice" type="number" height="50" :border="true" :clearable="false" placeholder="请输入" @input="cpzzPriceXgFun"/>
</view>
</view>
</view>
<view class="myCard" v-for="(item, index) in cpList" :key="index">
<u-icon name="close-circle-fill" size="50" class="clearIcon" color="#ff0000" @click="deleteCpFun(index)"></u-icon>
<view class="cardTopName">产品名称:{{item.pName}}</view>
<view class="cardRow">
<view>产品价格:</view>
<view>{{item.price}}元/{{item.unit}}</view>
</view>
<view class="disFlex">
<view class="inputName">售价 (元):</view>
<view class="cpInput">
<u-input v-model="item.sellingPrice" type="number" height="50" :border="true" :clearable="false" placeholder="请输入" @input="cpPriceUpdateFun(index, item)"/>
</view>
<view class="inputName">折扣 (%):</view>
<view class="cpInput">
<u-input v-model="item.discount" type="number" height="50" :border="true" :clearable="false" placeholder="请输入" @input="cpDiscountUpdateFun(index, item)"/>
</view>
</view>
<view class="cardRow">
<view>产品数量:</view>
<view>
<u-number-box v-model="item.num" :index="index" @change="cpCalcFun" :input-width="128" :input-height="60" :min="1" :max="100000"></u-number-box>
</view>
</view>
<view class="cardRow">
<view>价格合计:</view>
<view class="greenPrice">¥{{item.totalPrice}}</view>
</view>
</view>
<view class="addHKQS" @click="addChanPinFun">
<text>点击添加相关产品</text>
<u-icon name="plus-circle-fill" color="#007aff" size="56"
style="margin-left: 16rpx;">
</u-icon>
</view>
</view>
<!--提交按钮-->
<view class="submitView">
<u-button type="primary" class="submitBtn" :ripple="true" ripple-bg-color="#909399" @click="submitBtnFun">{{pageType ? '保存' : '提交'}}</u-button>
</view>
<!--组件-->
<u-select v-model="selectShow" :list="selectList" @confirm="selectConfirmFun"></u-select>
</view>
</template>
<script>
let that = '';
import { getNowDate, getDayFun } from '../../static/utils/date.js'
import { crmBaoJiaDanApi, crmShangJiApi } from '../../static/utils/api.js'
export default {
data() {
return {
selectShow: false,
selectList: [],
selectType: '',
PaymentTypeNameList: [{text: '现款'},{text: '帐期'}],
AllocatedBillNo: '',
AllocatedDate:'',
CustomerID: '',
CustomerName: '',
PlanDepartmentID: '',
PlanDepartmentName: '',
SaleUserID: '',
SaleUserName: '',
PaymentTypeName: '',
ShipCompanyName: '',
SaleCustomerAddress: '',
Remark: '',
SaleOutRemark: '',
sjLaiYuan: '',
describe: '',
bjdDate: '',
bjdDateTime: '',
cpList: [],
cpHzObj: {
totalNum: 0,
price: 0,
discount: 0,
sumPrice: 0
},
isTjcp: false,
isGlsj: false,
fuZeRenId: getApp().globalData.EmployeeID,
fuZeRen: getApp().globalData.UserName,
pageType: '',
xgInfoObj: {}
}
},
watch: {
cpList: function(val, old) {
that.cpCalcFun();
}
},
onLoad(e) {
that = this;
if(e.type == 'update') {
that.setDataFun();
that.pageType = 'update';
that.navbarTitle = '修改报价单信息';
}
if(e.clientName) {
that.clientName = e.clientName;
}
if(e.clientId) {
that.clientId = e.clientId;
}
uni.$on('bjdKehuBindFun', that.bjdKehuBindFun)
uni.$on('chanpinBindFun', that.chanpinBindFun)
uni.$on('bjdLxrBindFun', that.bjdLxrBindFun)
uni.$on('shangjiBindFun', that.shangjiBindFun)
},
onBackPress() {
uni.$off('bjdKehuBindFun', that.bjdKehuBindFun)
uni.$off('chanpinBindFun', that.chanpinBindFun)
uni.$off('bjdLxrBindFun', that.bjdLxrBindFun)
uni.$off('shangjiBindFun', that.shangjiBindFun)
},
methods: {
// 日期修改
bindDateChange: function(e) {
that.bjdDate = e.detail.value;
that.bjdDateTime = new Date(e.detail.value + ' 00:00:00').getTime()
},
// 展示相应数据选择框
pickerSelectFun: function(str) {
if(str == '结算方式') {
that.selectList = [
{ value: 0, label: '现款'},
{ value: 1, label: '账期'}
]
}
that.selectShow = true;
that.selectType = str;
},
// 选择框选中事件
selectConfirmFun: function(e) {
if(that.selectType == '结算方式') {
that.PaymentTypeName = e[0].label;
}
},
scanFun: function () {
uni.scanCode({
success(res) {
that.code = res.result;
}
})
},
// 选择所属客户
selectCustomer: function() {
uni.navigateTo({
url: '../basedata/customer/customer?type=saleallocated'
})
},
// 绑定客户
bjdKehuBindFun: function(e) {
that.CustomerID = e.CustomerID;
that.CustomerName = e.CustomerName;
that.PlanDepartmentID = e.PlanDepartmentID;
that.PlanDepartmentName = e.PlanDepartmentName;
that.SaleUserID = e.SaleUserID;
that.SaleUserName = e.SaleUserName;
that.SaleCustomerAddress = e.CustomerAddress+' '+e.CustomerPhone+' '+e.CustomerLinkName;
/*
that.clientId = e.clientId;
that.clientName = e.clientName;
*/
},
// 选择客户联系人
selectLxrFun: function() {
if(!that.clientId) {
uni.$myModalFun('请先关联客户!')
return
}
uni.navigateTo({
url: '../lianxiren/lianxiren?type=bjd&clientId=' + that.clientId
})
},
// 绑定联系人
bjdLxrBindFun: function(e) {
that.clientLxrId = e.lxrId;
that.clientLxr = e.lxrName;
},
// 选择商机
selectShangJiFun: function() {
if(!that.clientId) {
uni.$myModalFun('请先关联客户!')
return
}
that.isGlsj = true;
uni.navigateTo({
url: '../shangji/shangji?type=bjd&clientId=' + that.clientId
})
},
// 绑定商机
shangjiBindFun: function(e) {
that.sjId = e._id;
that.sjName = e.sjName;
that.clientId = e.clientId;
that.clientName = e.clientName;
that.clientLxrId = e.clientLxrId;
that.clientLxr = e.clientLxr;
if(that.isGlsj) {
setTimeout(()=> {
if(e.cpNum) {
uni.showModal({
title: '提示',
content: '该商机下有' + e.cpNum + '种产品信息,是否关联或替换至该报价单中?',
success(res) {
if(res.confirm) {
that.getCpBysjIdFun(e._id)
}
}
})
}
}, 8)
that.isGlsj = false;
}
},
// 添加相关产品
addChanPinFun: function() {
if (that.CustomerName == "")
{
uni.showToast({
title: '客户名称不能为空,请先选择!',
duration: 2000
});
return
}
console.log("--->>" + that.CustomerID +'<<<<');
uni.navigateTo({
url: '../../chanpin/view/shop?customerid=' + that.CustomerID
//url: '../../chanpin/view/shop?type=baojiadan'
})
that.isTjcp = true;
},
// 绑定产品
chanpinBindFun: function(e) {
let obj = {
pName: e.pName,
price: e.price,
unit: e.unit,
cpId: e._id,
sellingPrice: e.price,
discount: 100,
num: 1,
totalPrice: e.price
}
if(that.isTjcp) {
let arr = that.cpList;
let isSave = false;
for (var i = 0; i < arr.length; i++) {
if(arr[i].cpId == obj.cpId) {
isSave = true;
}
}
if(!isSave) {
arr = arr.concat(obj);
that.cpList = arr;
setTimeout(() => {
uni.pageScrollTo({
duration: 100,
scrollTop: 100000
})
}, 88)
} else {
setTimeout(()=> {
uni.showToast({
title: '该产品已存在!',
icon: 'none',
duration: 2000
})
}, 88)
}
that.isTjcp = false;
}
},
// 删除产品
deleteCpFun: function(iii) {
let item = that.cpList[iii];
if(item._id) {
uni.showModal({
title: '提示',
content: '是否确认要删除该产品?',
success(res) {
if(res.confirm) {
uni.showLoading({
title: '加载中...'
})
let reqData = {
action: 'deleteCp',
params: {
_id: item._id
}
}
crmBaoJiaDanApi(reqData)
.then(res => {
that.cpList.splice(iii, 1)
})
}
}
})
} else {
that.cpList.splice(iii, 1)
}
},
// 售价修改
cpPriceUpdateFun: function(iii, item) {
let arr = that.cpList;
let sellingPrice = item.sellingPrice;
item.discount = ((item.sellingPrice / item.price) * 100).toFixed(2);
that.$set(that.cpList, iii, item);
that.cpCalcFun();
},
// 折扣修改
cpDiscountUpdateFun: function (iii, item) {
let arr = that.cpList;
let discount = item.discount;
item.sellingPrice = (item.price * discount / 100).toFixed(2);
that.$set(that.cpList, iii, item);
that.cpCalcFun();
},
// 产品总折扣修改
cpzzkXgFun: function () {
that.cpHzObj.sumPrice = (that.cpHzObj.discount * that.cpHzObj.price / 100).toFixed(2);
that.bjPrice = that.cpHzObj.sumPrice;
},
// 产品最终价格修改
cpzzPriceXgFun: function() {
that.cpHzObj.discount = (that.cpHzObj.sumPrice / that.cpHzObj.price * 100).toFixed(2);
that.bjPrice = that.cpHzObj.sumPrice;
},
// 订单价格修改
orderPriceXgFun: function() {
if(that.cpList.length > 0) {
that.cpHzObj.sumPrice = that.bjPrice;
that.cpHzObj.discount = (that.bjPrice / that.cpHzObj.price * 100).toFixed(2);
}
},
// 计算金额
cpCalcFun: function() {
let arr = that.cpList;
let bjPrice = 0;
let zprice = 0;
let totalNum = 0;
for(var i = 0; i < arr.length; i++) {
arr[i].totalPrice = (parseFloat(arr[i].sellingPrice) * arr[i].num).toFixed(2);
bjPrice += parseFloat(arr[i].totalPrice);
zprice += parseFloat(arr[i].price) * arr[i].num;
totalNum += arr[i].num;
}
that.cpHzObj.price = zprice.toFixed(2);
that.cpHzObj.discount = (bjPrice / that.cpHzObj.price * 100).toFixed(2);
if(that.cpHzObj.discount == 'NaN') {
that.cpHzObj.discount = 0;
}
that.cpHzObj.sumPrice = bjPrice.toFixed(2);
that.cpHzObj.totalNum = totalNum;
that.cpList = arr;
if(bjPrice == 0) {
that.bjPrice = '';
} else {
that.bjPrice = bjPrice.toFixed(2);
}
},
// 提交按钮方法
submitBtnFun: function() {
if(!that.bjName) {
uni.$myModalFun('报价名称不能为空,请输入!');
return
}
if(!that.clientName) {
uni.$myModalFun('报价单所属客户不能为空,请选择!');
return
}
if(!that.bjPrice) {
uni.$myModalFun('报价金额不能为空,请输入或者添加产品自动计算!');
return
}
let req = {
bjName: that.bjName,
sjName: that.sjName,
sjId: that.sjId,
cpNum: that.cpList.length,
// clientName: that.clientName,
clientId: that.clientId,
clientLxr: that.clientLxr,
clientLxrId: that.clientLxrId,
bjPrice: that.bjPrice,
describe: that.describe,
bjdDate: that.bjdDate,
bjdDateTime: that.bjdDateTime,
// cpList: that.cpList,
fuZeRenId: that.fuZeRenId,
fuZeRen: that.fuZeRen,
}
let dateArr = getDayFun();
let nowDate = getNowDate().nowDate;
let fgArr = nowDate.split(" ");
let dateStr = (fgArr[0]).replace(/-/g, "");
// if(that.cpList.length > 0) {
// req.cpHzObj = that.cpHzObj;
// }
let reqObj = {
cpList: that.cpList,
req
}
let action = 'addBaoJiaDan';
if (that.pageType == 'update') {
action = 'update'
reqObj._id = that.xgInfoObj._id;
reqObj.req.update_date = new Date().getTime();
uni.showLoading({
title: '修改中...'
})
} else {
reqObj.req.create_date = new Date().getTime();
reqObj.req.update_date = new Date().getTime();
reqObj.req.cjRen = uni.$userInfo.xingMing;
reqObj.req.cjRenId = uni.$userInfo._id;
reqObj.startDate = dateArr[0];
reqObj.endDate = dateArr[1];
reqObj.dateStr = parseInt(dateStr);
uni.showLoading({
title: '提交中...'
})
}
let reqData = {
action: action,
params: reqObj
}
crmBaoJiaDanApi(reqData)
.then(res => {
if (action == 'update') {
that.addCzjlFun();
uni.showToast({
title: '报价单修改成功',
icon: 'none',
duration: 1000,
mask: true
})
setTimeout(()=> {
uni.navigateBack()
}, 1000)
} else {
uni.showToast({
title: '报价单新增成功',
icon: 'none',
duration: 1000,
mask: true
})
reqObj.req._id = res.result.id;
reqObj.req.clientName = that.clientName;
uni.$emit('addBjdItemInListFun')
setTimeout(()=> {
uni.redirectTo({
url: './detail?index=0&fromDetail=true&alloAllocatedMasterID=' + res.result.id
})
}, 1000)
}
})
},
addCzjlFun: function(action, _id) {
let czjlObj = {
create_date: new Date().getTime(),
czRen: uni.$userInfo._id,
pageType: 'quotation',
}
let xgInfoObj = that.xgInfoObj;
czjlObj.dataId = xgInfoObj._id;
czjlObj.type = '编辑';
czjlObj.newUpdate = new Date().getTime();
czjlObj.oldUpdate = xgInfoObj.update_date;
let content = [];
let str = '';
if(that.bjName != xgInfoObj.bjName) {
str = '修改 报价单名称 ,由 "' + xgInfoObj.bjName + '" 变更为 "' + that.bjName + '"'
content.push(str)
}
if(that.sjName != xgInfoObj.sjName) {
str = '修改 商机 ,由 "' + xgInfoObj.sjName + '" 变更为 "' + that.sjName + '"'
content.push(str)
}
if(that.clientName != xgInfoObj.clientName) {
str = '修改 客户 ,由 "' + xgInfoObj.clientName + '" 变更为 "' + that.clientName + '"'
content.push(str)
}
if(that.bjName != xgInfoObj.bjName) {
str = '修改 报价单名称 ,由 "' + xgInfoObj.bjName + '" 变更为 "' + that.bjName + '"'
content.push(str)
}
if(that.clientLxrId != xgInfoObj.clientLxrId) {
str = '修改 联系人 ,由 "' + xgInfoObj.clientLxr + '" 变更为 "' + that.clientLxr + '"'
content.push(str)
}
if(that.bjPrice != xgInfoObj.bjPrice) {
str = '修改 报价金额 ,由 "' + xgInfoObj.bjPrice + '" 变更为 "' + that.bjPrice + '"'
content.push(str)
}
if(that.describe != xgInfoObj.describe) {
str = '修改 备注 ,由 "' + xgInfoObj.describe + '" 变更为 "' + that.describe + '"'
content.push(str)
}
if(that.bjdDate != xgInfoObj.bjdDate) {
str = '修改 报价日期 ,由 "' + xgInfoObj.bjdDate + '" 变更为 "' + that.bjdDate + '"'
content.push(str)
}
if(that.fuZeRen != xgInfoObj.fuZeRen) {
str = '修改 负责人 ,由 "' + xgInfoObj.fuZeRen + '" 变更为 "' + that.fuZeRen + '"'
content.push(str)
}
czjlObj.content = content;
uni.$czjlApiAddFun(czjlObj);
},
// 数据恢复
setDataFun: function() {
let obj = uni.$infoObj
that.xgInfoObj = uni.$infoObj
that.bjName = obj.bjName
that.sjName = obj.sjName
that.sjId = obj.sjId
that.clientName = obj.clientName
that.clientId = obj.clientId
that.clientLxr = obj.clientLxr
that.clientLxrId = obj.clientLxrId
that.bjPrice = obj.bjPrice
that.describe = obj.describe
that.bjdDate = obj.bjdDate
that.bjdDateTime = obj.bjdDateTime
// that.cpList = obj.cpList
// that.cpHzObj = obj.cpHzObj || {}
that.fuZeRenId = obj.fuZeRenId
that.fuZeRen = obj.fuZeRen
that.getCpByIdFun()
},
getCpByIdFun: function() {
let reqData = {
action: 'getCp',
params: {
bjdId: that.xgInfoObj._id
}
}
uni.showLoading({
title: '加载中...'
})
crmBaoJiaDanApi(reqData)
.then(res => {
let data = res.result.data;
if(data.length > 0) {
let cpHzObj = {
discount: 0,
price: 0,
sumPrice: 0,
totalNum: 0
};
for(var i = 0; i < data.length; i++) {
var obj = data[i];
obj.discount = (obj.sellingPrice / obj.price * 100).toFixed(2);
obj.totalPrice = (obj.sellingPrice * obj.num).toFixed(2);
data[i] = obj;
cpHzObj.price += parseFloat(obj.price) * obj.num;
cpHzObj.sumPrice += parseFloat(obj.sellingPrice) * obj.num;
cpHzObj.totalNum += obj.num;
}
cpHzObj.discount = cpHzObj.sumPrice / cpHzObj.price * 100;
that.cpHzObj = cpHzObj;
that.cpList = data;
}
})
},
// 根据商机id查询产品
getCpBysjIdFun: function(sjId) {
let reqData = {
action: 'getCp',
params: {
sjId: sjId
}
}
uni.showLoading({
title: '加载中...'
})
crmShangJiApi(reqData)
.then(res => {
let data = res.result.data;
if(data.length > 0) {
let cpHzObj = {
discount: 0,
price: 0,
sumPrice: 0,
totalNum: 0
};
for(var i = 0; i < data.length; i++) {
var obj = data[i];
obj._id = '';
obj.discount = (obj.sellingPrice / obj.price * 100).toFixed(2);
obj.totalPrice = (obj.sellingPrice * obj.num).toFixed(2);
data[i] = obj;
cpHzObj.price += parseFloat(obj.price) * obj.num;
cpHzObj.sumPrice += parseFloat(obj.sellingPrice) * obj.num;
cpHzObj.totalNum += obj.num;
}
cpHzObj.discount = cpHzObj.sumPrice / cpHzObj.price * 100;
that.cpHzObj = cpHzObj;
that.cpList = data;
}
})
},
}
}
</script>
<style>
page {
background-color: #F8F8F8;
padding-bottom: 260rpx;
}
.u-radio {
width: 200rpx !important;
}
.submitView {
width: 100%;
padding: 16rpx 0 26rpx;
background-color: #FFFFFF;
position: fixed;
bottom: 0;
left: 0;
border-top: 1rpx solid #f1f1f1;
display: flex;
align-items: center;
justify-content: center;
z-index: 100;
}
.submitBtn {
width: 666rpx;
}
.productBox {
background-color: #FFFFFF;
margin-top: 32rpx;
padding: 26rpx 0;
}
.tjcpName {
width: 686rpx;
height: 40rpx;
font-size: 16px;
font-weight: bold;
border-left: 6rpx solid #007AFF;
padding-left: 12rpx;
margin-left: 26rpx;
margin-top: 26rpx;
}
.cpInput {
width: 150rpx !important;
margin-right: 12rpx;
}
.cpInput>input {
box-sizing: border-box;
border: 1rpx solid #DDDDDD;
width: 100%;
height: 60rpx;
border-radius: 10rpx;
padding: 0 10rpx;
}
.cpInput1 {
width: 200rpx !important;
margin-right: 12rpx;
}
.cpInput1>input {
box-sizing: border-box;
border: 1rpx solid #DDDDDD;
width: 100%;
height: 60rpx;
border-radius: 10rpx;
padding: 0 10rpx;
}
.clearIcon {
position: absolute;
right: 6rpx;
top: 6rpx;
}
.greenPrice {
font-size: 16px;
color: #19BE6B !important;
font-weight: bold;
}
.disFlex {
display: flex;
align-items: center;
margin-bottom: 8rpx;
}
.inputName {
color: #ADADAD;
font-size: 16px;
}
.addHKQS {
display: flex;
align-items: center;
padding: 16rpx 26rpx;
font-size: 15px;
font-weight: bold;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
</style>
+282
View File
@@ -0,0 +1,282 @@
<template>
<view>
<!-- 标签页 -->
<u-sticky>
<div
style="
height: 43px;
border-bottom: 1rpx solid #eeeeee;
background-color: #ffffff;
"
>
<u-tabs
:list="tabList"
name="title"
active-color="red"
:is-scroll="false"
:current="activeTabIndex"
@change="onTabChange"
></u-tabs>
</div>
</u-sticky>
<!-- 搜索框 -->
<view class="search-box">
<u-search
v-model="searchKeyword"
placeholder="请输入配布单号"
:show-action="false"
@change="onSearch"
@custom="onSearch"
@search="onSearch"
></u-search>
</view>
<!-- 内容展示区 -->
<view class="content">
<!-- 空状态展示 -->
<view v-if="showEmpty" class="empty-state">
<dataNull
src="/static/img/chahua/gjNull.png"
title="暂无相关配布单"
title1="请添加或者更换搜索添加"
></dataNull>
</view>
<!-- 列表展示 -->
<scroll-view
v-else
scroll-y="true"
:style="{ height: 'calc(100vh - 120px)' }"
@scrolltolower="onLoadMore"
refresher-enabled
:refresher-triggered="triggered"
@refresherrefresh="onRefresh"
@refresherrestore="onRestore"
@refresherpulling="onPulling"
:refresher-threshold="45"
refresher-default-style="black"
:refresher-background="'#f8f8f8'"
>
<view
v-for="(item, index) in list"
:key="index"
@click="cardClickFun(item, index)"
>
<salepickscanview
:item="item"
:isSelect="isSelect"
:index="index"
></salepickscanview>
</view>
<!-- 加载更多提示 -->
<view class="load-more" v-if="list.length > 0">
{{ hasMore ? "正在加载更多..." : "没有更多数据了" }}
</view>
</scroll-view>
</view>
</view>
</template>
<script>
import dataNull from "@/components/dataNull/dataNull.vue";
import salepickscanview from "@/pages/saleship/salepickscanview.vue";
import util from "../../common/util";
export default {
components: {
dataNull,
salepickscanview,
},
data() {
return {
isSelect: false,
// tab列表
tabList: [
{ title: '未配', status: '1,2' }, // 未配:1待配布,2配布中
{ title: '已配', status: '3,4' }, // 已配:3已配布,4待出仓
{ title: '全部', status: '1,2,3,4' } // 全部:所有状态
],
// 当前激活的tab索引
activeTabIndex: 0,
// 搜索关键词
searchKeyword: "",
// 列表数据
list: [],
// 加载状态
loading: false,
pageIndex: 1,
pageSize: 15,
hasMore: true,
triggered: false,
isRefreshing: false,
searchTimer: null, // 添加防抖定时器
};
},
computed: {
showEmpty() {
return !this.loading && this.list.length === 0;
},
},
methods: {
// 获取数据
async getData(isLoadMore = false) {
this.$u.api.getFpmArrangeOrderList({
order_no: this.searchKeyword,
src_order_no: this.searchKeyword,
business_status_ids: this.tabList[this.activeTabIndex].status, // 根据tab传递对应的状态组合
page: this.pageIndex,
size: this.pageSize,
}).then(res => {
const newList = res.list || [];
this.hasMore = newList.length === this.pageSize;
this.list = isLoadMore ? [...this.list, ...newList] : newList;
console.log('newList',newList)
}).catch(e => {
uni.showToast({
title: e.msg,
icon: "none",
});
}).finally(() => {
this.loading = false;
uni.hideLoading();
if (!isLoadMore) {
setTimeout(() => {
this.triggered = false;
this.isRefreshing = false;
}, 500);
}
})
},
// 下拉刷新
async onRefresh() {
if (this.isRefreshing) return;
this.isRefreshing = true;
this.triggered = true;
this.pageIndex = 1;
this.hasMore = true;
try {
await this.getData(false);
} catch (error) {
uni.showToast({
title: "刷新失败",
icon: "none",
});
}
},
// 加载更多
onLoadMore() {
if (this.loading || !this.hasMore) return;
this.pageIndex += 1;
this.loadData(true);
},
// tab切换
onTabChange(index) {
this.activeTabIndex = index;
this.searchKeyword = "";
this.pageIndex = 1;
this.hasMore = true;
this.list = [];
this.loadData();
},
// 搜索防抖处理
onSearch() {
if (this.searchTimer) {
clearTimeout(this.searchTimer);
}
this.searchTimer = setTimeout(() => {
this.pageIndex = 1;
this.hasMore = true;
this.list = [];
this.loadData();
}, 300); // 300ms 的防抖延迟
},
// 加载数据
loadData(isLoadMore = false) {
if (this.loading) return;
this.loading = true;
if (!isLoadMore) {
uni.showLoading({
title: "加载中...",
mask: false,
});
}
this.getData(isLoadMore);
},
// 点击卡片
cardClickFun(item) {
uni.navigateTo({
url: `/pages/saleship/salepickscandetail?billid=${item.id}&order_no=${item.order_no}`,
});
},
onPulling() {},
onRestore() {
this.triggered = false;
this.isRefreshing = false;
},
},
onLoad() {
this.loadData();
},
// 组件销毁时清理定时器
onUnload() {
if (this.searchTimer) {
clearTimeout(this.searchTimer);
}
}
};
</script>
<style>
page {
background-color: #f8f8f8;
}
.search-box {
padding: 10px;
background-color: #ffffff;
}
.content {
padding: 5px 0px 10px 0px;
min-height: calc(100vh - 120px);
}
.content text {
display: block;
margin-bottom: 10px;
font-size: 14px;
color: #666;
}
.empty-state {
display: flex;
justify-content: center;
align-items: center;
}
.load-more {
text-align: center;
padding: 15px 0;
color: #999;
font-size: 14px;
}
</style>
+736
View File
@@ -0,0 +1,736 @@
<template>
<view class="wrap">
<u-form ref="uForm">
<u-form-item>
<text class="title" style="width: 200px">单号:{{ BillNo }}</text>
<text class="title" style="width: 200px">日期:{{ BillDate }}</text>
</u-form-item>
<u-form-item>
<text class="title" style="width: 200px"
>客户名称:{{ CustomerName }}</text
>
<text class="title" style="width: 200px"
>销 售 员:{{ SaleUserName }}</text
>
</u-form-item>
<u-form-item>
<text class="title" style="width: 200px"
>仓库名称:{{ StoreName }}{{ ToStoreName }}</text
>
</u-form-item>
<u-form-item>
<text class="title" style="width: 200px"
>备注内容:{{ BillRemark }}</text
>
</u-form-item>
<u-form-item label-width="130" label="条码资料:">
<input
type="text"
v-model="QRBarCode"
maxlength="-1"
style="width: 170px"
@confirm="SalePickBillDetailScan"
/>
<checkbox-group @change="handleAllCrockNoChange">
<checkbox :checked="AllCrockNoScanStatus">整缸</checkbox>
</checkbox-group>
<checkbox-group @change="handleBarCodeDelChange">
<checkbox :checked="BarCodeDelStatus">删除</checkbox>
</checkbox-group>
</u-form-item>
</u-form>
<u-form ref="uForm">
<u-form-item>
<text class="title" style="width: 400px"
>成品名称:{{ FabricGoodsNo }}{{ FabricGoodsName }}</text
>
</u-form-item>
<u-form-item>
<text class="title" style="width: 400px"
>色号颜色:{{ GoodsCodeNo }}{{ GoodsCodeName }}</text
>
</u-form-item>
<u-form-item>
<text class="title" style="width: 200px">成品缸号:{{ CrockNo }}</text>
<text class="title" style="width: 200px"
>成品卷号:{{ GoodsBillNo }}</text
>
</u-form-item>
<u-form-item>
<text class="title">{{ BillDataMessage }}</text>
</u-form-item>
<u-form-item>
<text class="title" style="width: 130px"
>配布条数:{{ BillSumRoll }}</text
>
<text class="title" style="width: 130px">数量:{{ BillSumQty }}</text>
<text class="title" style="width: 120px">米数:{{ BillSumMQty }}</text>
</u-form-item>
<u-form-item>
<text class="title" style="width: 130px"
>已配条数:{{ BillScanRoll }}</text
>
<text class="title" style="width: 130px">数量:{{ BillScanQty }}</text>
<text class="title" style="width: 120px">米数:{{ BillScanMQty }}</text>
</u-form-item>
<view class="submitView">
<u-button
type="primary"
class="submitBtn"
:ripple="true"
:loading="submitLoading"
ripple-bg-color="#909399"
@click="submitBtnFun"
>
{{ pageType ? "保存" : "提交" }}
</u-button>
</view>
</u-form>
<view class="u-demo-area">
<u-toast ref="uToast"></u-toast>
<wyb-table
ref="table"
:headers="headersMaster"
:contents="GoodsDetailList"
/>
</view>
</view>
</template>
<script>
import util, {
parFabricGoodsBarCode2D,
parYarnGoodsBarCode2D,
playSuccessAudio,
playErrorAudio,
} from "../../common/util";
import wybTable from "@/components/wyb-table/wyb-table.vue";
let that = "";
export default {
data() {
return {
SaleBillNo: "", // 单号
BillMasterID: 0, // 订单ID
borderColor: "#e4e7ed",
align: "center",
index: 0,
pageType: "",
submitLoading: false,
actionSheetShow: false,
QRBarCode: "",
BillNo: "",
BillDate: "",
BillTypeID: 0,
BillRemark: "",
CustomerName: "",
StoreNameID: 0,
StoreName: "",
ToStoreName: "",
SaleUserName: "",
BillTypeName: "",
FabricGoodsNo: "",
FabricGoodsName: "",
GoodsCodeNo: "",
GoodsCodeName: "",
CrockNo: "",
GoodsBillNo: "",
BillSumRoll: 0,
BillSumQty: 0,
BillSumMQty: 0,
BillScanRoll: 0,
BillScanQty: 0,
BillScanMQty: 0,
AllCrockNoScanStatus: false,
BarCodeDelStatus: false,
GoodsDetailList: [],
BillDataMessage: "",
headersMaster: [
{
label: "成品编号",
key: "product_code",
},
{
label: "色号",
key: "product_color_code",
},
{
label: "颜色",
key: "product_color_name",
},
{
label: "缸号",
key: "dye_factory_dyelot_number",
},
{
label: "配布条数",
key: "push_roll",
},
{
label: "配布数量",
key: "push_weight",
},
{
label: "配布长度",
key: "push_length",
},
{
label: "已配条数",
key: "arrange_roll",
},
{
label: "已配数量",
key: "arrange_weight",
},
{
label: "成品等级",
key: "product_level_name",
},
{
label: "成品备注",
key: "product_remark",
},
],
scanningInput: "", // 用于累积扫码输入
lastKeyTime: 0, // 用于判断扫码速度
scanReceiver: null,
isPageActive: false, // 添加页面活动状态标志
};
},
onLoad(e) {
that = this;
if (e.billid) {
that.BillMasterID = e.billid;
}
if (e.order_no) {
that.SaleBillNo = e.order_no;
}
this.SalePickDetail();
// #ifdef APP-PLUS
this.isPageActive = true;
// this.registerScanBroadcast();
// #endif
},
onUnload() {
// #ifdef APP-PLUS
this.isPageActive = false;
this.unregisterScanBroadcast();
// #endif
},
onHide() {
// 页面隐藏时
this.isPageActive = false;
// #ifdef APP-PLUS
this.unregisterScanBroadcast();
// #endif
},
onShow() {
// 页面显示时
this.isPageActive = true;
// #ifdef APP-PLUS
this.registerScanBroadcast();
// #endif
},
methods: {
playSuccess() {
util.playSuccessAudio();
},
playError() {
util.playErrorAudio();
},
handleAllCrockNoChange() {
if (this.AllCrockNoScanStatus) {
this.AllCrockNoScanStatus = false;
} else {
this.AllCrockNoScanStatus = true;
this.BarCodeDelStatus = false;
}
},
handleBarCodeDelChange() {
if (this.BarCodeDelStatus) {
this.BarCodeDelStatus = false;
} else {
this.BarCodeDelStatus = true;
this.AllCrockNoScanStatus = false;
}
},
SalePickDetail: function () {
// 获取成品配布单详情
this.$u.api.getFpmArrangeOrder({
id: this.BillMasterID,
order_no: this.SaleBillNo
}).then(res => {
this.triggered = false;
var aResultData = res;
this.BillMasterID = aResultData.id; // 重写订单ID
this.BillNo = aResultData.order_no; // 重写单号
this.BillDate = this.$u.timeFormat(
aResultData.arrange_time,
"yyyy-mm-dd"
);
this.CustomerName = aResultData.biz_unit_name;
this.StoreNameID = aResultData.warehouse_id;
this.StoreName = aResultData.warehouse_name;
this.SaleUserName = aResultData.sale_user_name;
this.BillTypeName = aResultData.out_order_type_name;
this.BillRemark = aResultData.internal_remark;
this.BillSumRoll = aResultData.push_roll / 100 + "匹";
this.BillSumQty = aResultData.push_weight / 10000 + "Kg";
this.BillSumMQty = aResultData.push_length / 10000 + "米";
this.BillScanRoll = aResultData.total_roll / 100 + "匹";
this.BillScanQty = aResultData.total_weight / 10000 + "Kg";
this.BillScanMQty = aResultData.total_length / 10000 + "米";
let aResultDataList = res.item_data;
for (var i = 0; i < aResultDataList.length; i++) {
aResultDataList[i].push_roll = aResultDataList[i].push_roll / 100;
aResultDataList[i].push_weight = aResultDataList[i].push_weight / 10000;
aResultDataList[i].push_length = aResultDataList[i].push_length / 10000;
aResultDataList[i].arrange_roll = aResultDataList[i].arrange_roll / 100;
aResultDataList[i].arrange_weight = aResultDataList[i].arrange_weight / 10000;
}
this.GoodsDetailList = aResultDataList;
}).catch(error => {
this.triggered = false;
this.showError(error.msg);
});
},
// 添加通用错误提示方法
showError(message) {
this.playError();
uni.showModal({
title: '提示',
content: message,
showCancel: false
});
},
// 添加成功提示方法
showSuccess(message) {
this.playSuccess();
uni.showToast({
title: message,
icon: 'success'
});
},
handleScans() {
// 删除模式判断
let aBarCodeDelStatus = 1; // 1=正常扫码,3=删除模式
if (this.BarCodeDelStatus) {
aBarCodeDelStatus = 3;
}
// 整缸扫描判断
let aAllCrockNoScanStatus = 2; // 0=普通扫描,1=整缸扫描
if (this.AllCrockNoScanStatus) {
aAllCrockNoScanStatus = "1";
}
// 数据清理:去除空格、换行符等
let cleanCode = this.QRBarCode.replace(/\s+/g, '').replace(/[\r\n]/g, '');
console.log("this.QRBarCode ---->>" + cleanCode);
// 初始化条码和二维码变量
let aQRBarCode = "";
let aBarCode = "";
if (cleanCode.startsWith("66^") || cleanCode.startsWith("99^") || /[\u4E00-\u9FA5]/.test(cleanCode)) {
aQRBarCode = cleanCode;
} else {
aBarCode = cleanCode;
}
if (aQRBarCode == "" && aBarCode == "") {
this.QRBarCode = "";
this.showError('请扫描二维码或者条码');
return;
}
console.log('请求参数', aBarCodeDelStatus);
console.log('请求参数', aBarCode);
console.log('请求参数', aQRBarCode);
console.log('请求参数', this.BillMasterID);
console.log('请求参数 SaleBillNo', this.SaleBillNo);
console.log('请求参数 token', uni.getStorageSync("userToken").Token);
// 发送请求
util.request({
url: "/product/fpmArrangeOrder/updateFpmArrangeOrder",
method: "PUT",
header: {
Platform: 2,
Authorization: uni.getStorageSync("userToken").Token,
},
data: {
arrange_type: aBarCodeDelStatus, // 1=正常扫码,3=删除模式
bar_code: aBarCode, // 条码(如果是条形码就使用这个)
qr_code: aQRBarCode, // 二维码(如果是二维码就使用这个)
id: parseInt(this.BillMasterID), // 订单ID
// order_no: this.SaleBillNo, // 单号
},
success: (res) => {
console.log('API响应:', res);
if (res.data.code == 0 && res.data.msg == "success") {
var aResultData = res.data.data;
this.playSuccess();
this.FabricGoodsNo = aResultData.product_code;
this.FabricGoodsName = aResultData.product_name;
this.GoodsCodeNo = aResultData.product_color_code;
this.GoodsCodeName = aResultData.product_color_name;
this.CrockNo = aResultData.dyelot_number;
this.GoodsBillNo = aResultData.volume_number;
this.QRBarCode = "";
if (aBarCodeDelStatus == 1) {
this.showSuccess("扫描成功!");
} else {
this.showSuccess("删除成功!");
}
this.SalePickDetail();
} else {
this.showError("扫描出错," + res.data.msg);
this.QRBarCode = "";
}
},
fail: (error) => {
console.error('API请求失败:', error);
this.QRBarCode = "";
this.showError("连接服务器出错,请检查后台服务是否启动!");
},
});
},
// 注册扫码广播接收器(支持商米和新大陆扫码头)
registerScanBroadcast() {
try {
// 先尝试注册商米扫码头
this.registerSunmiBroadcast()
.then(() => {
console.log('商米扫码头注册成功');
})
.catch((error) => {
console.log('商米扫码头注册失败,尝试新大陆扫码头:', error);
// 如果商米扫码头注册失败,尝试新大陆扫码头
this.registerNewlandBroadcast();
});
} catch (error) {
console.error("注册扫码广播失败:", error);
}
},
// 注册商米扫码头广播接收器
registerSunmiBroadcast() {
return new Promise((resolve, reject) => {
try {
const main = plus.android.runtimeMainActivity();
const IntentFilter = plus.android.importClass("android.content.IntentFilter");
const filter = new IntentFilter();
filter.addAction("com.sunmi.scanner.ACTION_DATA_CODE_RECEIVED");
const receiver = plus.android.implements(
"io.dcloud.feature.internal.reflect.BroadcastReceiver",
{
onReceive: (context, intent) => {
console.log('商米扫码广播接收,isPageActive:', this.isPageActive);
// 只有当页面活动时才处理广播
if (!this.isPageActive) return;
try {
const scanResult = intent.getStringExtra("data");
const sourceBytes = intent.getByteArrayExtra("source_byte");
console.log('商米扫码结果:', scanResult, sourceBytes);
if (scanResult) {
this.handleScanResult(scanResult);
}
} catch (error) {
console.error('处理商米广播数据时出错:', error);
}
}
}
);
// 注册广播接收器
main.registerReceiver(receiver, filter);
this.scanReceiver = receiver;
console.log('商米扫码广播接收器注册成功');
resolve();
} catch (error) {
console.error('注册商米广播接收器失败:', error);
reject(error);
}
});
},
// 注册新大陆扫码头广播接收器
registerNewlandBroadcast() {
try {
const main = plus.android.runtimeMainActivity();
// 先配置扫码枪广播设置
try {
const Intent = plus.android.importClass("android.content.Intent");
const intent = new Intent("com.android.scanner.service_settings");
intent.putExtra(
"action_barcode_broadcast",
"com.android.server.scannerservice.broadcast"
);
intent.putExtra("key_barcode_broadcast", "scannerdata");
main.sendBroadcast(intent);
console.log('新大陆扫码枪广播配置完成');
} catch (error) {
console.error("配置新大陆扫码枪广播失败:", error);
}
// 注册广播接收器
const IntentFilter = plus.android.importClass(
"android.content.IntentFilter"
);
const filter = new IntentFilter();
filter.addAction("com.android.server.scannerservice.broadcast");
console.log("添加新大陆广播action完成");
const receiver = plus.android.implements(
"io.dcloud.feature.internal.reflect.BroadcastReceiver",
{
onReceive: (context, intent) => {
console.log('新大陆扫码广播接收,isPageActive:', this.isPageActive);
// 只有当页面活动时才处理广播
if (!this.isPageActive) return;
try {
const scanResult = intent.getStringExtra("scannerdata");
console.log("新大陆扫码结果:", scanResult);
if (scanResult) {
this.handleScanResult(scanResult);
}
} catch (error) {
console.error("处理新大陆广播数据时出错:", error);
}
},
}
);
// 注册广播接收器
main.registerReceiver(receiver, filter);
this.scanReceiver = receiver;
console.log("新大陆扫码广播注册成功,等待扫码...");
} catch (error) {
console.error("注册新大陆扫码广播失败:", error);
throw error;
}
},
// 处理扫码结果的统一方法
handleScanResult(scanResult) {
try {
// 数据清理:去除空格、换行符等
let cleanCode = scanResult.replace(/\s+/g, '').replace(/[\r\n]/g, '');
console.log("配布单详情-扫码结果:", cleanCode);
this.QRBarCode = cleanCode;
this.$nextTick(() => {
this.handleScans();
});
} catch (error) {
console.error("处理扫码结果时出错:", error);
}
},
// 注销扫码广播接收器
unregisterScanBroadcast() {
if (this.scanReceiver) {
try {
const main = plus.android.runtimeMainActivity();
main.unregisterReceiver(this.scanReceiver);
this.scanReceiver = null;
console.log("扫码广播注销成功");
} catch (error) {
console.error("注销扫码广播失败:", error);
}
}
},
SalePickBillDetailScan() {
// 聚焦输入框触发的方法
this.handleScans();
},
// 提交按钮方法
submitBtnFun: function () {
if (this.BillMasterID == 0) {
this.playError();
this.BillDataMessage = "单号为空,不能提交";
return;
}
// 获取配布总匹数和已配匹数进行比较
const totalRoll = parseFloat(this.BillSumRoll.replace('匹', '')); // 配布总匹数
const arrangedRoll = parseFloat(this.BillScanRoll.replace('匹', '')); // 已配匹数
if (arrangedRoll < totalRoll) {
// 如果已配匹数小于总匹数,显示确认弹窗
uni.showModal({
title: '提示',
content: '配布匹数不足,是否确定提交',
cancelText: '取消',
confirmText: '确定',
success: (res) => {
if (res.confirm) {
// 用户点击确定,继续提交
this.submitOrder();
}
}
});
} else {
// 匹数足够,直接提交
this.submitOrder();
}
},
// 新增提交订单的方法
submitOrder: function() {
this.submitLoading = true
this.$u.api.outFpmArrangeOrder({
id: parseInt(this.BillMasterID)
}).then(res => {
this.submitLoading = false
console.log('outFpmArrangeOrder res',res)
if (res) {
this.BillDataMessage = "成功生成出仓单!";
this.playSuccess();
} else {
this.playError();
this.BillDataMessage = "提交生成出仓单出错!" + res.msg;
return;
}
}).catch(error => {
this.submitLoading = false
this.playError();
this.BillDataMessage = "连接服务器出错,请检查后台服务是否启动!";
});
},
},
};
</script>
<style>
page {
background-color: #f8f8f8;
padding-bottom: 260rpx;
}
.u-radio {
width: 200rpx !important;
}
.submitView {
width: 100%;
padding: 16rpx 0 26rpx;
background-color: #ffffff;
position: fixed;
bottom: 0;
left: 0;
border-top: 1rpx solid #f1f1f1;
display: flex;
align-items: center;
justify-content: center;
z-index: 100;
}
.submitBtn {
width: 666rpx;
}
.productBox {
background-color: #ffffff;
margin-top: 32rpx;
padding: 26rpx 0;
}
.tjcpName {
width: 686rpx;
height: 40rpx;
font-size: 16px;
font-weight: bold;
border-left: 6rpx solid #007aff;
padding-left: 12rpx;
margin-left: 26rpx;
margin-top: 26rpx;
}
.cpInput {
width: 150rpx !important;
margin-right: 12rpx;
}
.cpInput > input {
box-sizing: border-box;
border: 1rpx solid #dddddd;
width: 100%;
height: 60rpx;
border-radius: 10rpx;
padding: 0 10rpx;
}
.cpInput1 {
width: 200rpx !important;
margin-right: 12rpx;
}
.cpInput1 > input {
box-sizing: border-box;
border: 1rpx solid #dddddd;
width: 100%;
height: 60rpx;
border-radius: 10rpx;
padding: 0 10rpx;
}
.clearIcon {
position: absolute;
right: 6rpx;
top: 6rpx;
}
.greenPrice {
font-size: 16px;
color: #19be6b !important;
font-weight: bold;
}
.disFlex {
display: flex;
align-items: center;
margin-bottom: 8rpx;
}
.inputName {
color: #adadad;
font-size: 16px;
}
.addHKQS {
display: flex;
align-items: center;
padding: 16rpx 26rpx;
font-size: 15px;
font-weight: bold;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
</style>
+86
View File
@@ -0,0 +1,86 @@
<template>
<view class="myCard" @click="gotoDetailFun">
<view class="cardTopName">单号:{{item.order_no}} {{item.out_order_type_name}}</view>
<view class="cardRow">
<view>配布日期:</view>
<view>{{this.$u.timeFormat(item.arrange_time, 'yyyy-mm-dd')}}</view>
</view>
<view class="cardRow">
<view>进度状态:</view>
<view class="fzrRight">{{item.business_status_name}}</view>
</view>
<view class="cardRow">
<view>客户名称:</view>
<view>{{item.biz_unit_name}}</view>
</view>
<view class="cardRow">
<view>预约单号:</view>
<view>{{item.src_order_no}}</view>
</view>
<view class="cardRow">
<view>销售员:</view>
<view>{{item.sale_user_name}}</view>
</view>
<view class="cardRow">
<view>仓库名称:</view>
<view>{{item.warehouse_name}}</view>
</view>
<view class="cardRow">
<view>配布数量:</view>
<text class="fzrRight">{{item.push_roll/100}}条 {{item.push_weight/10000}}KG {{item.push_roll/100}}米</text>
</view>
<view class="cardRow">
<view>已配数量:</view>
<text class="fzrRight">{{item.total_roll/100}}条 {{item.total_weight/10000}}Kg {{item.total_length/100}}米</text>
</view>
<view v-if="!isDetail && !isSelect" class="lookDetail">
<text>查看详情</text>
<u-icon name="arrow-right" size="36"></u-icon>
</view>
</view>
</template>
<script>
export default {
props: {
item: {
type: Object,
default: () => {}
},
index: {
type: Number,
default: 0
},
isSelect: {
type: Boolean,
default: false
},
isDetail: {
type: Boolean,
default: false
}
},
data() {
return {
}
},
methods: {
gotoDetailFun: function() {
if(this.isSelect) {
return
}
//uni.$bjInfo = this.item;
console.log("----444->>>>" + this.index);
/* uni.navigateTo({
url: '/pages/saleship/salepickscandetail?billid=' + this.index
}) */
}
}
}
</script>
<style>
</style>
+234
View File
@@ -0,0 +1,234 @@
<template>
<view class="wrap" style="padding-bottom: 60px;">
<u-tabs :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
<!-- 当前套餐 -->
<view v-if="current === 0">
<u-form :model="form" class="apply-form-field">
<u-gap height="20" bg-color="#f5f5f5"></u-gap>
<u-form-item label="营销部门" label-width="150" right-icon="arrow-right">
<u-input :border="border" type="select" :select-open="actionSheetShow" v-model="model.sex" placeholder="请选择性别" @click="actionSheetShow = true"></u-input>
</u-form-item>
<u-gap height="20" bg-color="#f5f5f5"></u-gap>
<u-form-item label="预约时间" label-width="150" right-icon="arrow-right">
<u-calendar v-model="show" ref="calendar" @change="changedate" :mode="date"
:start-text="startText" :end-text="endText" :range-color="rangeColor"
:range-bg-color="rangeBgColor" :active-bg-color="activeBgColor" :btn-type="btnType"
>
</u-calendar>
</u-form-item>
<u-form-item label="客户名称" label-width="150" right-icon="arrow-right">
<u-input placeholder="请选择" type="select" class="form-field-select"/>
</u-form-item>
<u-form-item label="销售员工" label-width="150" right-icon="arrow-right">
<u-input placeholder="请选择" type="select" class="form-field-select"/>
</u-form-item>
<u-form-item :label-position="labelPosition" label="含税项目" prop="payType" label-width="150">
<u-radio-group v-model="radio" @change="radioGroupChange" :width="radioCheckWidth" :wrap="radioCheckWrap">
<u-radio shape="circle" v-for="(item, index) in radioList" :key="index" :name="item.name">{{ item.name }}</u-radio>
</u-radio-group>
</u-form-item>
<u-form-item label="销售税率" label-width="150" right-icon="arrow-right">
<u-input placeholder="请选择" type="select" class="form-field-select"/>
</u-form-item>
<u-form-item label="物流公司" label-width="150" right-icon="arrow-right">
<u-input placeholder="请选择" type="select" class="form-field-select"/>
</u-form-item>
<u-form-item label="收货地址" label-width="150" right-icon="arrow-right">
<u-input placeholder="请选择" type="select" class="form-field-select"/>
</u-form-item>
<u-gap height="20" bg-color="#f5f5f5"></u-gap>
<u-form-item label="内部备注" label-width="150"></u-form-item>
<u-form-item><u-input type="textarea" placeholder="请输入内容"/></u-form-item>
<u-gap height="20" bg-color="#f5f5f5"></u-gap>
<u-form-item label="出货备注" label-width="150"></u-form-item>
<u-form-item><u-input type="textarea" placeholder="请输入内容"/></u-form-item>
<u-gap height="20" bg-color="#f5f5f5"></u-gap>
</u-form>
<u-row gutter="32" class="bottom-box" justify="center">
<u-col span="10">
<view><u-button type="primary" shape="circle" @click="navTo('/pages/sys/home/index')">确定</u-button></view>
</u-col>
</u-row>
</view>
<!--
<view v-if="current === 1">
<view class="search">
<u-search v-model="keywords" @custom="search" @search="search"></u-search>
</view>
<u-card class="task-list-item" :border="false" padding="20" margin="20rpx">
<view slot="head" style="display: flex;align-items: center;justify-content: space-between;">
<view style="display: flex;align-items: center;font-size: 30rpx;"><image class="user-images" src="/static/aidex/images/user06.png"></image>李毅的请假申请</view><view style="color: #999999;font-size: 22rpx;">2021年10月24日</view>
</view>
<view class="" slot="body">
<u-row gutter="16">
<u-col span="12">
<view class="apply-text"><span>假期类型:</span>年假</view>
</u-col>
<u-col span="12">
<view class="apply-text"><span>开始时间:</span>2021年10月25日14:30</view>
</u-col>
<u-col span="12">
<view class="apply-text"><span>结束时间:</span>2021年10月27日14:30</view>
</u-col>
</u-row>
</view>
<view class="apply-list-foot" slot="foot" style="text-align: right;color: #58ca93;">
审批通过
</view>
</u-card>
<u-card class="task-list-item" :border="false" padding="20" margin="20rpx">
<view slot="head" style="display: flex;align-items: center;justify-content: space-between;">
<view style="display: flex;align-items: center;font-size: 30rpx;"><image class="user-images" src="/static/aidex/images/user06.png"></image>李毅的请假申请</view><view style="color: #999999;font-size: 22rpx;">2021年10月24日</view>
</view>
<view class="" slot="body">
<u-row gutter="16">
<u-col span="12">
<view class="apply-text"><span>假期类型:</span>年假</view>
</u-col>
<u-col span="12">
<view class="apply-text"><span>开始时间:</span>2021年10月25日14:30</view>
</u-col>
<u-col span="12">
<view class="apply-text"><span>结束时间:</span>2021年10月27日14:30</view>
</u-col>
</u-row>
</view>
<view class="apply-list-foot" slot="foot" style="text-align: right;color: #58ca93;">
审批通过
</view>
</u-card>
<u-card class="task-list-item" :border="false" padding="20" margin="20rpx">
<view slot="head" style="display: flex;align-items: center;justify-content: space-between;">
<view style="display: flex;align-items: center;font-size: 30rpx;"><image class="user-images" src="/static/aidex/images/user06.png"></image>李毅的请假申请</view><view style="color: #999999;font-size: 22rpx;">2021年10月24日</view>
</view>
<view class="" slot="body">
<u-row gutter="16">
<u-col span="12">
<view class="apply-text"><span>假期类型:</span>年假</view>
</u-col>
<u-col span="12">
<view class="apply-text"><span>开始时间:</span>2021年10月25日14:30</view>
</u-col>
<u-col span="12">
<view class="apply-text"><span>结束时间:</span>2021年10月27日14:30</view>
</u-col>
</u-row>
</view>
<view class="apply-list-foot" slot="foot" style="text-align: right;color: #f28c03;">
待审核
</view>
</u-card>
</view>
!-->
</view>
</template>
<script>
export default {
data() {
return {
saleallocated: {
planDepartmentName: '',
allocatdDate: date,
cusotmerName: '',
saleUserName: '',
taxTypeName: '不含税',
taxRate:0,
shipCompanyName: false,
saleCustomerAddress: '',
saleAllocatedDetallist:[]
},
taxtypenameList: [
{
name: '含税',
checked: false,
disabled: false
},
{
name: '不含税',
checked: true,
disabled: false
}
],
list: [{
name: '发起申请'
}, {
name: '查看数据',
}],
m2mSimflowList:[],
m2mOrderFlowList:[],
current: 0,
status: 'loadmore',
iconType: 'circle',
isDot: false,
loadText: {
loadmore: '点击加载更多',
loading: '正在加载...',
nomore: '没有更多了'
},
}
},
created(){
},
methods: {
changedate(e) {
console.log(e);
},
change(index) {
this.current = index;
},
navTo(url) {
uni.navigateTo({
url: url
});
}
}
}
</script>
<style lang="scss" scoped>
@import 'index.scss';
page {
background-color: #f5f5f5;
}
.wrap .search{
background: #ffffff;
}
.apply-text{
font-size: 28rpx;
color: #333333;
span{
color: #999999;
}
}
.user-images{
width: 28px;
height:28px;
margin-right: 8px;
}
.apply-list-foot{
font-size: 28rpx;
}
.personnel-list{
display: flex;
align-items: center;
flex-wrap:wrap;
.personnel-user{
position: relative;
margin: 5px 9px 0;
}
.user-images{
width: 48px;
height:48px;
margin-right:0;
}
.iconfont{
position: absolute;
top:-12px;
right:-5px;
color: #FE0100;
}
}
</style>