reserve.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <view>
  3. <navbar :config="config" backColor="#999999"></navbar>
  4. <view class="regional-agency">
  5. <view class="" v-if="provincesList.length > 0">
  6. <text class="reserve-title">请选择心仪的区域</text>
  7. <block v-for="(item , index) in selectCity" :key="index">
  8. <view class="reserve-item" @click.stop="selectProvince">
  9. <view class="reserve-lable">
  10. <text class="reserve-text" v-if="item.label">{{ item.label }}</text>
  11. <text class="reserve-hint" v-else>点击选择省</text>
  12. </view>
  13. <view class="reserve-icon iconfont3">&#xe65c;</view>
  14. </view>
  15. </block>
  16. <view class="reserve-btn" @click.stop="reserveBtn">
  17. 立即预定
  18. </view>
  19. </view>
  20. <view class="lock-position" @click="lockPosition">
  21. 查看已被锁定的区县>>
  22. </view>
  23. </view>
  24. <u-select v-model="areaShow" mode="mutil-column-auto" :list="provincesList" @confirm="confirmSite"></u-select>
  25. </view>
  26. </template>
  27. <script>
  28. import { applyareaagentApply } from "@/api/personal-center.js"
  29. import selectSite from "./select.vue"
  30. export default {
  31. components: {
  32. selectSite
  33. },
  34. data() {
  35. return {
  36. config: {
  37. back: true, //false是tolbar页面 是则不写
  38. title: '预定区域代理',
  39. color: '#1A1A1A',
  40. // autoBack:true,
  41. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  42. backgroundColor: [1, "#fff"],
  43. statusBarFontColor: '#1A1A1A'
  44. },
  45. areaShow:false,
  46. provincesList: [],
  47. selectCity: [{},{},{}],
  48. reserveLoading:false
  49. }
  50. },
  51. created() {
  52. // this.getCode()
  53. },
  54. onShow() {
  55. this.$nextTick(() => {
  56. this.getAddressList()
  57. })
  58. },
  59. methods: {
  60. // 区域代理
  61. lockPosition() {
  62. uni.navigateTo({
  63. url:'/pages/user/regional-agency/lock-position'
  64. })
  65. },
  66. confirmSite(e) {
  67. this.selectCity = e
  68. },
  69. //获取地址列表
  70. async getAddressList() {
  71. let req = this.$http.get('/cnarea/tree-lbs', {});
  72. req.then(res => {
  73. console.log('getAddressList = ', res)
  74. this.provincesList = res.tree.children;
  75. })
  76. },
  77. selectProvince() {
  78. this.areaShow = true
  79. },
  80. reserveBtn(){
  81. if(this.reserveLoading){
  82. return false;
  83. };
  84. if(this.selectCity.length === 0){
  85. this.$mUtil.toast("请选择申请区域")
  86. return false
  87. };
  88. if(!this.selectCity[0].label){
  89. this.$mUtil.toast("请先选择省")
  90. return false
  91. };
  92. if(!this.selectCity[1].label){
  93. this.$mUtil.toast("请先选择市")
  94. return false
  95. };
  96. if(!this.selectCity[2].label){
  97. this.$mUtil.toast("请先选择区")
  98. return false
  99. };
  100. this.reserveLoading = true;
  101. const data = {
  102. province_name: this.selectCity[0].label,
  103. province_code: this.selectCity[0].value,
  104. city_name: this.selectCity[1].label,
  105. city_code: this.selectCity[1].value,
  106. area_name: this.selectCity[2].label,
  107. area_code: this.selectCity[2].value,
  108. };
  109. this.$http.post(applyareaagentApply , data).then(res => {
  110. if(res && res.code == 200){
  111. this.reserveLoading = false;
  112. this.$mUtil.toast("区域申请提交成功")
  113. }
  114. }).catch(err => {
  115. this.reserveLoading = false;
  116. })
  117. }
  118. }
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. .reserve-box {
  123. // width: 100%;
  124. // min-height: calc(100vh - 40rpx);
  125. }
  126. .regional-agency {
  127. padding: 64rpx 60rpx 0;
  128. .reserve-title {
  129. font-size: 38rpx;
  130. font-family: PingFang SC, PingFang SC-Bold;
  131. font-weight: 700;
  132. color: #333333;
  133. }
  134. .reserve-item {
  135. width: 100%;
  136. height: 112.5rpx;
  137. border-bottom: 1rpx solid #d9d9d9;
  138. display: flex;
  139. align-items: center;
  140. justify-content: space-between;
  141. .reserve-lable {
  142. width: 1px;
  143. flex: 1;
  144. font-size: 28rpx;
  145. font-family: PingFang SC, PingFang SC-Regular;
  146. font-weight: 400;
  147. .reserve-hint {
  148. color: #cccccc;
  149. }
  150. .reserve-text {
  151. color: #000;
  152. }
  153. }
  154. .reserve-icon {
  155. flex-shrink: 0;
  156. font-size: 30rpx;
  157. color: #808080;
  158. }
  159. }
  160. // <view class="reserve-item">
  161. // <view class="reserve-lable">
  162. // <text class="reserve-hint" v-show="city">点击选择省</text>
  163. // <text class="reserve-text" v-show="!city"></text>
  164. // </view>
  165. // <view class="iconfont">&#xe6c7;</view>
  166. // </view>
  167. .reserve-btn{
  168. margin-top: 100rpx;
  169. width: 100%;
  170. height: 80rpx;
  171. border-radius: 40rpx;
  172. background-color: #FA6138;
  173. font-size: 32rpx;
  174. font-family: PingFang SC, PingFang SC-Regular;
  175. font-weight: 400;
  176. text-align: center;
  177. line-height: 80rpx;
  178. color: #ffffff;
  179. }
  180. }
  181. .lock-position {
  182. position: fixed;
  183. left: 0;
  184. bottom: 0;
  185. width: 100%;
  186. height: 100rpx;
  187. font-size: 28rpx;
  188. font-family: PingFang SC, PingFang SC-Regular;
  189. font-weight: 400;
  190. text-decoration: underline;
  191. text-align: center;
  192. color: #FA6138;
  193. }
  194. </style>