acquisitionInformation.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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. this.status = options.status
  60. this.sgId = options.id
  61. },
  62. // #ifndef MP
  63. onNavigationBarButtonTap(e) {
  64. const index = e.index;
  65. if (index === 0) {
  66. this.navTo('/pages/set/set');
  67. } else if (index === 1) {
  68. // #ifdef APP-PLUS
  69. const pages = getCurrentPages();
  70. const page = pages[pages.length - 1];
  71. const currentWebview = page.$getAppWebview();
  72. currentWebview.hideTitleNViewButtonRedDot({
  73. index
  74. });
  75. // #endif
  76. uni.navigateTo({
  77. url: '/pages/notice/notice'
  78. })
  79. }
  80. },
  81. // #endif
  82. computed: {
  83. ...mapState(['hasLogin', 'userInfo']),
  84. },
  85. onShow() {
  86. uni.showLoading({
  87. title: "加载中...",
  88. mask: true
  89. })
  90. this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
  91. console.log("checkSession", res)
  92. if (res.data.data == "INVALID") {
  93. this.isShowAlert = true;
  94. // uni.showModal({
  95. // title: '登录提示',
  96. // content: '当前登入信息验证失败,是否重新登录?',
  97. // showCancel: true,
  98. // confirmText: '登录',
  99. // success: (e) => {
  100. // if (e.confirm) {
  101. // uni.navigateTo({
  102. // url: '/pages/public/login'
  103. // })
  104. // }
  105. // },
  106. // fail: () => {},
  107. // complete: () => {}
  108. // })
  109. }
  110. this.init()
  111. })
  112. console.log("hasLogin", this.hasLogin)
  113. },
  114. methods: {
  115. init() {
  116. let _obj = {
  117. commonId: this.sgId
  118. }
  119. this.$api.doRequest('get', '/acquisitionInfo/getInfo', _obj).then(res => {
  120. if (res.data.code == 200) {
  121. if (res.data.data) {
  122. this.isEdit = true
  123. this.value = res.data.data.checkFlag == '0' ? false : true
  124. this.warehouseName = res.data.data.warehouseName
  125. this.textareaValue = res.data.data.acquisitionInformation
  126. this.id = res.data.data.id
  127. } else {
  128. this.isEdit = false
  129. this.value = false
  130. }
  131. }
  132. })
  133. switch (this.status) {
  134. case '已隐藏':
  135. break;
  136. case '显示中':
  137. break;
  138. }
  139. this.$api.doRequest('get', '/warehouseBaseInfo/selectWarehouseSelfApp', {
  140. compId: uni.getStorageSync('pcUserInfo').compId,
  141. }).then(res => {
  142. if (res.data.data.length != 0) {
  143. uni.hideLoading()
  144. // let _showData = uni.getStorageSync("erpSelectWarehous")
  145. // let _showCWData = uni.getStorageSync("erpSelectWarehousCW")
  146. this.warehouseList = res.data.data
  147. let _storangewarehouseName = uni.getStorageSync("depotAcquisition_warehouseName")
  148. if (_storangewarehouseName) {
  149. this.warehouseName = _storangewarehouseName
  150. } else {
  151. this.warehouseName = res.data.data[0].warehouseName
  152. }
  153. } else {
  154. this.warehouseList = []
  155. this.warehouseName = '暂无仓库'
  156. }
  157. })
  158. },
  159. warehousechange(e) {
  160. this.warehouseName = this.warehouseList[e[0]].warehouseName
  161. this.warehouseId = this.warehouseList[e[0]].id
  162. uni.setStorageSync("depotAcquisition_warehouseName", this.warehouseName)
  163. },
  164. /**
  165. * 统一跳转接口,拦截未登录路由
  166. * navigator标签现在默认没有转场动画,所以用view
  167. */
  168. navTo(url) {
  169. if (!this.hasLogin) {
  170. url = '/pages/public/login';
  171. }
  172. uni.navigateTo({
  173. url
  174. })
  175. },
  176. alertBtn() {
  177. uni.navigateTo({
  178. url: '/pages/public/login'
  179. })
  180. },
  181. alertBtn1() {
  182. uni.showLoading({
  183. title: "加载中...",
  184. mask: true
  185. })
  186. let _flag = ''
  187. if (this.value) {
  188. _flag = 1
  189. } else {
  190. _flag = 0
  191. }
  192. let _obj = {
  193. warehouseName: this.warehouseName,
  194. acquisitionInformation: this.textareaValue,
  195. checkFlag: _flag,
  196. followFlag: "0",
  197. commonId:uni.getStorageSync("userInfo").id
  198. }
  199. if (this.isEdit) {
  200. _obj.id = this.id
  201. }
  202. this.$api.doRequest('post', '/acquisitionInfo/api/addAcquisition', _obj).then(res => {
  203. if (res.data.code == 200) {
  204. uni.hideLoading()
  205. this.$api.msg('添加成功')
  206. uni.navigateBack()
  207. }
  208. })
  209. },
  210. cancelClick() {
  211. this.isShowAlert = false
  212. },
  213. checkBoxChange(e) {
  214. console.log("e-----", e)
  215. this.value = !this.value
  216. console.log("value----", this.value)
  217. },
  218. submit() {
  219. this.isShowAlert1 = true
  220. // this.$api.msg('提交成功')
  221. // this.$api.msg('提交失败')
  222. }
  223. }
  224. }
  225. </script>
  226. <style lang='scss' scoped>
  227. page {
  228. background: #F5F6FA;
  229. }
  230. .wrap {
  231. background: #fff;
  232. margin: 10px;
  233. border-radius: 10px;
  234. padding: 10px;
  235. }
  236. .row {
  237. display: flex;
  238. justify-content: space-between;
  239. position: relative;
  240. /* border-bottom: 1px solid #EEEEEE; */
  241. input {
  242. font-size: 28rpx;
  243. // color: #333333;
  244. }
  245. .right {
  246. display: flex;
  247. align-items: center;
  248. }
  249. }
  250. .textarea {
  251. background: #F9F9FA;
  252. font-size: 12px;
  253. text-align: left;
  254. width: 100%;
  255. height: 60px;
  256. padding: 10px;
  257. border-radius: 5px;
  258. margin-top: 10px;
  259. height: 50vh;
  260. padding-bottom: 20rpx;
  261. }
  262. .textarea-bottom {
  263. position: absolute;
  264. bottom: 20rpx;
  265. right: 20rpx;
  266. color: #606266;
  267. }
  268. .submit {
  269. /* width: 90%; */
  270. background: #22C572;
  271. border-radius: 10rpx;
  272. }
  273. .bottom-btn {
  274. position: fixed;
  275. bottom: 30rpx;
  276. width: 90%;
  277. }
  278. </style>