acquisitionInformation.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. <template>
  2. <view class="wrap">
  3. <view class='content1'>
  4. <view class='row content-item'>
  5. <view class="left" @click='show1=true'>
  6. <view>{{warehouseName}}</view>
  7. <u-icon name="arrow-right" color=""></u-icon>
  8. <u-picker @confirm="warehousechange" range-key='warehouseName' mode="selector" v-model="show1" :range="warehouseList"></u-picker>
  9. </view>
  10. </view>
  11. <view class="content-item">
  12. <view class="left">收购信息</view>
  13. <view class='row textarea'>
  14. <textarea placeholder-style="color:#AFB3BF;" placeholder="输入收购信息,不超过2000个字" maxlength="2000" v-model="textareaValue"></textarea>
  15. <view class="textarea-left">
  16. <view class="clear" @click="clear()">清除全部</view>
  17. </view>
  18. <view class="textarea-bottom">{{textareaValue?textareaValue.length:'0'}}/2000字</view>
  19. </view>
  20. <view class='row row_css'>
  21. 显示在易粮易运收购信息中
  22. <!-- <u-checkbox activeColor="#19be6b" v-model="value" @change="checkBoxChange">显示在易粮易运收购信息中</u-checkbox> -->
  23. <view class="right">
  24. <u-switch v-model="value" active-color="#19be6b" inactive-color="#eee" size='40' @change="checkBoxChange"></u-switch>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="bottom-btn">
  30. <u-button type="primary" class="submit" hover-class="none" @click="submit()">提交</u-button>
  31. </view>
  32. <u-toast ref="uToast" />
  33. <u-modal v-model="isShowAlert" :title-style="{fontSize: '18px',fontWeight:'500'}"
  34. :content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='提示'
  35. showCancelButton='false' :content="content" @confirm="alertBtn" @cancel="cancelClick"></u-modal>
  36. <u-modal v-model="isShowAlert1" :title-style="{fontSize: '18px',fontWeight:'500'}"
  37. :content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='收购信息'
  38. showCancelButton='false' :content="content1" @confirm="alertBtn1" @cancel="cancelClick"></u-modal>
  39. </view>
  40. </template>
  41. <script>
  42. import {
  43. mapState
  44. } from 'vuex';
  45. export default {
  46. components: {
  47. },
  48. data() {
  49. return {
  50. isSHowBtn: true,
  51. isShowAlert: false,
  52. isShowAlert1: false,
  53. content: '当前登入信息验证失败,是否重新登录?',
  54. content1: '确定提交收购信息?',
  55. textareaValue: '',
  56. value: false,
  57. warehouseName: '暂无仓库',
  58. warehouseList: [],
  59. show1: false,
  60. isEdit: false,
  61. sgId: '',
  62. id: ''
  63. }
  64. },
  65. onLoad(options) {
  66. },
  67. // #ifndef MP
  68. onNavigationBarButtonTap(e) {
  69. const index = e.index;
  70. if (index === 0) {
  71. this.navTo('/pages/set/set');
  72. } else if (index === 1) {
  73. // #ifdef APP-PLUS
  74. const pages = getCurrentPages();
  75. const page = pages[pages.length - 1];
  76. const currentWebview = page.$getAppWebview();
  77. currentWebview.hideTitleNViewButtonRedDot({
  78. index
  79. });
  80. // #endif
  81. uni.navigateTo({
  82. url: '/pages/notice/notice'
  83. })
  84. }
  85. },
  86. // #endif
  87. computed: {
  88. ...mapState(['hasLogin', 'userInfo']),
  89. },
  90. onShow() {
  91. this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
  92. console.log("checkSession", res)
  93. if (res.data.data == "INVALID") {
  94. this.isShowAlert = true;
  95. // uni.showModal({
  96. // title: '提示',
  97. // content: '当前登入信息验证失败,是否重新登录?',
  98. // showCancel: true,
  99. // confirmText: '登录',
  100. // success: (e) => {
  101. // if (e.confirm) {
  102. // uni.navigateTo({
  103. // url: '/pages/public/login'
  104. // })
  105. // }
  106. // },
  107. // fail: () => {},
  108. // complete: () => {}
  109. // })
  110. }
  111. this.init()
  112. })
  113. console.log("hasLogin", this.hasLogin)
  114. },
  115. methods: {
  116. init() {
  117. var that = this
  118. this.$api.doRequest('get', '/warehouseBaseInfo/selectWarehouseSelfApp', {
  119. compId: uni.getStorageSync('pcUserInfo').compId,
  120. }).then(res => {
  121. if (res.data.data.length > 0) {
  122. uni.hideLoading()
  123. // let _showData = uni.getStorageSync("erpSelectWarehous")
  124. // let _showCWData = uni.getStorageSync("erpSelectWarehousCW")
  125. this.warehouseList = res.data.data
  126. let _storangewarehouseName = uni.getStorageSync("depotAcquisition_warehouseName")
  127. if (_storangewarehouseName) {
  128. this.warehouseName = _storangewarehouseName
  129. } else {
  130. this.warehouseName = res.data.data[0].warehouseName
  131. uni.setStorageSync("depotAcquisition_warehouseName", this.warehouseName)
  132. }
  133. that.$api.doRequest('get', '/acquisitionInfo/getInfo', {
  134. commonId: uni.getStorageSync("userInfo").id,
  135. warehouseName:uni.getStorageSync("depotAcquisition_warehouseName")
  136. }).then(res1 => {
  137. if (res1.data.code == 200) {
  138. if (res1.data.data) {
  139. that.isEdit = true
  140. that.value = res1.data.data.checkFlag == '0' ? false : true
  141. console.log(that.value)
  142. that.warehouseName = res1.data.data.warehouseName
  143. that.textareaValue = res1.data.data.acquisitionInformation
  144. that.id = res1.data.data.id
  145. } else {
  146. that.textareaValue = ''
  147. that.isEdit = false
  148. that.value = false
  149. }
  150. }
  151. })
  152. } else {
  153. this.warehouseList = []
  154. this.warehouseName = '暂无仓库'
  155. }
  156. })
  157. // switch (this.status) {
  158. // case '已隐藏':
  159. // break;
  160. // case '显示中':
  161. // break;
  162. // }
  163. },
  164. warehousechange(e) {
  165. this.warehouseName = this.warehouseList[e[0]].warehouseName
  166. this.warehouseId = this.warehouseList[e[0]].id
  167. uni.setStorageSync("depotAcquisition_warehouseName", this.warehouseName)
  168. this.init()
  169. },
  170. /**
  171. * 统一跳转接口,拦截未登录路由
  172. * navigator标签现在默认没有转场动画,所以用view
  173. */
  174. navTo(url) {
  175. if (!this.hasLogin) {
  176. url = '/pages/public/login';
  177. }
  178. uni.navigateTo({
  179. url
  180. })
  181. },
  182. alertBtn() {
  183. uni.navigateTo({
  184. url: '/pages/public/login'
  185. })
  186. },
  187. alertBtn1() {
  188. uni.showLoading({
  189. title: "加载中...",
  190. mask: true
  191. })
  192. let _flag = ''
  193. console.log(this.value)
  194. if (this.value) {
  195. _flag = 1
  196. } else {
  197. _flag = 0
  198. }
  199. if(!this.textareaValue&&_flag==1){
  200. this.$api.msg('收购信息不能为空!')
  201. return
  202. }
  203. let _obj = {
  204. warehouseName: this.warehouseName,
  205. acquisitionInformation: this.textareaValue,
  206. checkFlag: _flag,
  207. followFlag: "0",
  208. commonId:uni.getStorageSync("userInfo").id
  209. }
  210. if (this.isEdit) {
  211. _obj.id = this.id
  212. }
  213. this.$api.doRequest('post', '/acquisitionInfo/api/addAcquisition', _obj).then(res => {
  214. if (res.data.code == 200) {
  215. uni.hideLoading()
  216. this.$api.msg('添加成功')
  217. uni.navigateBack()
  218. }
  219. })
  220. },
  221. cancelClick() {
  222. this.isShowAlert = false
  223. },
  224. checkBoxChange(e) {
  225. this.value = e
  226. // this.alertBtn1()
  227. // console.log("value----", this.value)
  228. },
  229. submit() {
  230. this.isShowAlert1 = true
  231. // this.$api.msg('提交成功')
  232. // this.$api.msg('提交失败')
  233. },
  234. clear(){
  235. this.textareaValue=''
  236. }
  237. }
  238. }
  239. </script>
  240. <style lang='scss' scoped>
  241. page {
  242. background: #F5F6FA;
  243. }
  244. .wrap {
  245. /* background: #fff; */
  246. margin: 10px;
  247. border-radius: 10px;
  248. /* padding: 10px; */
  249. height: calc(100vh - 55px);
  250. }
  251. .content-item{
  252. /* height: 104rpx; */
  253. border-radius: 14rpx;
  254. background: #fff;
  255. padding: 40rpx 30rpx;
  256. margin-bottom: 20rpx;
  257. }
  258. .left{
  259. align-items: center;
  260. color: #333333;
  261. font-size: 34rpx;
  262. font-weight: 600;
  263. }
  264. .row {
  265. display: flex;
  266. justify-content: space-between;
  267. position: relative;
  268. /* border-bottom: 1px solid #EEEEEE; */
  269. input {
  270. font-size: 28rpx;
  271. // color: #333333;
  272. }
  273. .left {
  274. display: flex;
  275. align-items: center;
  276. color: #333333;
  277. font-size: 34rpx;
  278. font-weight: 600;
  279. }
  280. }
  281. .row_css{
  282. font-size: 26rpx;
  283. color: #333333;
  284. margin-top: 60rpx;
  285. font-weight: 500;
  286. }
  287. .textarea {
  288. background: #F9F9FA;
  289. font-size: 28rpx;
  290. text-align: left;
  291. width: 100%;
  292. padding: 30rpx 30rpx;
  293. border-radius: 5px;
  294. margin-top: 30rpx;
  295. height: 46vh;
  296. padding-bottom: 20rpx;
  297. color: #333 ;
  298. }
  299. .textarea textarea{
  300. height: 90%;
  301. }
  302. .textarea-left{
  303. position: absolute;
  304. bottom: 12rpx;
  305. left: 20rpx;
  306. color: #606266;
  307. }
  308. .textarea-bottom {
  309. position: absolute;
  310. bottom: 20rpx;
  311. right: 20rpx;
  312. color: #AFB3BF;
  313. }
  314. .submit {
  315. /* width: 90%; */
  316. background: #22C572;
  317. border-radius: 50rpx;
  318. }
  319. .clear {
  320. /* width: 90%; */
  321. background: #ffffff;
  322. color: #22C572;
  323. border:1px solid #22C572;
  324. border-radius: 50rpx;
  325. font-size: 28rpx;
  326. padding: 9rpx 24rpx;
  327. }
  328. .bottom-btn {
  329. position: fixed;
  330. bottom: 30rpx;
  331. width: 90%;
  332. }
  333. </style>