stayCheck.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <view class="page" :style="{'height':(h)+'px','padding-top':mt+'px'}">
  3. <c-nav-bar title="添加入住人" :showIcon="true"></c-nav-bar>
  4. <u-form :model="form" ref="form">
  5. <view class="box" v-for="(item,index) in checkInPersonList">
  6. <u-form-item label="姓名" prop="checkInName" label-width="172rpx" border-bottom>
  7. <u-input border="false" v-model="item.checkInName" placeholder="请输入姓名" />
  8. </u-form-item>
  9. <u-form-item label="手机号码" prop="checkInPhone" label-width="172rpx" border-bottom>
  10. <u-input border="false" v-model="item.checkInPhone" placeholder="请输入手机号" />
  11. </u-form-item>
  12. <u-form-item label="证件类型" label-width="172rpx" border-bottom @click.native="show=true">
  13. <view class="personInfo">
  14. <text style="font-size: 30rpx;">{{item.cardType|cardName}}</text>
  15. <u-picker :itemHeight="88" :immediateChange="true" :show="show" :columns="list" keyName="label"
  16. :defaultIndex="passengerDefault" @cancel="show=false;"
  17. @confirm="(e)=>passengerConfirm(e,index)"></u-picker>
  18. <u-icon name="arrow-right"></u-icon>
  19. </view>
  20. </u-form-item>
  21. <u-form-item label="证件号" prop="idCard" label-width="172rpx" border-bottom>
  22. <u-input border="false" v-model="item.idCard" placeholder="请输入证件号" />
  23. </u-form-item>
  24. <!-- <u-form-item label="民族" prop="nation" label-width="172rpx" border-bottom>
  25. <u-input border="false" v-model="item.nation" placeholder="请输入民族" />
  26. </u-form-item>
  27. <u-form-item label="地址" prop="address" label-width="172rpx" border-bottom>
  28. <u-input border="false" v-model="item.address" placeholder="请输入地址" />
  29. </u-form-item> -->
  30. <u-form-item class="delete" v-if="checkInPersonList.length>1">
  31. <view class="delete" @click="del(index)">
  32. <u-icon name="trash"></u-icon>
  33. <text style="font-size: 30rpx;">删除</text>
  34. </view>
  35. </u-form-item>
  36. </view>
  37. </u-form>
  38. <!-- 添加入住人 -->
  39. <view class="addPerson" @click="addPerson()">
  40. <u-icon name="plus" color="#2979ff"></u-icon>添加入住人
  41. </view>
  42. <!-- 按钮 -->
  43. <!-- 按钮 -->
  44. <view class="yes" @click.native="conform">
  45. 确定
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. var that;
  51. export default {
  52. data() {
  53. return {
  54. checkInPersonList: [],
  55. passengerDefault: [0],
  56. orderInfo: [],
  57. orderId: null,
  58. show: false,
  59. list: [
  60. [{
  61. value: 0,
  62. label: '身份证'
  63. },
  64. {
  65. value: 1,
  66. label: '护照'
  67. },
  68. {
  69. value: 5,
  70. label: '台湾居民居住证'
  71. },
  72. {
  73. value: 6,
  74. label: '港澳居民居住证'
  75. }
  76. ]
  77. ],
  78. list2: [{
  79. value: 0,
  80. label: '身份证'
  81. },
  82. {
  83. value: 1,
  84. label: '护照'
  85. },
  86. {
  87. value: 5,
  88. label: '台湾居民居住证'
  89. },
  90. {
  91. value: 6,
  92. label: '港澳居民居住证'
  93. }
  94. ]
  95. }
  96. },
  97. filters: {
  98. cardName(val) {
  99. let item = that.list2.filter((item) => item.value == val);
  100. if (item[0]) {
  101. return item[0].label;
  102. } else {
  103. return ""
  104. }
  105. }
  106. },
  107. onLoad(opt) {
  108. that = this;
  109. this.orderInfo = JSON.parse(opt.orderInfo);
  110. console.log(this.orderInfo)
  111. this.checkInPersonList = this.orderInfo.detailFormList[0].checkInPersonList;
  112. if (!this.checkInPersonList || this.checkInPersonList.length == 0) {
  113. this.checkInPersonList.push({
  114. cardType:0,
  115. idCard: '',
  116. checkInPhone: '',
  117. checkInName: '',
  118. })
  119. }
  120. },
  121. methods: {
  122. passengerConfirm(e, index) {
  123. this.checkInPersonList[index].cardType = e.value[0].value;
  124. this.show = false;
  125. },
  126. showCardChoose() {
  127. this.show = true
  128. },
  129. del(index) {
  130. if (this.checkInPersonList.length > 1) {
  131. this.checkInPersonList.splice(index, 1);
  132. }
  133. },
  134. addPerson() {
  135. this.checkInPersonList.push({
  136. checkInPhone: '',
  137. idCard: '',
  138. cardType: '',
  139. checkInName: '',
  140. })
  141. },
  142. conform() {
  143. let list = this.checkInPersonList.filter((item) => item.idCard && item.checkInName);
  144. this.getOpenerEventChannel().emit('addSuccess', {
  145. 'data': list
  146. });
  147. uni.navigateBack();
  148. // this.$api.post('/merchant/hotel/order/updOrder', this.orderInfo).then(res => {
  149. // if (res.data.code == 0) {
  150. // this.$showToast('操作成功');
  151. // setTimeout(() => {
  152. // }, 1500)
  153. // }
  154. // })
  155. },
  156. }
  157. // onReady(){
  158. // this.$refs.form.setRules(this.rules)
  159. // }
  160. }
  161. </script>
  162. <style lang="scss">
  163. .page {
  164. background: #F3F4F4;
  165. padding-bottom: 260rpx;
  166. box-sizing: border-box;
  167. overflow-y: auto;
  168. overflow-x: auto;
  169. }
  170. .box {
  171. background-color: #fff;
  172. margin: 0 auto 20rpx;
  173. border-radius: 10rpx;
  174. width: 92%;
  175. padding: 0 30rpx;
  176. margin-top: 20rpx;
  177. }
  178. .tit {
  179. font-size: 32rpx;
  180. font-weight: bold;
  181. color: #333;
  182. }
  183. .del {
  184. display: flex;
  185. justify-content: center;
  186. align-items: center;
  187. width: 100%;
  188. height: 102rpx;
  189. background-color: #fff;
  190. font-size: 30rpx
  191. }
  192. .addPerson {
  193. // margin: 0 auto ;
  194. width: 92%;
  195. height: 100rpx;
  196. margin-left: 30rpx;
  197. background-color: #fff;
  198. border-radius: 10rpx;
  199. display: flex;
  200. justify-content: center;
  201. align-items: center;
  202. font-size: 30rpx;
  203. color: #1372FF;
  204. }
  205. .yes {
  206. width: 690rpx;
  207. height: 96rpx;
  208. line-height: 96rpx;
  209. background-color: #1372FF;
  210. border-radius: 48rpx;
  211. position: fixed;
  212. bottom: 40rpx;
  213. margin-left: 30rpx;
  214. color: #fff;
  215. font-size: 34rpx;
  216. text-align: center;
  217. // line-height: 96rpx;
  218. // margin-top: 200rpx;
  219. }
  220. .delete {
  221. display: flex;
  222. justify-content: center;
  223. align-items: center;
  224. }
  225. .personInfo {
  226. padding-left: 15rpx;
  227. display: flex;
  228. align-items: center;
  229. justify-content: space-between;
  230. }
  231. </style>