123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798 |
- <template>
- <!-- 调拨钢瓶 -->
- <view>
- <u-navbar title="钢瓶调拨" autoBack placeholder></u-navbar>
- <view class="card_transfer">
- <!-- <view style="display: flex;align-items: center;" @click="allotSweep" v-if="allotFlag">
- <view class="tran_title">扫描调拨码</view>
- <u-icon name="scan" size="30"></u-icon>
- </view> -->
- <view style="display: flex; align-items: center;">
- <u-button style="margin-right: 30rpx;" color="#19be6b" type="success" text="选择接收人信息"
- @click="selectiveFlow"></u-button>
- <u-button type="success" color="#19be6b" text="扫描调拨码" icon="scan" @click="allotSweep"></u-button>
- </view>
- <!-- <view class="card_assigner_aaf" @click="selectDispatcher"> -->
- <view class="card_assigner_aaf" :class="haveSelected ? 'greyMaskCard' : ''" v-if="assignerFlag">
- <view class="step_title">流转步骤</view>
- <view class="flow_step_title">{{ userList.flowName || '调拨流转步骤信息' }}</view>
- <view class="step_title">接收人信息</view>
- <view class="card_avatar" style="margin-top: 10rpx;">
- <view style="display: flex;align-items: center;">
- <image class="mine_image" src="../../static/portrait.png" mode=""></image>
- <view class="card_user_title">
- <view class="mine_phone">{{userList.name || '接收人姓名'}}</view>
- <view class="mine_phone">{{userList.shopName || '接收人所属门店'}}</view>
- </view>
- </view>
- </view>
- </view>
- <!-- <view class="white_card center_in">
- <u-icon name="plus" size="40" color="#5ac725"></u-icon>
- </view> -->
- <!-- </view> -->
- <view class="cylinder_ccsfs frame">
- <view style="display: flex;align-items: center;justify-content: flex-end;margin-bottom: 10rpx;">
- <view class="blue_titleil">总数: {{totality}}</view>
- <view class="green_title">已选: {{checkedList.length}}</view>
- </view>
- <view class="space_between">
- <view class="tran_title">单位内编号</view>
- <view style="display: flex;flex-direction: column;">
- <view style="display: flex;align-items: center;">
- <view class="blue_titleil" @click="checkAll">全选</view>
- <view class="blue_titleilred" @click="Inverse">反选</view>
- <view class="card_right_num">
- <span class="blue_title">选择前</span>
- <view class="num_card">
- <u--input class="input_taaf" v-model="codeValue" type="number" fontSize="12"
- inputAlign="center" border="surround" @blur="howMany"></u--input>
- </view>
- <span class="blue_title">个</span>
- </view>
- </view>
- </view>
- </view>
- <view style="margin: 10px 0px 0px 0px;">
- <u-search v-model="cylinderNumber" shape="square" :showAction="false" placeholder="请输入单位内编码"
- borderColor="#e4e7ed" bgColor="#fff" @change="quickSearch"></u-search>
- </view>
- </view>
- <view style="width: 100%;" v-if="list.length > 0">
- <u-checkbox-group v-model="checkedList" @change="checkboxChange">
- <view style="width: 100%;display: flex;flex-direction: column;">
- <view class="card_dinay frame" v-for="(item,index) in list" :key="index">
- <u-checkbox :name="item.inner_code" :checked="item.checked"></u-checkbox>
- <view style="display: flex;align-items: center;margin-left: 20rpx;">
- <view class="item_current">{{index + 1}}</view>
- <view class="item_title1">{{item.inner_code}}</view>
- </view>
- </view>
- </view>
- </u-checkbox-group>
- </view>
- <view style="margin-top: 20%;" v-else>
- <u-empty mode="list" text="暂无钢瓶"></u-empty>
- </view>
- </view>
- <view style="width: 100%;height: 120rpx;"></view>
- <view class="card_btn">
- <u-button style="margin-bottom: 20rpx;" type="primary" @click="submit">提交</u-button>
- </view>
- <u-popup :show="assignerShow" mode="center" round="8" closeable @close="close">
- <view style="margin-top: 60rpx;padding: 30rpx;width: 400rpx;">
- <u-button type="primary" text="选择接收人信息" @click="selectiveFlow1"></u-button>
- <u-button type="primary" text="扫描调拨码" icon="scan" style="margin-top: 20rpx;"
- @click="allotSweep"></u-button>
- </view>
- </u-popup>
- <u-popup :show="flowStepShow" :closeOnClickOverlay="false" mode="center" round="8" closeable @close="close">
- <view style="padding: 30rpx;width: 600rpx;">
- <view class="title_step">选择流转步骤<span>*</span></view>
- <view class="card_recipient frame_recip" @click="flowStepFocus">
- <span
- :style="{color:flowStepData.title ? '#000000' : '#c8c9cc'}">{{flowStepData.title || '选择流转步骤'}}</span>
- <u-icon name="arrow-down" size="18"></u-icon>
- </view>
- <view v-if="flowStepData.title">
- <view class="title_step">选择门店<span>*</span></view>
- <view class="card_recipient frame_recip" @click="shopFocus">
- <span :style="{color:shopData.title ? '#000000' : '#c8c9cc'}">{{'选择门店'}}</span>
- <u-icon name="arrow-down" size="18"></u-icon>
- </view>
- </view>
- <view v-if="shopData.title">
- <view class="title_step">选择接收人<span>*</span></view>
- <view class="card_recipient frame_recip" @click="recipientFocus">
- <span :style="{color:recipientData.title ? '#000000' : '#c8c9cc'}">{{'选择接收人'}}</span>
- <u-icon name="arrow-down" size="18"></u-icon>
- </view>
- </view>
- <u-button type="primary" text="确定" style="margin-top: 30rpx;" @click="allotSweep"></u-button>
- <u-picker :show="show" :columns="columns" @confirm="confirm" @cancel="flowCancel"></u-picker>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- totality: 0,
- checkedList: [],
- list: [],
- current: null,
- assignerFlag: true,
- assignerData: [],
- flowStep: [{
- id: '13',
- title: '气站确认空瓶到达气站'
- }, {
- id: '016',
- title: '气站确认重瓶到达气站'
- }, {
- id: '17',
- title: '司机确认重瓶从气站出库'
- }, {
- id: '11',
- title: '司机确认空瓶装车'
- }, {
- id: '033',
- title: '司机确认空瓶从门店出库'
- }, {
- id: '31',
- title: '门店确认重瓶卸货入库'
- }, {
- id: '35',
- title: '门店确认未配送重瓶返库'
- }, {
- id: '21',
- title: '门店回收空瓶'
- }, {
- id: '25',
- title: '送气员重瓶出库'
- }, {
- id: 'Unqualified',
- title: '回收不合格钢瓶'
- }],
- Pagination: {
- PageIndex: 1,
- PageSize: 20,
- Total: 0,
- },
- loadingMore: true,
- codeValue: '',
- allotFlag: true,
- cylinderNumber: '',
- assignerShow: false,
- flowStepShow: false,
- show: false,
- columns: [],
- userList: {
- name: '',
- userId: '',
- shopID: '',
- shopName: '',
- flowId: '',
- flowName: '',
- },
- // 1-扫码调拨 2-一键调拨
- allotType: 2,
- // 流转步骤
- flowStepData: {
- id: '',
- title: '',
- },
- // 门店
- shopData: {},
- // 接收人
- recipientData: {},
- }
- },
- watch: {
- list: {
- handler: function(newUser, oldUser) {
- if (newUser) {
- let arr = newUser
- for (let i = 0; i < arr.length; i++) {
- let flag = this.checkedList.includes(arr[i].inner_code);
- if (flag) {
- arr[i].checked = true
- }
- }
- this.list = arr
- }
- },
- deep: true
- }
- },
- computed: {
- // 定义计算属性totalPrice
- haveSelected: function() {
- let arr = false
- if (this.userList.userId) {
- arr = false
- } else {
- arr = true
- }
- return arr
- }
- },
- onShow() {
- const data = uni.getStorageSync('returnData');
- if (data) {
- const userArr = JSON.parse(data)
- this.userList = {
- ...userArr
- }
- console.log('携带的参数:', this.userList);
- uni.removeStorage({
- key: 'returnData'
- });
- }
- },
- onReachBottom() {
- if (!this.loadingMore) {
- this.getList()
- }
- },
- onLoad(value) {
- this.current = value.status
- if (value.allotFlag == 'false') {
- this.allotFlag = false
- } else {
- this.allotFlag = true
- }
- },
- mounted() {
- this.getList()
- },
- methods: {
- // 获取列表
- getList() {
- this.loadingMore = true
- this.$api.get('/api/gas-cylinder-status', {
- page: this.Pagination.PageIndex,
- pageSize: this.Pagination.PageSize,
- status: this.current,
- inner_code: this.cylinderNumber,
- }).then(res => {
- if (res.code == 200) {
- this.totality = res.data.count
- const data = res.data.list
- data.forEach(item => {
- if (!item.checked) {
- item.checked = false
- }
- })
- if (this.loadingMore == true && data) {
- this.list = this.list.concat(data);
- }
- if (data.length < this.Pagination.PageSize) {
- this.loadingMore = true
- } else {
- this.loadingMore = false
- this.Pagination.PageIndex++
- }
- }
- })
- },
- // 快捷搜索
- quickSearch(value) {
- const arrValue = this.$cache.getCache('checkedList')
- if (arrValue) {
- this.checkedList = this.$cache.getCache('checkedList')
- }
- this.list = []
- this.getList()
- },
- // 选择调拨人、调拨步骤
- selectDispatcher() {
- this.assignerShow = true
- },
- // 选择接收人信息
- selectiveFlow() {
- this.allotType = 2
- uni.navigateTo({
- url: '/pages/information/flowStep?current=' + this.current
- });
- },
- selectiveFlow1() {
- this.assignerShow = false
- this.flowStepShow = true
- },
- // 流转步骤
- flowStepFocus() {
- var userInfo = this.$cache.getCache('userInfo')
- this.show = true
- this.columns = []
- let arrData = []
- if (userInfo.provUser) {
- if (userInfo.provUser.isorders == 0 && userInfo.provUser.userType == 3) {
- // 送气员端
- if (this.current == '1') {
- arrData.push('门店确认未配送重瓶返库')
- } else if (this.current == '2') {
- arrData.push('门店回收空瓶')
- } else {
- arrData.push('门店回收不合格瓶')
- }
- } else if (userInfo.provUser.userType == 3) {
- // 门店端
- if (this.current == '1') {
- let arrmd = ['送气员领重瓶出库', '司机确认重瓶从门店出库']
- arrData = arrmd
- } else if (this.current == '2') {
- arrData.push('司机确认空瓶装车')
- } else {
- arrData.push('司机回收不合格瓶')
- }
- } else if (userInfo.provUser.userType == 4) {
- // 司机端
- if (this.current == '1') {
- let arrsj = ['门店确认重瓶卸货入库', '气站确认重瓶到达气站']
- arrData = arrsj
- } else if (this.current == '2') {
- arrData.push('气站确认空瓶到达气站')
- } else {
- let arrsjbhg = ['门店回收不合格瓶', '气站回收不合格瓶']
- arrData = arrsjbhg
- }
- } else if (userInfo.provUser.userType == 5) {
- // 气站端
- if (this.current == '1') {
- arrData.push('司机确定重瓶从气站出库')
- } else if (this.current == '2') {
- arrData.push('')
- } else {
- arrData.push('司机回收不合格瓶')
- }
- }
- } else {
- // 送气员端
- if (this.current == '1') {
- arrData.push('门店确认未配送重瓶返库')
- } else if (this.current == '2') {
- arrData.push('门店回收空瓶')
- } else {
- arrData.push('门店回收不合格瓶')
- }
- }
- this.columns.push(arrData)
- },
- // 确定流转步骤
- confirm(event) {
- if (event.value[0] == '门店确认未配送重瓶返库') {
- this.flowStepData.id = '35'
- this.flowStepData.title = event.value[0]
- } else if (event.value[0] == '门店回收空瓶') {
- this.flowStepData.id = '21'
- this.flowStepData.title = event.value[0]
- } else if (event.value[0] == '门店回收不合格瓶') {
- this.flowStepData.id = this.current
- this.flowStepData.title = event.value[0]
- } else if (event.value[0] == '送气员领重瓶出库') {
- this.flowStepData.id = '25'
- this.flowStepData.title = event.value[0]
- } else if (event.value[0] == '司机确认重瓶从门店出库') {
- this.flowStepData.id = '033'
- this.flowStepData.title = event.value[0]
- } else if (event.value[0] == '司机确认空瓶装车') {
- this.flowStepData.id = '11'
- this.flowStepData.title = event.value[0]
- } else if (event.value[0] == '司机回收不合格瓶') {
- this.flowStepData.id = this.current
- this.flowStepData.title = event.value[0]
- } else if (event.value[0] == '门店确认重瓶卸货入库') {
- this.flowStepData.id = '31'
- this.flowStepData.title = event.value[0]
- } else if (event.value[0] == '气站确认重瓶到达气站') {
- this.flowStepData.id = '016'
- this.flowStepData.title = event.value[0]
- } else if (event.value[0] == '气站确认空瓶到达气站') {
- this.flowStepData.id = '13'
- this.flowStepData.title = event.value[0]
- } else if (event.value[0] == '门店回收不合格瓶') {
- this.flowStepData.id = this.current
- this.flowStepData.title = event.value[0]
- } else if (event.value[0] == '气站回收不合格瓶') {
- this.flowStepData.id = this.current
- this.flowStepData.title = event.value[0]
- }
- this.show = false
- console.log(this.flowStepData, 25)
- },
- // 选择门店
- shopFocus() {
- uni.navigateTo({
- url: '/pages/information/flowStep'
- });
- },
- // 选择接收人
- recipientFocus() {
- uni.navigateTo({
- url: '/pages/information/storePersonnel'
- });
- },
- close() {
- this.assignerShow = false
- this.flowStepShow = false
- },
- // 关闭选择流转步骤
- flowCancel() {
- this.show = false
- },
- // 调拨提交
- submit() {
- if (this.allotFlag) {
- if (this.userList.userId) {
- if (this.checkedList.length > 0) {
- uni.showLoading({
- mask: true,
- });
- this.$api.post('/api/gas-cylinder-allot', {
- optType: this.userList.flowId,
- acceptUserId: Number(this.userList.userId),
- acceptCompanyId: Number(this.userList.shopID),
- innerCodeList: this.checkedList,
- gasCylinderStatus: this.current,
- allotType: this.allotType,
- }).then(res => {
- uni.hideLoading();
- if (res.code == 200) {
- this.loadingMore = true
- this.Pagination.PageIndex = 1
- this.list = []
- this.getList()
- this.checkedList = []
- uni.$u.toast(res.msg)
- this.$forceUpdate()
- setTimeout(() => {
- uni.redirectTo({
- url: '/pages/information/transferRecord'
- });
- }, 1500)
- } else {
- uni.$u.toast(res.data.msg)
- }
- }).catch(() => {
- uni.hideLoading();
- })
- } else {
- uni.$u.toast('请先选择调拨钢瓶')
- }
- } else {
- uni.$u.toast('请选择接收人')
- }
- } else {
- // 空瓶充装
- if (this.checkedList.length > 0) {
- // 操作记录、流转步骤接口
- const param = {
- chipUidList: this.checkedList,
- optType: '14',
- }
- uni.showLoading({
- mask: true,
- });
- this.$api.post('/api/operation-log', param).then(res => {
- if (res.code == 200) {
- this.Pagination.PageIndex = 1
- this.list = []
- this.getList()
- this.checkedList = []
- uni.$u.toast('操作成功')
- } else {
- uni.$u.toast(res.data.msg)
- }
- uni.hideLoading();
- }).catch(() => {
- uni.hideLoading();
- })
- } else {
- uni.$u.toast('请先选择调拨钢瓶')
- }
- }
- },
- // 扫一扫
- allotSweep() {
- this.allotType = 1
- // 允许从相机和相册扫码
- uni.scanCode({
- scanType: ['qrCode'],
- autoZoom: false,
- success: (res) => {
- console.log(res, '--------');
- if (res.result) {
- let url = res.result;
- function getCharactersBefore(str, char) {
- const index = str.indexOf(char);
- if (index > -1) {
- return str.substring(0, index);
- }
- return ''; // 如果字符不存在,返回空字符串
- }
- const title = getCharactersBefore(url, '?');
- if (title == 'dialCode') {
- this.assignerFlag = true
- function getCharactersBefore1(str, char) {
- const index = str.indexOf(char);
- if (index > -1) {
- return str.substring(index + 1);
- }
- return ''; // 如果字符不存在,返回空字符串
- }
- const arr = getCharactersBefore1(url, '?')
- this.assignerData = arr.split(',')
- this.userList.flowId = this.assignerData[0]
- this.userList.userId = this.assignerData[1]
- this.userList.name = this.assignerData[2]
- this.userList.shopID = this.assignerData[3]
- this.userList.shopName = this.assignerData[4]
- this.userList.flowName = this.assignerData[5]
- } else {
- uni.$u.toast('请扫描调拨码')
- }
- } else {
- console.log('请重新扫描');
- return false;
- }
- },
- fail: (res) => {
- console.log('未识别到二维码1');
- }
- })
- },
- // 流转步骤文字
- getflowStep(value) {
- let title = ''
- this.flowStep.forEach(item => {
- if (item.id == value[0]) {
- title = item.title
- }
- })
- return title
- },
- // 选择钢瓶编号
- checkboxChange(value) {
- for (let i = 0; i < this.list.length; i++) {
- let flag = value.includes(this.list[i].inner_code);
- if (flag) {
- this.list[i].checked = true
- } else {
- this.list[i].checked = false
- }
- }
- this.checkedList = this.checkedList.concat(value);
- this.$cache.setCache('checkedList', this.checkedList)
- },
- // 输入第几个
- howMany(value) {
- // this.checkedList = []
- this.list.forEach((item, index) => {
- if (index < value) {
- item.checked = true
- this.checkedList.push(item.inner_code)
- } else {
- item.checked = false
- }
- })
- this.$cache.setCache('checkedList', this.checkedList)
- },
- // 全选
- checkAll() {
- this.codeValue = ''
- this.checkedList = []
- for (let i = 0; i < this.list.length; i++) {
- this.$set(this.list[i], 'checked', true)
- }
- this.list.forEach(item => {
- if (item.checked) {
- this.checkedList.push(item.inner_code)
- }
- })
- this.$cache.setCache('checkedList', this.checkedList)
- },
- // 反选
- Inverse() {
- this.codeValue = ''
- this.checkedList = []
- for (let i = 0; i < this.list.length; i++) {
- let flag = this.list[i].checked;
- this.$set(this.list[i], 'checked', !flag)
- }
- this.list.forEach(item => {
- if (item.checked) {
- this.checkedList.push(item.inner_code)
- }
- })
- this.$cache.setCache('checkedList', this.checkedList)
- }
- }
- }
- </script>
- <style lang="scss">
- .card_transfer {
- padding: 0rpx 30rpx;
- }
- .card_avatar {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .mine_image {
- width: 100rpx;
- height: 100rpx;
- border-radius: 50%;
- }
- .card_user_title {
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- }
- .mine_phone {
- margin-left: 20rpx;
- font-size: 30rpx;
- }
- .card_assigner_aaf {
- position: relative;
- border: 1rpx dashed #d7d7d7;
- margin-top: 20rpx;
- padding: 20rpx;
- background-color: #f4f4f5;
- }
- .greyMaskCard {
- opacity: 0.5;
- }
- .white_card {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- font-size: 60rpx;
- }
- .step_title {
- font-size: 30rpx;
- font-weight: 600;
- }
- .flow_step_title {
- font-size: 28rpx;
- margin: 0rpx 0rpx 10rpx 0rpx;
- }
- .tran_title {
- padding-left: 10rpx;
- font-size: 32rpx;
- font-weight: 600;
- }
- .cylinder_ccsfs {
- margin-top: 30rpx;
- padding-bottom: 20rpx;
- // border-bottom: 1rpx solid #d7d7d7;
- }
- .blue_titleil {
- font-size: 30rpx;
- color: #2979ff;
- margin-right: 20rpx;
- }
- .blue_titleilred {
- font-size: 30rpx;
- color: #ff9900;
- margin-right: 20rpx;
- }
- .blue_title {
- font-size: 30rpx;
- color: #2979ff;
- }
- .green_title {
- font-size: 30rpx;
- color: #5ac725;
- }
- .card_right_num {
- margin-left: 30rpx;
- display: flex;
- align-items: center;
- }
- .num_card {
- margin: 0rpx 8rpx;
- width: 60rpx;
- }
- .input_taaf {
- padding: 0rpx !important;
- }
- .card_dinay {
- display: flex;
- align-items: center;
- width: calc(100% - 40rpx);
- // border-bottom: 1rpx solid #d7d7d7;
- padding: 30rpx 20rpx;
- }
- .item_current {
- width: 40rpx;
- color: #82848a;
- }
- .item_title1 {
- margin-left: 10rpx;
- }
- .card_btn {
- position: fixed;
- left: 0;
- right: 0;
- bottom: 0;
- padding-left: 30rpx;
- padding-right: 30rpx;
- padding-top: 20rpx;
- background-color: #fff;
- padding-bottom: constant(safe-area-inset-bottom); //兼容 IOS<11.2
- padding-bottom: env(safe-area-inset-bottom); //兼容 IOS>11.2
- }
- .title_step {
- margin: 15rpx 0px;
- font-size: 30rpx;
- span {
- color: red;
- }
- }
- .card_recipient {
- display: flex;
- padding: 6px 9px;
- border-radius: 4px;
- color: #c8c9cc;
- span {
- width: 100%;
- font-size: 30rpx;
- }
- }
- // 伪元素1rpx边框
- .frame_recip {
- position: relative; //重要
- }
- .frame_recip::after {
- position: absolute;
- content: '';
- border: 4rpx solid #e4e7ed;
- border-radius: 8rpx;
- width: 200%;
- height: 200%;
- top: 0;
- left: 0;
- transform: scale(0.5);
- transform-origin: 0 0;
- pointer-events: none;
- /* 使伪元素不会阻止鼠标事件 */
- }
- </style>
|