123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355 |
- <template>
- <view class="wrap">
- <view class='content1'>
- <view class='row content-item'>
- <view class="left" @click='show1=true'>
- <view>{{warehouseName}}</view>
- <u-icon name="arrow-right" color=""></u-icon>
- <u-picker @confirm="warehousechange" range-key='warehouseName' mode="selector" v-model="show1" :range="warehouseList"></u-picker>
- </view>
- </view>
- <view class="content-item">
- <view class="left">收购信息</view>
- <view class='row textarea'>
- <textarea placeholder-style="color:#AFB3BF;" placeholder="输入收购信息,不超过2000个字" maxlength="2000" v-model="textareaValue"></textarea>
- <view class="textarea-left">
- <view class="clear" @click="clear()">清除全部</view>
- </view>
- <view class="textarea-bottom">{{textareaValue?textareaValue.length:'0'}}/2000字</view>
- </view>
- <view class='row row_css'>
- 显示在易粮易运收购信息中
- <!-- <u-checkbox activeColor="#19be6b" v-model="value" @change="checkBoxChange">显示在易粮易运收购信息中</u-checkbox> -->
- <view class="right">
- <u-switch v-model="value" active-color="#19be6b" inactive-color="#eee" size='40' @change="checkBoxChange"></u-switch>
- </view>
- </view>
- </view>
-
- </view>
- <view class="bottom-btn">
- <u-button type="primary" class="submit" hover-class="none" @click="submit()">提交</u-button>
- </view>
- <u-toast ref="uToast" />
- <u-modal v-model="isShowAlert" :title-style="{fontSize: '18px',fontWeight:'500'}"
- :content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='提示'
- :showCancelButton='false' :content="content" @confirm="alertBtn" @cancel="cancelClick"></u-modal>
- <u-modal v-model="isShowAlert1" :title-style="{fontSize: '18px',fontWeight:'500'}"
- :content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='收购信息'
- :showCancelButton='false' :content="content1" @confirm="alertBtn1" @cancel="cancelClick"></u-modal>
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- export default {
- components: {
- },
- data() {
- return {
- isSHowBtn: true,
- isShowAlert: false,
- isShowAlert1: false,
- content: '当前登入信息验证失败,是否重新登录?',
- content1: '确定提交收购信息?',
- textareaValue: '',
- value: false,
- warehouseName: '暂无仓库',
- warehouseList: [],
- show1: false,
- isEdit: false,
- sgId: '',
- id: ''
- }
- },
- onLoad(options) {
- },
- // #ifndef MP
- onNavigationBarButtonTap(e) {
- const index = e.index;
- if (index === 0) {
- this.navTo('/pages/set/set');
- } else if (index === 1) {
- // #ifdef APP-PLUS
- const pages = getCurrentPages();
- const page = pages[pages.length - 1];
- const currentWebview = page.$getAppWebview();
- currentWebview.hideTitleNViewButtonRedDot({
- index
- });
- // #endif
- uni.navigateTo({
- url: '/pages/notice/notice'
- })
- }
- },
- // #endif
- computed: {
- ...mapState(['hasLogin', 'userInfo']),
- },
- onShow() {
-
- this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
- console.log("checkSession", res)
- if (res.data.data == "INVALID") {
- this.isShowAlert = true;
- // uni.showModal({
- // title: '提示',
- // content: '当前登入信息验证失败,是否重新登录?',
- // showCancel: true,
- // confirmText: '登录',
- // success: (e) => {
- // if (e.confirm) {
- // uni.navigateTo({
- // url: '/pages/public/login'
- // })
- // }
- // },
- // fail: () => {},
- // complete: () => {}
- // })
- }
- this.init()
- })
- console.log("hasLogin", this.hasLogin)
- },
- methods: {
- init() {
- var that = this
- this.$api.doRequest('get', '/warehouseBaseInfo/selectWarehouseSelfApp', {
- compId: uni.getStorageSync('pcUserInfo').compId,
- }).then(res => {
- if (res.data.data.length > 0) {
- uni.hideLoading()
- // let _showData = uni.getStorageSync("erpSelectWarehous")
- // let _showCWData = uni.getStorageSync("erpSelectWarehousCW")
- this.warehouseList = res.data.data
- let _storangewarehouseName = uni.getStorageSync("depotAcquisition_warehouseName")
- if (_storangewarehouseName) {
- this.warehouseName = _storangewarehouseName
- } else {
- this.warehouseName = res.data.data[0].warehouseName
- uni.setStorageSync("depotAcquisition_warehouseName", this.warehouseName)
- }
- that.$api.doRequest('get', '/acquisitionInfo/getInfo', {
- commonId: uni.getStorageSync("userInfo").id,
- warehouseName:uni.getStorageSync("depotAcquisition_warehouseName")
- }).then(res1 => {
- if (res1.data.code == 200) {
- if (res1.data.data) {
- that.isEdit = true
- that.value = res1.data.data.checkFlag == '0' ? false : true
- console.log(that.value)
- that.warehouseName = res1.data.data.warehouseName
- that.textareaValue = res1.data.data.acquisitionInformation
- that.id = res1.data.data.id
- } else {
- that.textareaValue = ''
- that.isEdit = false
- that.value = false
- }
- }
- })
- } else {
- this.warehouseList = []
- this.warehouseName = '暂无仓库'
- }
- })
- // switch (this.status) {
- // case '已隐藏':
- // break;
- // case '显示中':
- // break;
- // }
- },
- warehousechange(e) {
- this.warehouseName = this.warehouseList[e[0]].warehouseName
- this.warehouseId = this.warehouseList[e[0]].id
- uni.setStorageSync("depotAcquisition_warehouseName", this.warehouseName)
- this.init()
-
- },
- /**
- * 统一跳转接口,拦截未登录路由
- * navigator标签现在默认没有转场动画,所以用view
- */
- navTo(url) {
- if (!this.hasLogin) {
- url = '/pages/public/login';
- }
- uni.navigateTo({
- url
- })
- },
- alertBtn() {
- uni.navigateTo({
- url: '/pages/public/login'
- })
- },
- alertBtn1() {
- uni.showLoading({
- title: "加载中...",
- mask: true
- })
- let _flag = ''
- console.log(this.value)
- if (this.value) {
- _flag = 1
- } else {
- _flag = 0
- }
- if(!this.textareaValue&&_flag==1){
- this.$api.msg('收购信息不能为空!')
- return
- }
- let _obj = {
- warehouseName: this.warehouseName,
- acquisitionInformation: this.textareaValue,
- checkFlag: _flag,
- followFlag: "0",
- commonId:uni.getStorageSync("userInfo").id
- }
- if (this.isEdit) {
- _obj.id = this.id
- }
- this.$api.doRequest('post', '/acquisitionInfo/api/addAcquisition', _obj).then(res => {
- if (res.data.code == 200) {
- uni.hideLoading()
- this.$api.msg('添加成功')
- uni.navigateBack()
- }else{
- this.$api.msg('添加失败')
- this.isShowAlert = false
- }
- })
- },
- cancelClick() {
- this.isShowAlert = false
- },
- checkBoxChange(e) {
- this.value = e
- // this.alertBtn1()
- // console.log("value----", this.value)
- },
- submit() {
- this.isShowAlert1 = true
-
- // this.$api.msg('提交成功')
- // this.$api.msg('提交失败')
- },
- clear(){
- this.textareaValue=''
- }
- }
- }
- </script>
- <style lang='scss' scoped>
- page {
- background: #F5F6FA;
- }
- .wrap {
- /* background: #fff; */
- margin: 10px;
- border-radius: 10px;
- /* padding: 10px; */
- height: calc(100vh - 55px);
- }
-
- .content-item{
- /* height: 104rpx; */
- border-radius: 14rpx;
- background: #fff;
- padding: 40rpx 30rpx;
- margin-bottom: 20rpx;
- }
- .left{
- align-items: center;
- color: #333333;
- font-size: 34rpx;
- font-weight: 600;
- }
-
- .row {
- display: flex;
- justify-content: space-between;
- position: relative;
- /* border-bottom: 1px solid #EEEEEE; */
- input {
- font-size: 28rpx;
- // color: #333333;
- }
- .left {
- display: flex;
- align-items: center;
- color: #333333;
- font-size: 34rpx;
- font-weight: 600;
- }
- }
- .row_css{
- font-size: 26rpx;
- color: #333333;
- margin-top: 60rpx;
- font-weight: 500;
- }
- .textarea {
- background: #F9F9FA;
- font-size: 28rpx;
- text-align: left;
- width: 100%;
- padding: 30rpx 30rpx;
- border-radius: 5px;
- margin-top: 30rpx;
- height: 46vh;
- padding-bottom: 20rpx;
- color: #333 ;
- }
- .textarea textarea{
- height: 90%;
- }
- .textarea-left{
- position: absolute;
- bottom: 12rpx;
- left: 20rpx;
- color: #606266;
- }
- .textarea-bottom {
- position: absolute;
- bottom: 20rpx;
- right: 20rpx;
- color: #AFB3BF;
- }
- .submit {
- /* width: 90%; */
- background: #22C572;
- border-radius: 50rpx;
- }
- .clear {
- /* width: 90%; */
- background: #ffffff;
- color: #22C572;
- border:1px solid #22C572;
- border-radius: 50rpx;
- font-size: 28rpx;
- padding: 9rpx 24rpx;
- }
- .bottom-btn {
- position: fixed;
- bottom: 30rpx;
- width: 90%;
- }
- </style>
|