acquisitionInformation.vue 8.0 KB

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