internationalAddress.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <view class="page">
  3. <view class="content">
  4. <view class="title">
  5. <text class="title-left">{{ i18n.contacts }}</text>
  6. </view>
  7. <!-- 注意,如果需要兼容微信小程序,最好通过setRules方法设置rules规则 -->
  8. <u--form labelPosition="left" :model="model1" ref="uForm">
  9. <u-form-item labelWidth="150rpx" @click="showDialog = true" :label="i18n.country" borderBottom
  10. ref="item1">
  11. <u--input v-model="model1.userInfo.sex" disabled disabledColor="#ffffff"
  12. :placeholder="i18n.selection" border="none"></u--input>
  13. <u-icon slot="right" name="arrow-right"></u-icon>
  14. </u-form-item>
  15. <u-form-item labelWidth="150rpx" :label="i18n.name" borderBottom ref="item1">
  16. <u--input v-model="model1.userInfo.name" :placeholder="i18n.goods" border="none"></u--input>
  17. </u-form-item>
  18. <u-form-item labelWidth="150rpx" :label="i18n.phone" borderBottom ref="item1">
  19. <u--input v-model="model1.userInfo.name" :placeholder="i18n.pleasePhoneNumber"
  20. border="none"></u--input>
  21. </u-form-item>
  22. <u-form-item labelWidth="150rpx" :label="i18n.postalCode" borderBottom ref="item1">
  23. <u--input v-model="model1.userInfo.name" :placeholder="i18n.PleacePostalCode"
  24. border="none"></u--input>
  25. </u-form-item>
  26. <u-form-item labelWidth="150rpx" :label="i18n.city" borderBottom @click="show = true" ref="item1">
  27. <u--input v-model="model1.userInfo.sex" disabled disabledColor="#ffffff"
  28. :placeholder="i18n.township" border="none"></u--input>
  29. <u-icon slot="right" name="arrow-right"></u-icon>
  30. </u-form-item>
  31. <u-form-item labelWidth="150rpx" :label="i18n.detailed" borderBottom ref="item1">
  32. <u--input v-model="model1.userInfo.name" :placeholder="i18n.sect" border="none"></u--input>
  33. </u-form-item>
  34. <u-form-item labelWidth="150rpx" :label="i18n.companyName" borderBottom ref="item1">
  35. <u--input v-model="model1.userInfo.name" :placeholder="i18n.company" border="none"></u--input>
  36. </u-form-item>
  37. <u-form-item labelWidth="150rpx" :label="i18n.email" borderBottom ref="item1">
  38. <u--input v-model="model1.userInfo.name" :placeholder="i18n.pleaseEmail" border="none"></u--input>
  39. </u-form-item>
  40. <view style="display: flex;justify-content: space-between;align-items: center;">
  41. <view class="item-left">
  42. <image src="../../static/mine/330.png" class="address-icon" mode=""></image>
  43. <text>{{ i18n.addressBook }}</text>
  44. </view>
  45. <text style="font-size: 24rpx; color: #333;">{{i18n.empty}}</text>
  46. </view>
  47. </u--form>
  48. </view>
  49. <SelectCity :show="show" @close="close" />
  50. <view class="footer">
  51. <button class="save">{{i18n.preserve}}</button>
  52. </view>
  53. <u-picker :show="showDialog" :columns="columns" ></u-picker>
  54. </view>
  55. </template>
  56. <script>
  57. import SelectCity from '../addEditAddress/component/selectCity.vue';
  58. export default {
  59. components: {
  60. SelectCity
  61. },
  62. computed: {
  63. i18n() {
  64. return this.$t('index')
  65. }
  66. },
  67. data() {
  68. return {
  69. show: false,
  70. showDialog: false,
  71. model1: {
  72. userInfo: {
  73. name: '',
  74. sex: '',
  75. },
  76. },
  77. rules: {
  78. 'userInfo.name': {
  79. type: 'string',
  80. required: true,
  81. message: '请填写姓名',
  82. trigger: ['blur', 'change']
  83. },
  84. 'userInfo.sex': {
  85. type: 'string',
  86. max: 1,
  87. required: true,
  88. message: '请选择男或女',
  89. trigger: ['blur', 'change']
  90. },
  91. },
  92. };
  93. },
  94. methods: {
  95. sexSelect(e) {
  96. this.model1.userInfo.sex = e.name
  97. this.$refs.uForm.validateField('userInfo.sex')
  98. },
  99. close() {
  100. this.show = false
  101. this.showDialog = false
  102. }
  103. },
  104. mounted() {
  105. uni.setNavigationBarTitle({
  106. title: this.i18n.newAddress
  107. })
  108. },
  109. onReady() {
  110. //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
  111. this.$refs.uForm.setRules(this.rules)
  112. },
  113. };
  114. </script>
  115. <style lang="scss" scoped>
  116. .page {
  117. padding: 20rpx 24rpx;
  118. .content {
  119. background-color: #fff;
  120. border-radius: 16rpx;
  121. padding: 0 24rpx;
  122. .title {
  123. display: flex;
  124. justify-content: space-between;
  125. align-items: center;
  126. height: 100rpx;
  127. border-bottom: 2rpx solid rgba(151, 151, 151, .1);
  128. .title-left {
  129. font-size: 32rpx;
  130. color: #333;
  131. font-weight: 600;
  132. }
  133. .title-icon {
  134. width: 26rpx;
  135. height: 26rpx;
  136. margin-right: 10rpx;
  137. }
  138. .title-right {
  139. display: flex;
  140. align-items: center;
  141. font-size: 24rpx;
  142. color: rgba(51, 51, 51, .6);
  143. }
  144. }
  145. .company {
  146. height: 102rpx;
  147. display: flex;
  148. align-items: center;
  149. border-bottom: 2rpx solid rgba(151, 151, 151, .1);
  150. }
  151. }
  152. .item-left {
  153. font-size: 24rpx;
  154. color: #333;
  155. display: flex;
  156. align-items: center;
  157. height: 86rpx;
  158. .address-icon {
  159. width: 26rpx;
  160. height: 26rpx;
  161. margin-right: 10rpx;
  162. }
  163. }
  164. .footer {
  165. background-color: #fff;
  166. position: fixed;
  167. bottom: 0;
  168. height: 146rpx;
  169. width: 750rpx;
  170. left: 0;
  171. padding-top: 20rpx;
  172. .save {
  173. width: 702rpx;
  174. margin: 0 auto;
  175. background-color: #f83224;
  176. color: #fff;
  177. border-radius: 40rpx;
  178. }
  179. }
  180. }
  181. </style>