attract.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <view>
  3. <image class="bgimg" v-if="globalImages" :src="globalImages + 'images/static/image/zs.png'" mode="widthFix"></image>
  4. <view class="info">
  5. <view class="info-box">
  6. <view class="info-box-title">
  7. 区县代理申请
  8. </view>
  9. <view class="info-box-item">
  10. <view class="info-box-item-name">联系人姓名</view>
  11. <u-input placeholder="请输入联系人姓名" v-model="applyName" :clearable="false"></u-input>
  12. </view>
  13. <view class="line"></view>
  14. <view class="info-box-item">
  15. <view class="info-box-item-name">联系人手机号</view>
  16. <u-input placeholder="请输入联系人手机号" v-model="applyPhone" :clearable="false"></u-input>
  17. </view>
  18. <view class="line"></view>
  19. <view class="info-box-item">
  20. <view class="info-box-item-name">地址</view>
  21. <u-input placeholder="请选择所在区域地址" v-model=" applyContent" @click="getcity()" :disabled="true"
  22. :clearable="false">
  23. </u-input>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="sub">
  28. <view class="sub-box">
  29. <view class="sub-box-l" @click="submit()">确认提交</view>
  30. <view class="sub-box-r" @click="Changekefu()">直接联系 </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import { waitForGlobalImages } from '@/utils/globalImageLoader'
  37. export default {
  38. data() {
  39. return {
  40. applyName: '',
  41. applyPhone: '',
  42. applyContent: '',
  43. applyId: '',
  44. globalImages: '',
  45. };
  46. },
  47. onLoad() {
  48. this.getDetail()
  49. waitForGlobalImages().then((path) => {
  50. console.log('✅ 全局图片路径:', path)
  51. this.globalImages = path
  52. })
  53. },
  54. onShow() {
  55. },
  56. methods: {
  57. getDetail() {
  58. let data = {
  59. classify: 2
  60. }
  61. this.$Request.get("/app/apply/selectApplyByUserIdAndClassify", data).then(res => {
  62. if (res.code == 0 && res.data) {
  63. this.applyName = res.data.applyName
  64. this.applyPhone = res.data.applyPhone
  65. this.applyContent = res.data.applyContent
  66. this.applyId = res.data.status
  67. }
  68. })
  69. },
  70. getcity() {
  71. // console.log(55555)
  72. let that = this
  73. uni.chooseLocation({
  74. success: function(res) {
  75. console.log('位置名称:' + res.name);
  76. console.log('详细地址:' + res.address);
  77. console.log('纬度:' + res.latitude);
  78. console.log('经度:' + res.longitude);
  79. that.applyContent = res.address + res.name
  80. }
  81. });
  82. },
  83. Changekefu() {
  84. let that = this
  85. // #ifdef MP-WEIXIN
  86. wx.openCustomerServiceChat({
  87. extInfo: {
  88. url: that.$queue.getData('kefu')
  89. },
  90. corpId: that.$queue.getData('kefuAppId'),
  91. success(res) {}
  92. })
  93. // #endif
  94. // #ifdef H5
  95. window.location.href = that.$queue.getData('kefu');
  96. // #endif
  97. // #ifdef APP
  98. let kefu = that.$queue.getData('kefu')
  99. console.log(kefu)
  100. plus.runtime.openURL(kefu, function(res) {});
  101. // #endif
  102. },
  103. submit() {
  104. if (!this.applyName) {
  105. uni.showToast({
  106. title: '请输入联系人姓名',
  107. icon: 'none'
  108. })
  109. return
  110. }
  111. if (!this.applyPhone) {
  112. uni.showToast({
  113. title: '请输入联系人手机号码',
  114. icon: 'none'
  115. })
  116. return
  117. }
  118. if (!this.applyContent) {
  119. uni.showToast({
  120. title: '请输入地址',
  121. icon: 'none'
  122. })
  123. return
  124. }
  125. let data = {
  126. applyName: this.applyName,
  127. applyPhone: this.applyPhone,
  128. applyContent: this.applyContent,
  129. classify: 2
  130. }
  131. this.$Request.postJson("/app/apply/insertApply", data).then(res => {
  132. if (res.code == 0) {
  133. uni.showToast({
  134. title: '提交成功!',
  135. icon: 'none'
  136. })
  137. setTimeout(function() {
  138. uni.navigateBack()
  139. }, 1000)
  140. } else {
  141. uni.showToast({
  142. title: res.msg,
  143. icon: 'none'
  144. })
  145. }
  146. })
  147. }
  148. }
  149. }
  150. </script>
  151. <style lang="less">
  152. page {
  153. background-color: #f5f5f5;
  154. }
  155. .bgimg {
  156. position: relative;
  157. width: 100%;
  158. }
  159. .info {
  160. // width: 90%;
  161. height: auto;
  162. display: flex;
  163. justify-content: center;
  164. position: absolute;
  165. top: 750rpx;
  166. background-image: url('../../static/image/zsbg.png');
  167. background-size: 100% 100%;
  168. margin: 30upx;
  169. padding: 30upx;
  170. .info-box {
  171. width: 620rpx;
  172. .info-box-title {
  173. color: #333333;
  174. font-size: 32rpx;
  175. font-weight: 800;
  176. text-align: center;
  177. }
  178. .info-box-item {
  179. margin-top: 30rpx;
  180. .info-box-item-name {
  181. font-size: 28rpx;
  182. color: #333333;
  183. font-weight: 800;
  184. margin-bottom: 10rpx;
  185. }
  186. }
  187. .line {
  188. width: 100%;
  189. border: 1rpx solid #B4BCFF;
  190. margin-top: 20rpx;
  191. }
  192. }
  193. }
  194. .sub {
  195. width: 100%;
  196. height: 88rpx;
  197. display: flex;
  198. justify-content: center;
  199. position: absolute;
  200. top: 1430rpx;
  201. .sub-box {
  202. width: 613rpx;
  203. height: 100%;
  204. display: flex;
  205. justify-content: space-between;
  206. .sub-box-l {
  207. width: 290rpx;
  208. height: 88rpx;
  209. background: #97A8F8;
  210. border-radius: 44rpx;
  211. color: #ffffff;
  212. font-size: 28rpx;
  213. font-weight: bold;
  214. display: flex;
  215. justify-content: center;
  216. align-items: center;
  217. }
  218. .sub-box-r {
  219. width: 290rpx;
  220. height: 88rpx;
  221. background: #435DF0;
  222. border-radius: 44rpx;
  223. color: #ffffff;
  224. font-size: 28rpx;
  225. font-weight: bold;
  226. display: flex;
  227. justify-content: center;
  228. align-items: center;
  229. }
  230. }
  231. }
  232. </style>