stayCheck.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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="guestPhone" label-width="172rpx" border-bottom>
  10. <u-input border="false" v-model="item.guestPhone" 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.idName}}</text>
  15. <u-picker :itemHeight="88" :immediateChange="true" :show="show" :columns="list"
  16. keyName="label" :defaultIndex="passengerDefault" @cancel="show=false;"
  17. @confirm="passengerConfirm"></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. export default {
  51. data() {
  52. return {
  53. dataForm:{},
  54. checkInPersonList: [],
  55. passengerDefault: [0],
  56. form: {
  57. nation: '',
  58. idCard: '',
  59. address: '',
  60. checkInName: '',
  61. },
  62. orderInfo: [],
  63. orderId: null,
  64. show: false,
  65. list: [
  66. [{
  67. value: '1',
  68. label: '身份证'
  69. },
  70. {
  71. value: '2',
  72. label: '居住证'
  73. }
  74. ]
  75. ],
  76. }
  77. },
  78. onLoad(opt) {
  79. this.orderInfo=JSON.parse(opt.orderInfo);
  80. this.checkInPersonList =this.orderInfo.detailFormList[0].checkInPersonList;
  81. if (this.checkInPersonList.length == 0) {
  82. this.checkInPersonList.push({
  83. nation: '',
  84. idCard: '',
  85. address: '',
  86. checkInName: '',
  87. })
  88. }
  89. },
  90. methods: {
  91. // passengerConfirm(e) {
  92. // this.form.idName = e.value[0].label
  93. // },
  94. // 证件下拉菜单
  95. // showCardChoose() {
  96. // this.show = true
  97. // },
  98. del(index) {
  99. if (this.checkInPersonList.length > 1) {
  100. this.checkInPersonList.splice(index, 1);
  101. }
  102. },
  103. addPerson() {
  104. this.checkInPersonList.push({
  105. nation: '',
  106. idCard: '',
  107. address: '',
  108. checkInName: '',
  109. })
  110. },
  111. conform() {
  112. let list = this.checkInPersonList.filter((item) => item.idCard && item.checkInName);
  113. this.$api.post('/merchant/hotel/order/updOrder', this.orderInfo).then(res => {
  114. if (res.data.code == 0) {
  115. this.$showToast('操作成功');
  116. setTimeout(() => {
  117. this.getOpenerEventChannel().emit('addSuccess', {
  118. 'data': list
  119. });
  120. uni.navigateBack();
  121. }, 1500)
  122. }
  123. })
  124. },
  125. }
  126. // onReady(){
  127. // this.$refs.form.setRules(this.rules)
  128. // }
  129. }
  130. </script>
  131. <style lang="scss">
  132. .page {
  133. background: #F3F4F4;
  134. padding-bottom: 260rpx;
  135. box-sizing: border-box;
  136. overflow-y: auto;
  137. overflow-x: auto;
  138. }
  139. .box {
  140. background-color: #fff;
  141. margin: 0 auto 20rpx;
  142. border-radius: 10rpx;
  143. width: 92%;
  144. padding: 0 30rpx;
  145. margin-top: 20rpx;
  146. }
  147. .tit {
  148. font-size: 32rpx;
  149. font-weight: bold;
  150. color: #333;
  151. }
  152. .del {
  153. display: flex;
  154. justify-content: center;
  155. align-items: center;
  156. width: 100%;
  157. height: 102rpx;
  158. background-color: #fff;
  159. font-size: 30rpx
  160. }
  161. .addPerson {
  162. // margin: 0 auto ;
  163. width: 92%;
  164. height: 100rpx;
  165. margin-left: 30rpx;
  166. background-color: #fff;
  167. border-radius: 10rpx;
  168. display: flex;
  169. justify-content: center;
  170. align-items: center;
  171. font-size: 30rpx;
  172. color: #1372FF;
  173. }
  174. .yes {
  175. width: 690rpx;
  176. height: 96rpx;
  177. line-height: 96rpx;
  178. background-color: #1372FF;
  179. border-radius: 48rpx;
  180. position: fixed;
  181. bottom: 40rpx;
  182. margin-left: 30rpx;
  183. color: #fff;
  184. font-size: 34rpx;
  185. text-align: center;
  186. // line-height: 96rpx;
  187. // margin-top: 200rpx;
  188. }
  189. .delete {
  190. display: flex;
  191. justify-content: center;
  192. align-items: center;
  193. }
  194. .personInfo {
  195. padding-left: 15rpx;
  196. display: flex;
  197. align-items: center;
  198. justify-content: space-between;
  199. }
  200. </style>