acquisitionInformation.vue 7.3 KB

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