123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338 |
- <template>
- <view style="padding-top: 1rpx;">
- <u--form labelPosition="left" :labelStyle="{color: '#fd4b09'}" :model="form" ref="form" labelWidth="180rpx"
- style="margin-top: 10rpx;padding-bottom: 130rpx;">
- <view style="width: calc(96%);margin: 0 auto;background-color: #fff;border-radius: 20rpx;">
- <u-cell-group :border="false">
- <u-cell :border="false" center title="基础信息" arrow-direction="down">
- <view slot="icon" style="width: 10rpx;height: 35rpx;background-color: #fd4b09;"></view>
- </u-cell>
- </u-cell-group>
- <view style="padding: 0 10rpx;">
- <u-form-item leftIcon="account" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="客户名称"
- prop="customerName" borderBottom @click="selectCustomer">
- <u-input v-model="form.customerName" inputAlign="right" border="none" placeholder="请选择客户名称"
- disabled disabledColor="#ffffff" />
- </u-form-item>
- <u-form-item leftIcon="account" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="联系人"
- prop="contacts" borderBottom @click="filterAll(['contacts','contacts'])">
- <u-input v-model="form.contacts" inputAlign="right" border="none" placeholder="请选择" disabled
- disabledColor="#ffffff">
- </u-input>
- </u-form-item>
- <u-form-item leftIcon="phone" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="电话"
- prop="phone" borderBottom>
- <u-input v-model="form.phone" inputAlign="right" border="none" placeholder="请选择"
- :disabled="form.generateTask != '未生成'" disabledColor="#ffffff">
- </u-input>
- </u-form-item>
- <u-form-item leftIcon="map" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="送货地址"
- prop="recAddress" borderBottom>
- <view style="width: 100%;text-align:right;padding-right: 10rpx;"
- v-if="form.generateTask != '未生成'">{{form.recAddress}}</view>
- <u--textarea v-else v-model="form.recAddress" autoHeight inputAlign="right" border="none"
- placeholder="请选择" :disabled="form.generateTask != '未生成'" disabledColor="#ffffff">
- <!-- <template slot="suffix">
- <u-icon name="map" color="#fd4b09" @tap="getMap"></u-icon>
- </template> -->
- </u--textarea>
- </u-form-item>
- <u-form-item leftIcon="account" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="业务员"
- prop="salerName" borderBottom @click="filterAll(['salerName','salerId'])">
- <u-input v-model="form.salerName" border="none" inputAlign="right" placeholder="请选择业务员" disabled
- disabledColor="#ffffff" />
- </u-form-item>
- <u-form-item leftIcon="calendar" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="日期"
- prop="businesDate" borderBottom @click="filterAll(['businesDate','businesDate'])">
- <u-input v-model="form.businesDate" inputAlign="right" border="none" placeholder="请选择日期"
- disabled disabledColor="#ffffff" />
- </u-form-item>
- <u-form-item leftIcon="home" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="发货仓库"
- prop="storageName" borderBottom @click="filterAll(['storageName','storageId'])">
- <u-input v-model="form.storageName" border="none" inputAlign="right" placeholder="请选择发货仓库"
- disabled disabledColor="#ffffff" />
- </u-form-item>
- <u-form-item leftIcon="car" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="配送方式"
- prop="cname" borderBottom @click="filterAll(['shipType','shipType'])">
- <u-input v-model="form.shipType" inputAlign="right" border="none" placeholder="请选择配送方式" disabled
- disabledColor="#ffffff" />
- </u-form-item>
- <u-form-item leftIcon="home" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="物流公司"
- prop="cname" borderBottom @click="filterAll(['logisticsCorpName','logisticsCorpId'])">
- <u-input v-model="form.logisticsCorpName" inputAlign="right" border="none" placeholder="请选择物流公司"
- disabled disabledColor="#ffffff" />
- </u-form-item>
- <u-form-item leftIcon="file-text" :leftIconStyle="{color: '#FD4B09',fontSize:'40rpx'}" label="物流单号"
- prop="cname" borderBottom>
- <u-input v-model="form.expressNo" inputAlign="right" border="none" placeholder="请输入物流单号"
- :disabled="form.generateTask != '未生成'" disabledColor="#ffffff" />
- </u-form-item>
- </view>
- </view>
- <view style="width: 95%;margin: 10rpx auto;">
- <view
- style="display: flex;align-items: center;justify-content: space-between;background: #fff;border-radius: 12rpx; padding: 20rpx;">
- <view style="font-size: 30rpx;color: #fd4b09;">产品列表{{form.orderItemsList.length}}</view>
- <view v-if="form.generateTask == '未生成'">
- <u-button type="primary" text="添加产品" shape="circle" size="small" color="#FD4B09"
- @click="chanpintiao()"></u-button>
- </view>
- </view>
- <view
- style="position: relative;background: #fff;padding: 20rpx;margin-top: 20rpx;border-box;font-size: 32rpx;"
- v-for="(item,index) in form.orderItemsList" :key="index" @click="tanchuangxgai(item,index)">
- <view v-if="form.generateTask == '未生成'" class="orderItemsDelent"
- @click="orderItemsDelent(item.id,index)">删除</view>
- <view>
- <u-row>
- <u-col span="3">
- <u--image :showLoading="true" :src="item.url?item.url:'../../../static/images/404.png'"
- width="80px" height="80px" radius="10">
- </u--image>
- </u-col>
- <u-col span="8">
- <!-- style="font-size: 36rpx;width: 420rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;" -->
- <view style="font-size: 36rpx;">
- {{item.goodsName}}
- </view>
- <view style="color: #707070;">批次号:{{item.dot}}</view>
- <view style="display: flex;justify-content: space-between;">
- <view style="color: #707070;">单价:¥{{Number(item.price).toFixed(2)}}</view>
- <view style="color: #707070;">
- 数量:{{item.goodsNum?parseInt(item.goodsNum):item.goodsNum}}</view>
- </view>
- <view style="display: flex;justify-content: space-between;">
- <view style="color: #707070;">金额:¥{{item.subTotalMoney}}</view>
- <view v-if="form.confirmStatus == 0" style="color: #707070; color: red;"
- @click="deleteProduct(index)">
- <u-button type="error" size="mini" text="删除"></u-button>
- </view>
- </view>
- </u-col>
- </u-row>
- </view>
- </view>
- </view>
- </u--form>
- <view style="width: 100%;position: fixed;
- bottom: 0;background-color: #fff;border-top: 1rpx solid #ccc;">
- <view style="width: 100%;display: flex;font-size: 24rpx;">
- <view @click="revokeCheckOrderRWfun" v-if="form.taskWhetherAdopt == '审核提交'" style="width: 100%; padding: 10rpx 0;
- background-color: #d2983c;display: grid;justify-items: center;">
- <u-icon name="edit-pen" color="#fff"></u-icon>
- <view style="color: #fff;">撤销出库任务审批</view>
- </view>
- <view @click="orderRevokeGenerateShipTaskfun" v-else-if="form.generateTask == '已生成'" style="width: 100%; padding: 10rpx 0;
- background-color: #d2983c;display: grid;justify-items: center;">
- <u-icon name="edit-pen" color="#fff"></u-icon>
- <view style="color: #fff;">撤销任务</view>
- </view>
- <view @click="orderGenerateTask" v-else
- style="width: 100%; padding: 10rpx 0; background-color: #5ac725;display: grid;justify-items: center;">
- <u-icon name="edit-pen" color="#fff"></u-icon>
- <view style="color: #fff;">生成任务</view>
- </view>
- <view @click="conserve"
- style="width: 100%; background-color: #FD4B09;display: grid;justify-items: center;">
- <u-icon name="edit-pen" color="#fff"></u-icon>
- <view style="color: #fff;">保存</view>
- </view>
- </view>
- </view>
- <!-- 弹窗数据 -->
- <u-popup :show="popupShow" @close="popupShow = false" :closeable="true" mode="center"
- customStyle="width: 90%;margin: 0 auto;">
- <view style="padding: 40rpx 25rpx;box-sizing: border-box;">
- <view style="text-align: center;margin: 10rpx 0;">
- <view style="font-size: 36rpx;word-break:break-all;">
- {{popupForm.cname}}
- </view>
- </view>
- <view style="width: 96%;margin: 0 auto;clear: both;">
- <u-cell-group>
- <u-cell title="单价">
- <view slot="value">
- <u--input type='number' placeholder="请输入单价" border="none" inputAlign="right"
- v-model="popupForm.price" clearable disabledColor="#ffffff">
- </u--input>
- </view>
- </u-cell>
- <u-cell title="数量">
- <view slot="value">
- <u-number-box v-model="popupForm.goodsNum" :min="0">
- </u-number-box>
- </view>
- </u-cell>
- <u-cell title="批次号(DOT)" @click="dotClickfun">
- <view slot="value">
- <u--input border="none" inputAlign="right" v-model="popupForm.dot" disabled
- placeholder="请选择批次号" disabledColor="#ffffff"></u--input>
- </view>
- </u-cell>
- <u-cell title="库存">
- <view slot="value">
- {{popupForm.inventory?popupForm.inventory:'--'}}
- </view>
- </u-cell>
- <u-cell title="规格型号">
- <view slot="value">
- {{popupForm.specificationAndModel?popupForm.specificationAndModel:'--'}}
- </view>
- </u-cell>
- </u-cell-group>
- </view>
- <view style="margin-top: 40rpx;text-align: center;
- font-size: 32rpx;">
- <view style="display: flex; color: #fff;justify-content: space-around;">
- <view style="color: #FD4B09; border: 1rpx solid #FD4B09;
- width: 200rpx; height: 80rpx;
- line-height: 80rpx; border-radius: 12rpx;" @click="popupShow = false">取消</view>
- <view
- style="background-color: #FF6F3B; width: 200rpx; height: 80rpx; line-height: 80rpx; border-radius: 12rpx;"
- @click="popupConserve()">保存</view>
- </view>
- </view>
- </view>
- </u-popup>
- <!-- 批次号弹窗 -->
- <u-picker :show="dotPickerShow" :columns="dotPickerColumns" keyName="dot" @confirm="dotPickerConfirm"
- @cancel="dotPickerShow = false"></u-picker>
- <u-datetime-picker :show="timeOpen" v-model="datetime" mode="date" @cancel="timeOpen = false"
- @confirm="confirmTiem"></u-datetime-picker>
- <u-picker :show="showOpen" :columns="columns" :defaultIndex="defaultIndex" :keyName="keyName"
- @cancel="showOpen = false" @confirm="showPicker"></u-picker>
- <u-toast ref="uToast"></u-toast>
- </view>
- </template>
- <script>
- import {
- queryBrand
- } from '@/api/views/stock/index.js'
- import {
- gainUser,
- storageDescListAll,
- corpsDescDetail,
- orderItemsRemove,
- stockDescDotList,
- corpsAddrCorpIdByAddr,
- orderGenerateShipTask,
- orderRevokeGenerateShipTask,
- revokeCheckOrderRW,
- isProcurement,
- checkOrderRW,
- whetherExistenceFinancing
- } from '@/api/views/sale/index.js'
- import {
- typeSave,
- submitApp,
- confirm,
- revoke,
- removeItem,
- removeId,
- copyOrder,
- collectPayment,
- saveAtta,
- } from '@/api/views/sale/salesOrderDetails.js'
- import http from '@/http/api.js'
- import {
- clientId,
- clientSecret
- } from '@/common/setting'
- import {
- dateFormat
- } from '@/common/dateFormat'
- // #ifdef APP-PLUS
- const HanyinPlugin = uni.requireNativePlugin('Hanyin-Plugin'); //汉印
- import printConnect from "@/common/print.js"; //引入打印机模板文件
- let print;
- // #endif
- import {
- GET_REQUEST_DATA
- } from "@/store/gettersType.js";
- import {
- mapGetters,
- mapActions
- } from 'vuex';
- import {
- DX
- } from '@/common/dateFormat.js';
- export default {
- data() {
- return {
- form: {
- orderItemsList: [],
- },
- datetime: Number(new Date()),
- timeOpen: false,
- screen: [],
- showOpen: false,
- choice: false,
- columns: [],
- connected: false,
- amountNumber: {
- deliveryAll: 0,
- cost: 0,
- grossProfit: 0,
- delivery: 0,
- saleAll: 0,
- amount: 0
- },
- // 会员卡余额
- balanceAmount: 0,
- // 深拷贝的优惠金额数据
- JsonthisUsedProfit: 0,
- keyName: '',
- // 业务员数据
- salesmanData: [],
- // 物流配送方式请求到的数据
- selectData: [],
- // 物流公司请求的数据
- logisticsCorpData: [],
- // 仓库数据
- warehouseData: [],
- // 联系人数据
- contactsData: [],
- popupShow: false,
- popupForm: {},
- popupIndex: 0,
- dotPickerShow: false,
- dotPickerColumns: [],
- defaultIndex: [0]
- }
- },
- onLoad(data) {
- this.queryBrandfun()
- this.HYqueryBrandfun()
- // 获取详情信息
- this.refresh(data.id)
- },
- computed: {
- ...mapGetters([GET_REQUEST_DATA])
- },
- onShow() {
- this.choice = false
- let this_ = this
- // #ifdef APP-PLUS
- HanyinPlugin.IsOpened(res => {
- this_.connected = res.state
- if (this_.GET_REQUEST_DATA.length == 0) {
- this_.connected = false
- print = new printConnect({}, 1); //打印机连接
- }
- });
- // #endif
- },
- onNavigationBarButtonTap(e) {
- this.choice = !this.choice
- },
- methods: {
- // 批次号打开弹窗按钮 获取批次号数据
- dotClickfun() {
- this.dotPickerShow = true
- console.log(this.popupForm, 284);
- stockDescDotList({
- storageId: this.form.storageId,
- goodsId: this.popupForm.goodsId
- }).then(res => {
- this.dotPickerColumns = [res.data]
- })
- },
- // 批次号弹窗的确认
- dotPickerConfirm(e) {
- this.popupForm.dot = e.value[0].dot
- this.dotPickerShow = false
- },
- //修改弹窗点击保存事件
- popupConserve() {
- if (this.popupForm.whether == 1) {
- if (!this.popupForm.dot) {
- return uni.showToast({
- icon: 'none',
- title: '批次号必填',
- position: "bottom"
- })
- }
- }
- if (!this.popupForm.goodsNum) {
- return uni.showToast({
- icon: 'none',
- title: '数量不能为0',
- position: "bottom"
- })
- }
- this.form.orderItemsList[this.popupIndex] = this.popupForm
- uni.hideLoading();
- this.popupShow = false
- },
- // 获取仓库数据
- storageDescListAllfun() {
- storageDescListAll().then(res => {
- this.warehouseData = res.data
- this.salesmanData.map(item => {
- if (item.id == this.form.storageId) {
- this.$set(this.form, 'storageName', item.cname)
- }
- })
- })
- },
- // 获取联系人数据 赋值第一项
- corpsAddrCorpIdByAddrfun(type) {
- corpsAddrCorpIdByAddr({
- pid: this.form.customerId
- }).then(res => {
- this.contactsData = res.data
- if (type == 'KH') {
- this.$set(this.form, 'contacts', this.contactsData[0].contacts)
- this.$set(this.form, 'recAddress', this.contactsData[0].address)
- this.$set(this.form, 'phone', this.contactsData[0].tel)
- }
- })
- },
- // 获取业务员信息
- gainUserfun() {
- gainUser({
- roleName: '业务员'
- }).then(res => {
- this.salesmanData = res.data
- this.salesmanData.map(item => {
- if (item.id == this.form.salerId) {
- this.$set(this.form, 'salerName', item.name)
- }
- })
- })
- },
- // 获取物流配送方式数据
- queryBrandfun() {
- queryBrand({
- code: 'deliveryMethod'
- }).then(res => {
- this.selectData = res.data
- })
- },
- // 获取货运公司数据
- HYqueryBrandfun() {
- queryBrand({
- code: 'tyre_express_company'
- }).then(res => {
- this.logisticsCorpData = res.data
- })
- },
- //跳转连接设备
- connectingDevices() {
- if (this.connected) {
- this.senBleLabel()
- } else {
- uni.$u.route('/pages/views/bluetooth/index', {
- data: JSON.stringify(this.form)
- });
- }
- },
- senBleLabel() {
- // if (!print) return;
- console.log(this.$Mock.printTemplate.pagConfig)
- this.$Mock.printTemplate.pagConfig = 0
- let data = []
- let i = 0
- for (let item of this.form.orderItemsList) {
- data.push({
- "top": Number(i * 40 + 90),
- "left": "0",
- "textAlign": "start",
- "width": "270",
- "fontSize": 9,
- "text": item.cname,
- "type": "text",
- "fontWeight": "400",
- "height": "20"
- })
- data.push({
- "top": Number(i * 40 + 110),
- "left": "140",
- "textAlign": "start",
- "width": "40",
- "fontSize": 8,
- "text": Number(item.storageInQuantity),
- "type": "text",
- "fontWeight": "400",
- "height": "20"
- })
- data.push({
- "top": Number(i * 40 + 110),
- "left": "160",
- "textAlign": "start",
- "width": "50",
- "fontSize": 8,
- "text": item.price,
- "type": "text",
- "fontWeight": "400",
- "height": "20"
- })
- data.push({
- "top": Number(i * 40 + 110),
- "left": "210",
- "textAlign": "start",
- "width": "60",
- "fontSize": 8,
- "text": item.amount,
- "type": "text",
- "fontWeight": "400",
- "height": "20"
- })
- i++
- }
- data.push({
- "top": Number(i * 40 + 90),
- "left": "20",
- "textAlign": "start",
- "width": "270",
- "fontSize": 9,
- "text": "合计:",
- "type": "text",
- "fontWeight": "400",
- "height": "20"
- })
- data.push({
- "top": Number(i * 40 + 90),
- "left": "140",
- "textAlign": "start",
- "width": "40",
- "fontSize": 8,
- "text": this.amountNumber.saleAll,
- "type": "text",
- "fontWeight": "400",
- "height": "20"
- })
- data.push({
- "top": Number(i * 40 + 90),
- "left": "210",
- "textAlign": "start",
- "width": "60",
- "fontSize": 8,
- "text": this.form.debitAmount,
- "type": "text",
- "fontWeight": "400",
- "height": "20"
- })
- data.push({
- "top": Number(i * 40 + 110),
- "left": "20",
- "textAlign": "start",
- "width": "270",
- "fontSize": 9,
- "text": "产品合计:",
- "type": "text",
- "fontWeight": "400",
- "height": "20"
- })
- data.push({
- "top": Number(i * 40 + 110),
- "left": "70",
- "textAlign": "start",
- "width": "70",
- "fontSize": 8,
- "text": this.amountNumber.amount,
- "type": "text",
- "fontWeight": "400",
- "height": "20"
- })
- data.push({
- "top": Number(i * 40 + 110),
- "left": "140",
- "textAlign": "start",
- "width": "60",
- "fontSize": 8,
- "text": "合计金额:",
- "type": "text",
- "fontWeight": "400",
- "height": "20"
- })
- data.push({
- "top": Number(i * 40 + 110),
- "left": "190",
- "textAlign": "start",
- "width": "80",
- "fontSize": 8,
- "text": DX(this.amountNumber.amount),
- "type": "text",
- "fontWeight": "400",
- "height": "40"
- })
- data.push({
- "top": Number(i * 40 + 130),
- "left": "20",
- "textAlign": "start",
- "width": "270",
- "fontSize": 9,
- "text": "订货电话:" + this.form.clientAttn,
- "type": "text",
- "fontWeight": "400",
- "height": "20"
- })
- data.push({
- "top": Number(i * 40 + 150),
- "left": "20",
- "textAlign": "start",
- "width": "270",
- "fontSize": 9,
- "text": "制单人:" + this.form.client,
- "type": "text",
- "fontWeight": "400",
- "height": "20"
- })
- data.push({
- "top": Number(i * 40 + 150),
- "left": "140",
- "textAlign": "start",
- "width": "80",
- "fontSize": 8,
- "text": "收货人(签字):",
- "type": "text",
- "fontWeight": "400",
- "height": "20"
- })
- print.startPrint({
- SALES_SLIP: this.form.sysNo,
- CUSTOMER_NAME: this.form.customerName,
- SALES_DATE: this.form.businesDate.slice(0, 10)
- }, {
- pageHeight: (this.form.orderItemsList.length * 40) / 3
- }, data);
- },
- generatePictures() {
- uni.$u.route('/pages/views/bluetooth/salesSlipTable', {
- data: JSON.stringify(this.form)
- });
- },
- //遮罩层禁止点击空方法
- moveHandle() {},
- newCompany() {
- uni.$u.route('/pages/views/product/createCompany', {
- code: "account",
- title: "收款账户"
- });
- },
- getMap() {
- let this_ = this
- uni.chooseLocation({
- success: function(res) {
- this_.$set(this_.form, "recAddress", res.address)
- }
- });
- },
- copyDocument() {
- let form = {
- ...this.form,
- }
- if (form.orderFilesList.length > 0) {
- form.orderFilesList.forEach(item => delete item.status)
- }
- let this_ = this
- uni.showModal({
- title: '提示',
- content: "是否确认复制新增",
- success: function(rest) {
- if (rest.confirm == true) {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- copyOrder(form).then(res => {
- uni.hideLoading();
- uni.showToast({
- icon: "none",
- title: '复制新增成功',
- mask: true
- });
- this_.form = res.data
- this_.amountNumber = {
- deliveryAll: 0, //送货总数量
- cost: 0, //成本
- grossProfit: 0, //毛利
- delivery: 0, //送货
- saleAll: 0, //销售数量
- amount: 0
- }
- for (let item of this_.form.orderItemsList) {
- this_.amountNumber.saleAll += Number(item.storageInQuantity)
- this_.amountNumber.cost += Number(item.storageInQuantity) * Number(
- item.purchasePrice)
- this_.amountNumber.delivery += Number(item.actualQuantity)
- this_.amountNumber.deliveryAll += Number(item.actualQuantity)
- this_.amountNumber.amount += Number(item.amount)
- this_.amountNumber.grossProfit += Number(item.amount) - (item
- .purchasePrice ? Number(item.storageInQuantity) * Number(
- item.purchasePrice) : 0)
- }
- this.form.orderAmount = this.amountNumber.amount
- })
- }
- }
- })
- },
- deleteDoc() {
- if (this.form.id) {
- let this_ = this
- if (this_.form.confirmStatus == 1) {
- return uni.showToast({
- icon: "none",
- title: '禁止删除',
- mask: true
- });
- }
- uni.showModal({
- title: '提示',
- content: "是否确认删除",
- success: function(rest) {
- if (rest.confirm == true) {
- removeId({
- id: this_.form.id
- }).then(res => {
- uni.showToast({
- icon: "none",
- title: '删除成功',
- mask: true
- });
- setTimeout(function() {
- uni.navigateBack()
- }, 1000);
- })
- }
- }
- })
- } else {
- uni.showToast({
- icon: "none",
- title: '未保存',
- mask: true
- });
- }
- },
- deleteProduct(index) {
- let this_ = this
- if (this_.form.orderItemsList[index].id) {
- uni.showModal({
- title: '提示',
- content: "是否确认删除",
- success: function(rest) {
- if (rest.confirm == true) {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- removeItem({
- itemId: this_.form.orderItemsList[index].id
- }).then(res => {
- uni.hideLoading();
- uni.showToast({
- icon: "none",
- title: '删除成功',
- mask: true
- });
- this_.form.orderItemsList.splice(index, 1)
- }).catch(err => {
- uni.hideLoading();
- })
- }
- }
- })
- } else {
- this_.form.orderItemsList.splice(index, 1)
- }
- },
- //时间确认选择
- confirmTiem(e) {
- this.form[this.screen[1]] = dateFormat(new Date(e.value), "YYYY-MM-DD HH:mm:ss")
- this.timeOpen = false
- },
- // 下拉选择
- showPicker(e) {
- console.log(this.screen[1]);
- if (this.screen[1] == "account") {
- this.formTwo.account = e.value[0].dictValue
- this.showOpen = false
- } else if (this.screen[1] == "salerId") {
- this.form.salerName = e.value[0].name
- this.form.salerId = e.value[0].id
- this.showOpen = false
- } else if (this.screen[1] == "storageId") {
- this.form.storageName = e.value[0].cname
- this.form.storageId = e.value[0].id
- this.showOpen = false
- } else if (this.screen[1] == "contacts") {
- this.form.contacts = e.value[0].contacts
- this.form.recAddress = e.value[0].address
- this.form.phone = e.value[0].tel
- this.showOpen = false
- } else if (this.screen[1] == "shipType") {
- this.form.shipType = e.value[0].dictValue
- this.showOpen = false
- } else if (this.screen[1] == "logisticsCorpId") {
- this.form.logisticsCorpId = e.value[0].dictKey
- this.form.logisticsCorpName = e.value[0].dictValue
- this.showOpen = false
- } else {}
- // this.form[this.screen[1]] = e.value[0].dictValue
- // this.showOpen = false
- },
- //集合筛选条件
- filterAll(screen) {
- // if (this.form.status != '录入') return
- if (this.form.generateTask != '未生成') return
- this.screen = screen
- switch (screen[1]) {
- case "businesDate":
- this.timeOpen = true
- break;
- case "account":
- this.$u.api.getWorkDicts('account').then(res => {
- this.columns = [res.data]
- this.defaultIndex = [0]
- this.keyName = 'dictValue'
- this.showOpen = true
- })
- break;
- case "settlmentAmount":
- uni.$u.route('/pages/views/salesSlip/collectionList', this.form);
- break;
- // 仓库
- case "storageId":
- this.columns = [this.warehouseData]
- this.defaultIndex = [0]
- this.keyName = 'cname'
- this.showOpen = true
- break;
- // 业务员
- case "salerId":
- this.columns = [this.salesmanData]
- this.defaultIndex = [0]
- this.keyName = 'name'
- this.showOpen = true
- break;
- // 联系人
- case "contacts":
- this.columns = [this.contactsData]
- this.defaultIndex = [0]
- this.keyName = 'contacts'
- this.showOpen = true
- break;
- // 配送方式
- case "shipType":
- this.columns = [this.selectData]
- this.defaultIndex = [0]
- this.keyName = 'dictValue'
- this.showOpen = true
- break;
- // 物流公司
- case "logisticsCorpId":
- this.columns = [this.logisticsCorpData]
- this.defaultIndex = [0]
- this.keyName = 'dictValue'
- this.showOpen = true
- break;
- }
- },
- // 弹窗修改
- tanchuangxgai(row, index) {
- if (this.form.generateTask != '未生成') return
- this.popupForm = row
- this.popupIndex = index
- this.popupShow = true
- },
- // 产品删除
- orderItemsDelent(id, index) {
- uni.showModal({
- title: '提示',
- content: '是否确认删除',
- success: (rest) => {
- console.log(rest);
- if (rest.confirm == true) {
- if (id) {
- orderItemsRemove({
- ids: id
- }).then(res => {
- this.form.orderItemsList.splice(index, 1);
- this.$refs.uToast.show({
- type: 'success',
- message: "操作成功",
- })
- })
- } else {
- this.form.orderItemsList.splice(index, 1);
- this.$refs.uToast.show({
- type: 'success',
- message: "操作成功",
- })
- }
- }
- }
- })
- },
- // 获取详情数据
- refresh(id) {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- typeSave({
- id: id
- }).then(res => {
- this.form = res.data
- this.gainUserfun()
- this.storageDescListAllfun()
- this.corpsAddrCorpIdByAddrfun()
- this.form.memberAmout = 0
- this.amountNumber = {
- deliveryAll: 0, //送货总数量
- cost: 0, //成本
- grossProfit: 0, //毛利
- delivery: 0, //送货
- saleAll: 0, //销售数量
- amount: 0
- }
- for (let item of this.form.orderItemsList) {
- this.amountNumber.saleAll += Number(item.storageInQuantity)
- this.amountNumber.cost += Number(item.storageInQuantity) * Number(item.purchasePrice)
- this.amountNumber.delivery += Number(item.actualQuantity)
- this.amountNumber.deliveryAll += Number(item.actualQuantity)
- this.amountNumber.amount += Number(item.amount)
- this.amountNumber.grossProfit += Number(item.amount) - (item.purchasePrice ? Number(item
- .storageInQuantity) * Number(item.purchasePrice) : 0)
- }
- this.form.orderAmount = this.amountNumber.amount
- setTimeout(function() {
- uni.hideLoading();
- }, 500);
- })
- },
- //确认收款
- confirmReceipt() {
- let this_ = this
- let form = {
- ...this_.form,
- }
- if (form.orderFilesList.length > 0) {
- form.orderFilesList.forEach(item => delete item.status)
- }
- // if (!form.currentAmount) {
- // return uni.showToast({
- // icon: "none",
- // title: '本次收款金额不能为空',
- // mask: true,
- // duration: 2000
- // });
- // }
- // 判断本次收款和会员卡收款不能为空
- if (!this.form.currentAmount || this.form.currentAmount == 0) {
- if (!this.form.memberAmout || this.form.memberAmout == 0) {
- return uni.showToast({
- icon: "none",
- title: '本次收款金额或会员卡金额不能为空或零',
- mask: true
- });
- }
- }
- if (!form.account) {
- return uni.showToast({
- icon: "none",
- title: '未选择收款账户',
- mask: true,
- duration: 2000
- });
- }
- form.currentAmount = form.currentAmount ? form.currentAmount : 0
- uni.showModal({
- title: '收款:',
- content: '现金收款:' + form.currentAmount + '元\n会员卡收款:' + form.memberAmout + '元',
- success: function(rest) {
- if (rest.confirm == true) {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- collectPayment(form).then(res => {
- uni.showToast({
- icon: "none",
- title: '收款成功',
- mask: true,
- duration: 2000
- });
- setTimeout(function() {
- uni.hideLoading();
- this_.refresh(res.data.id)
- }, 1000);
- })
- }
- }
- })
- },
- //保存附件
- saveAttachment() {
- let form = {
- pid: this.form.id,
- }
- if (form.orderFilesList.length > 0) {
- form.orderFilesList.forEach(item => delete item.status)
- }
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- saveAtta(form).then(res => {
- uni.showToast({
- icon: "none",
- title: '保存成功',
- mask: true
- });
- let _this = this
- setTimeout(function() {
- uni.hideLoading();
- _this.refresh(res.data.id)
- }, 1000);
- })
- },
- orderGenerateTask() {
- isProcurement({
- param: "whether.financing"
- }).then(res => {
- if (res.data == 1) {
- if (!this.form.storageId) {
- return this.$refs.uToast.show({
- top: this.revenueTop,
- type: 'warning',
- message: '请选择发货仓库!'
- })
- } else {
- this.whetherExistenceFinancingFun(this.form)
- }
- } else {
- this.orderGenerateShipTaskfun()
- }
- })
- },
- orderGenerateShipTaskfun() {
- uni.showModal({
- title: '提示',
- content: '是否确认生成任务',
- success: (rest) => {
- if (rest.confirm == true) {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- submitApp({
- bsType: "XS",
- ...this.form
- }).then(() => {
- orderGenerateShipTask({
- bsType: "XS",
- ...this.form
- }).then(res => {
- uni.showToast({
- icon: "none",
- title: '生成任务成功',
- mask: true
- });
- uni.hideLoading();
- this.refresh(res.data.id)
- })
- })
- }
- }
- })
- },
- whetherExistenceFinancingFun(form) {
- whetherExistenceFinancing({
- bsType: "XS",
- ...form
- }).then(res => {
- if (res.data == true) {
- this.orderGenerateShipTaskfun()
- } else {
- uni.showModal({
- title: '提示',
- content: res.data,
- success: (rest) => {
- if (rest.confirm == true) {
- checkOrderRW({
- bsType: "XS",
- ...form,
- url: '/tirePartsMall/salesManagement/saleOrder/index',
- pageStatus: "this.$store.getters.ltxsStatus",
- pageLabel: "销售订单(L)",
- }).then(res => {
- uni.showToast({
- icon: "none",
- title: '生成任务成功',
- mask: true
- });
- this.refresh(res.data.id)
- })
- }
- }
- })
- }
- })
- }, // 生成任务接口
- revokeCheckOrderRWfun() {
- uni.showModal({
- title: '提示',
- content: '是否撤销出库任务审批',
- success: (rest) => {
- if (rest.confirm == true) {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- revokeCheckOrderRW({
- ...this.form
- }).then(res => {
- uni.showToast({
- icon: "none",
- title: '撤销任务成功',
- mask: true
- });
- uni.hideLoading();
- this.refresh(res.data.id)
- })
- }
- }
- })
- },
- // 撤销任务
- orderRevokeGenerateShipTaskfun() {
- uni.showModal({
- title: '提示',
- content: '是否确认生成任务',
- success: (rest) => {
- if (rest.confirm == true) {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- submitApp({
- bsType: "XS",
- ...this.form
- }).then(() => {
- orderRevokeGenerateShipTask({
- bsType: "XS",
- ...this.form
- }).then(res => {
- uni.showToast({
- icon: "none",
- title: '撤销任务成功',
- mask: true
- });
- uni.hideLoading();
- this.refresh(res.data.id)
- })
- })
- }
- }
- })
- },
- //保存
- conserve() {
- // if (!this.form.shipType) {
- // return this.$refs.uNotify.show({
- // top: this.revenueTop,
- // type: 'warning',
- // message: '请选择配送方式!'
- // })
- // }
- // if (!this.form.logisticsCorpId) {
- // return this.$refs.uNotify.show({
- // top: this.revenueTop,
- // type: 'warning',
- // message: '请选择物流公司!'
- // })
- // }
- // if (!this.form.expressNo) {
- // return this.$refs.uNotify.show({
- // top: this.revenueTop,
- // type: 'warning',
- // message: '请输入物流单号!'
- // })
- // }
- let form = {
- ...this.form,
- }
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- submitApp(form).then(res => {
- uni.showToast({
- icon: "none",
- title: '保存成功',
- mask: true
- });
- let _this = this
- setTimeout(function() {
- uni.hideLoading();
- _this.refresh(res.data.id)
- }, 1000);
- })
- },
- //客户选择返回触发
- otherFun(customer) {
- this.form.customerName = customer.cname
- this.form.customerId = customer.id
- this.form.salerId = customer.salesmanId
- this.form.salerName = ''
- this.salesmanData.map(item => {
- if (item.id == this.form.salerId) {
- this.form.salerName = item.name
- }
- })
- this.form.storageName = ''
- this.form.storageId = customer.deliveryWarehouseId
- this.warehouseData.map(item => {
- if (item.id == this.form.storageId) {
- this.form.storageName = item.cname
- }
- })
- this.corpsAddrCorpIdByAddrfun('KH')
- // corpsDescDetail({id:customer.id}).then(res=>{
- // this.form.contacts = res.data.corpsAddrList[0].contacts
- // this.form.recAddress = res.data.corpsAddrList[0].belongtoarea + res.data.corpsAddrList[0].detailedAddress
- // this.form.phone = res.data.corpsAddrList[0].tel
- // })
- },
- selectProduct() {
- if (this.form.confirmStatus == 0) {
- this.$u.route('/pages/views/salesSlip/selectProduct', this.form);
- }
- },
- // 产品跳转
- chanpintiao() {
- if (!this.form.customerId) return this.$refs.uToast.show({
- top: this.revenueTop,
- type: 'warning',
- message: '请选择客户!'
- })
- if (this.form.storageId) {
- this.$u.route('/pages/views/salesSlip/selectProduct', {
- form: JSON.stringify(this.form),
- data: JSON.stringify(this.form.orderItemsList),
- corpId: this.form.corpId
- });
- } else {
- this.$refs.uToast.show({
- top: this.revenueTop,
- type: 'warning',
- message: '请选择发货仓库!'
- })
- }
- },
- //商品选择返回
- getProduct(dataList) {
- for (let item of dataList) {
- this.form.orderItemsList.push({
- goodsId: item.id,
- price: item.price,
- goodsName: item.cname,
- goodsNum: item.goodsNum,
- brandName: item.brandName,
- brandId: item.brandId,
- goodsNo: item.code,
- propertyName: item.specificationAndModel,
- inventory: item.inventory,
- pattern: item.brandItem,
- goodsDescription: item.goodsDescription,
- dot: item.dot,
- whether: item.whether,
- units: item.unit,
- // 小计
- subTotalMoney: item.goodsNum * item.price,
- // 备注
- remarks: item.remarks,
- // 批次号的状态
- dotedittype: false,
- // 价格数量
- goodsNumtype: false,
- // 价格
- pricetype: false,
- })
- }
- console.log(this.form.orderItemsList, 963);
- },
- selectCustomer() {
- // if (this.form.status != '录入') return
- if (this.form.generateTask != '未生成') return
- this.$u.route('/pages/views/salesSlip/selectCustomer', {
- corpType: 'KH'
- });
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- ::v-deep .u-cell__body {
- padding: 20rpx 10rpx;
- }
- .choice {
- position: fixed;
- right: 10rpx;
- border-radius: 10rpx;
- padding: 0 10rpx 10rpx 10rpx;
- background-color: #fff;
- // #ifdef H5
- top: calc(var(--status-bar-height) + 44px + 20rpx);
- // #endif
- // #ifdef APP-PLUS
- top: 30rpx,
- // #endif
- }
- .mask {
- width: 100%;
- height: 100%;
- position: fixed;
- top: 0;
- bottom: 0;
- background-color: rgba(1, 1, 1, 0.3);
- }
- .orderItemsDelent {
- position: absolute;
- top: 15rpx;
- right: 15rpx;
- color: #fd4b09;
- }
- </style>
|