grainDeliveryRegistration.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <view class="wrap">
  3. <view class="content1">
  4. <view>{{dataList.warehouseName}}</view>
  5. <view class="row2">
  6. <view class='locationwrap'>
  7. <image class='location' src="../../../static/img/liangmai/icon_ditu@2x.png" mode=""></image>
  8. {{warehouseNameAddress}}
  9. </view>
  10. </view>
  11. <view class="row3">
  12. <view>{{startDate}}创建(有效期{{dataList.validityDate}})</view>
  13. </view>
  14. </view>
  15. <view class="content2">
  16. <view class="title">送货信息</view>
  17. <view class="wrap wrap1" v-for="(item,index) in dataList.shippingInformationList" :key='index'>
  18. <view class="row1">
  19. <view class="left">
  20. <view>货主{{index+1}}-{{item.shipperName}}</view>
  21. <view @click="reduceBtn(index)">--</view>
  22. </view>
  23. <view class="right" @click='show=true'>
  24. <view>{{shipperName}}</view>
  25. <u-icon name="arrow-right" color=""></u-icon>
  26. <u-picker @confirm="nameConfirm" range-key='name' mode="selector" v-model="show"
  27. :range="nameList"></u-picker>
  28. </view>
  29. </view>
  30. <view class="row2">
  31. <view class="left">
  32. 供应商(送粮人)
  33. </view>
  34. <view class="right">{{item.supplier}}</view>
  35. </view>
  36. <view class="row2" v-for="(item1,index1) in item.carNumberList" :key='index1'>
  37. <view class="left">
  38. 车牌号-{{index1+1}}
  39. </view>
  40. <u-input v-model="item1.carNo" placeholder="输入7为车牌号" />
  41. <view>
  42. <view @click="addCarNumber(item.carNumberList)">+</view>
  43. <view @click="delCarNumber(item.carNumberList,index1)">-</view>
  44. </view>
  45. </view>
  46. </view>
  47. <u-button @click='addGoodPeople'>增加货主</u-button>
  48. </view>
  49. <u-button @click='submit'>提交</u-button>
  50. <u-modal v-model="isShowAlert" :title-style="{fontSize: '18px',fontWeight:'500'}"
  51. :content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='登录提示'
  52. showCancelButton='false' :content="content" @confirm="alertBtn" @cancel="cancelClick"></u-modal>
  53. <u-modal v-model="isShowAlert1" :title-style="{fontSize: '18px',fontWeight:'500'}"
  54. :content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='登录提示'
  55. showCancelButton='false' :content="content1" @confirm="alertBtn" @cancel="cancelClick"></u-modal>
  56. </view>
  57. </template>
  58. <script>
  59. import {
  60. mapState
  61. } from 'vuex';
  62. export default {
  63. components: {
  64. },
  65. data() {
  66. return {
  67. isShowAlert: false,
  68. isShowAlert1: false,
  69. content: '当前登入信息验证失败,是否重新登录?',
  70. content1: '确定提交送粮信息?',
  71. show: false,
  72. show1: false,
  73. cargoOwner: [{
  74. name: '123'
  75. }],
  76. shipperName: "王五",
  77. nameList: [{
  78. name: '1'
  79. },
  80. {
  81. name: '2'
  82. }
  83. ],
  84. warehouseNameAddress: '辽宁省营口市龙港花园',
  85. startDate: "2021-11-20",
  86. dataList: {
  87. warehouseName: "鲅鱼圈1号库",
  88. validityDate: '2021-11-23',
  89. shippingInformationList: [{
  90. shipperName: '张三',
  91. supplier: '供应商姓名',
  92. carNo: '123456,123456,1234456',
  93. carNumberList: [{
  94. carNo: '123'
  95. }]
  96. }]
  97. }
  98. }
  99. },
  100. onLoad() {
  101. },
  102. // #ifndef MP
  103. onNavigationBarButtonTap(e) {
  104. const index = e.index;
  105. if (index === 0) {
  106. this.navTo('/pages/set/set');
  107. } else if (index === 1) {
  108. // #ifdef APP-PLUS
  109. const pages = getCurrentPages();
  110. const page = pages[pages.length - 1];
  111. const currentWebview = page.$getAppWebview();
  112. currentWebview.hideTitleNViewButtonRedDot({
  113. index
  114. });
  115. // #endif
  116. uni.navigateTo({
  117. url: '/pages/notice/notice'
  118. })
  119. }
  120. },
  121. // #endif
  122. computed: {
  123. ...mapState(['hasLogin', 'userInfo']),
  124. },
  125. onShow() {
  126. this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
  127. console.log("checkSession", res)
  128. if (res.data.data == "INVALID") {
  129. this.isShowAlert = true;
  130. }
  131. })
  132. console.log("hasLogin", this.hasLogin)
  133. },
  134. methods: {
  135. reduceBtn(index) {
  136. debugger
  137. if (this.dataList.shippingInformationList.length > 1) {
  138. this.dataList.shippingInformationList.splice(index, 1)
  139. this.$forceUpdate()
  140. }
  141. },
  142. submit() {
  143. this.isShowAlert1 = true
  144. },
  145. nameConfirm() {},
  146. /**
  147. * 统一跳转接口,拦截未登录路由
  148. * navigator标签现在默认没有转场动画,所以用view
  149. */
  150. navTo(url) {
  151. if (!this.hasLogin) {
  152. url = '/pages/public/login';
  153. }
  154. uni.navigateTo({
  155. url
  156. })
  157. },
  158. alertBtn() {
  159. this.$api.doRequest('post', '/grainDeliveryRegistration/api/insertInfo', this.submitData).then(res => {
  160. if (res.data.code == 200) {
  161. }
  162. })
  163. },
  164. cancelClick() {
  165. this.isShowAlert = false
  166. this.isShowAlert1 = false
  167. },
  168. addGoodPeople() {
  169. this.dataList.shippingInformationList.push({
  170. shipperName: '张三1',
  171. supplier: '供应商姓名1',
  172. carNo: '123456,123456,1234456',
  173. carNumberList: [{
  174. carNo: '222'
  175. }]
  176. })
  177. },
  178. addCarNumber(val) {
  179. val.push({
  180. carNo: '456'
  181. })
  182. },
  183. delCarNumber(val, index) {
  184. debugger
  185. if (val.length > 1) {
  186. val.splice(index, 1)
  187. this.$forceUpdate()
  188. }
  189. }
  190. }
  191. }
  192. </script>
  193. <style lang='scss' scoped>
  194. page {
  195. background: #F5F6FA;
  196. }
  197. .wrap {
  198. background: #fff;
  199. margin: 10px;
  200. border-radius: 10px;
  201. padding: 10px;
  202. }
  203. .location {
  204. width: 32rpx;
  205. height: 32rpx;
  206. margin-right: 10rpx;
  207. }
  208. .locationwrap {
  209. font-size: 16px;
  210. display: flex;
  211. align-items: center;
  212. }
  213. </style>