detial.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <template>
  2. <view class="body">
  3. <view class="header">
  4. <view class="headercon">
  5. <view>
  6. <p>
  7. <image style="width: 20vw; height: 20vw;" :src="detialInfo.img.url"></image>
  8. </p>
  9. </view>
  10. <view style="margin-left: 4vw;">
  11. <p style="font-weight: 550; font-size: 1rem;">{{detialInfo.name}}</p>
  12. <p
  13. style="font-size: 0.8rem; margin-top: 2vw; text-align: center; width: 15vw; color: #a0dbd9;border: 1px solid #a0dbd9;">
  14. 取送车</p>
  15. <view style="display: flex; margin-top: 2vw;">
  16. <p>
  17. <image style="width: 5vw; height: 5vw;" src="../../static/duihao.png" mode=""></image>
  18. </p>
  19. <p style="font-size: 0.75rem; color: #adaebe;"> 洗车 </p>
  20. <p style="margin-left: 2vw;">
  21. <image style="width: 5vw; height: 5vw;" src="../../static/duihao.png" mode=""></image>
  22. </p>
  23. <p style="font-size: 0.75rem; color: #adaebe;">WIFI</p>
  24. <p style="margin-left: 2vw;">
  25. <image style="width: 5vw; height: 5vw;" src="../../static/duihao.png" mode=""></image>
  26. </p>
  27. <p style="font-size: 0.75rem; color: #adaebe;">客休区</p>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="headerContent">
  32. <view style="color:#adaebe;">{{detialInfo.addr}}</view>
  33. <view style="display: flex; justify-content: space-around; width: 30vw;">
  34. <!-- <view>
  35. <p>
  36. <image style="width: 6vw; height: 6vw;" src="../../static/daohang.png" mode=""></image>
  37. </p>
  38. <p style="color: #adaebe;">导航</p>
  39. </view> -->
  40. <view @click="callPhone">
  41. <p>
  42. <image style="width: 6vw; height: 6vw;" src="../../static/dianhua.png" mode=""></image>
  43. </p>
  44. <p style="color: #adaebe;">电话</p>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="content">
  50. <view class="contentInfo">
  51. <view style="width: 90vw; height: 12vw; border-bottom: 0.5px solid #f8f8f8; margin-top: 2vw;">
  52. <view style="display: flex;"><span style="color: red; line-height: 11vw;">*</span> <span
  53. style="font-size: 0.8rem; line-height: 10vw; margin-left: 1vw;">服务类型</span>
  54. <p style="width: 63vw; margin-left: 2vw;"><uni-data-select v-model="value" :localdata="range"
  55. @change="Searchchange"></uni-data-select></p>
  56. </view>
  57. </view>
  58. <!-- 车系 -->
  59. <view style="width: 90vw; height: 12vw; border-bottom: 0.5px solid #f8f8f8; margin-top: 1vw;">
  60. <view style="display: flex;"><span style="color: red; line-height: 11vw;">*</span> <span
  61. style="font-size: 0.8rem; line-height: 10vw; margin-left: 1vw;">车辆</span>
  62. <p style="width: 63vw; margin-left: 9vw;"><uni-data-select v-model="VehicleSeries"
  63. :localdata="chexi" @change="Vehiclechange"></uni-data-select></p>
  64. </view>
  65. </view>
  66. <!-- 联系人-->
  67. <view style="width: 90vw; height: 12vw; border-bottom: 0.5px solid #f8f8f8;">
  68. <view style="display: flex;"><span style="color: red; line-height: 11vw;">*</span> <span
  69. style="font-size: 0.8rem; line-height: 10vw; margin-left: 1vw;">联系人</span>
  70. <p> <input type="text" placeholder="请输入联系人" v-model="name"
  71. style=" width: 30vw; font-size: 0.8rem; height: 10vw; line-height: 10vw; margin-left: 7vw; " />
  72. </p>
  73. <view style=" width: 37vw; display: flex; align-items: center;">
  74. <u-radio-group v-model="selectRadio" @change="radioGroupChange">
  75. <u-radio @change="radioChange" active-color="red" v-for="(item, index) in list"
  76. :key="index" :name="item.name" :disabled="item.disabled">
  77. {{item.name}}
  78. </u-radio>
  79. </u-radio-group>
  80. </view>
  81. </view>
  82. </view>
  83. <!-- 联系电话 -->
  84. <view style="width: 90vw; height: 12vw; border-bottom: 0.5px solid #f8f8f8;">
  85. <p style="display: flex;"><span style="color: red; line-height: 11vw;">*</span> <span
  86. style="font-size: 0.8rem; line-height: 10vw; margin-left: 1vw;">联系电话</span> <input
  87. type="text" placeholder="请输入联系电话" v-model="phone"
  88. style="font-size: 0.8rem; height: 10vw; line-height: 10vw; margin-left: 4vw; " /> </p>
  89. </view>
  90. <view style="width: 90vw; height: 12vw; display: flex; border-bottom: 0.5px solid #f8f8f8;">
  91. <p style="display: flex;"><span style="color: red; line-height: 11vw;">*</span> <span
  92. style="font-size: 0.8rem; line-height: 10vw; margin-left: 1vw;">预约时间</span>
  93. <input type="text" placeholder="预约时间" v-model="date"
  94. style="font-size: 0.8rem; width: 50vw; height: 10vw; line-height: 10vw; margin-left: 6vw; "
  95. @focus="TimeFocus" />
  96. <u-picker mode="time" v-model="show" :params="params" @confirm="confirm" @cancel="cancel"></u-picker>
  97. </p>
  98. </view>
  99. <!-- 备注说明 -->
  100. <view style="width: 90vw; height: 12vw; display: flex; border-bottom: 0.5px solid #f8f8f8;">
  101. <p style="display: flex;"><span style="color: red; line-height: 11vw;">*</span> <span
  102. style="font-size: 0.8rem; line-height: 10vw; margin-left: 1vw;">备注说明</span> <input
  103. type="text" v-model="text" placeholder="请输入备注说明"
  104. style="font-size: 0.8rem; width: 50vw; height: 10vw; line-height: 10vw; margin-left: 4vw; " />
  105. </p>
  106. </view>
  107. <!-- button -->
  108. <u-toast ref="uToast" />
  109. <view class="button" @click="submit">提交</view>
  110. </view>
  111. </view>
  112. </view>
  113. </template>
  114. <script>
  115. import UniDataSelect from '@/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue'
  116. export default {
  117. components: {
  118. UniDataSelect
  119. },
  120. data() {
  121. return {
  122. value: 0,
  123. show: false,
  124. detialInfo: '',
  125. CarNumber: '',
  126. VehicleSeries: '',
  127. phone: '',
  128. name: '',
  129. text: '',
  130. date: null,
  131. selectRadio: '先生',
  132. list: [{
  133. name: '先生',
  134. disabled: false
  135. },
  136. {
  137. name: '女士',
  138. disabled: false
  139. },
  140. ],
  141. range: [],
  142. chexi: [],
  143. params: {
  144. year: true,
  145. month: true,
  146. day: true,
  147. hour: true,
  148. minute: true,
  149. second: true
  150. },
  151. }
  152. },
  153. onLoad(option) {
  154. if (option.detialInfo) {
  155. this.detialInfo = JSON.parse(decodeURIComponent(option.detialInfo))
  156. console.log(this.detialInfo)
  157. }
  158. if (this.$db.get('name')) {
  159. this.name = this.$db.get('name')
  160. }
  161. if (this.$db.get('tel')) {
  162. this.phone = this.$db.get('tel')
  163. }
  164. this.getserve()
  165. },
  166. methods: {
  167. radioGroupChange(e) {
  168. console.log(e)
  169. },
  170. callPhone() {
  171. uni.showModal({
  172. title: '联系我们',
  173. content: this.detialInfo.tel,
  174. confirmText: '确认',
  175. success(res) {
  176. if (res.confirm) {
  177. uni.makePhoneCall({
  178. phoneNumber: this.detialInfo.tel, //电话号码
  179. success: function(e) {
  180. console.log(e);
  181. },
  182. fail: function(e) {
  183. console.log(e);
  184. }
  185. })
  186. }
  187. }
  188. })
  189. },
  190. // checkboxChange(e) {
  191. // if (this.CarNumber == true) {
  192. // this.CarNumber = false
  193. // } else {
  194. // this.CarNumber = true
  195. // }
  196. // },
  197. // 服务类型
  198. getserve() {
  199. this.$api.getServeType(res => {
  200. if (res.code == 0) {
  201. this.range = res.data.maint_types
  202. this.chexi = res.data.vehicles
  203. }
  204. })
  205. },
  206. // 提交
  207. submit() {
  208. if (!this.$db.get('token')) {
  209. uni.navigateTo({
  210. url: '/pages/login/login'
  211. })
  212. return
  213. }
  214. this.$api.postreserve({
  215. shop: this.detialInfo.id,
  216. name: this.name,
  217. tel: this.phone,
  218. type: this.value,
  219. vehicle: this.VehicleSeries,
  220. date: this.date,
  221. notes: this.text
  222. }, res => {
  223. if (res.code == 0) {
  224. this.successToast('操作成功')
  225. setTimeout(function() {
  226. uni.switchTab({
  227. url: '/pages/serve/index'
  228. })
  229. }, 1000)
  230. } else {
  231. this.errorToast('请填写必填项')
  232. }
  233. })
  234. },
  235. Searchchange(e) {
  236. this.value = e.id
  237. console.log("e:", e);
  238. },
  239. Vehiclechange(e) {
  240. this.VehicleSeries = e.id
  241. console.log('e', e)
  242. },
  243. successToast(msg) {
  244. this.$refs.uToast.show({
  245. title: msg,
  246. type: 'success',
  247. duration: 1000
  248. })
  249. },
  250. errorToast(msg) {
  251. this.$refs.uToast.show({
  252. title: msg,
  253. type: 'error',
  254. duration: 1000
  255. })
  256. },
  257. TimeFocus() {
  258. this.show = true
  259. },
  260. // 时间
  261. confirm(e) {
  262. this.date = e.year + '-' + e.month + '-' + e.day
  263. },
  264. cancel() {
  265. this.show = false
  266. },
  267. }
  268. }
  269. </script>
  270. <style lang="scss" scoped>
  271. .body {
  272. width: 100vw;
  273. height: 100vh;
  274. background-color: #f8f8f8f8;
  275. .header {
  276. width: 100vw;
  277. height: 27vh;
  278. background-color: #ebeff4;
  279. box-sizing: border-box;
  280. display: flex;
  281. flex-direction: column;
  282. padding: 2vw;
  283. .headercon {
  284. width: 96vw;
  285. height: 13vh;
  286. display: flex;
  287. border-bottom: 1px solid #e5e8ed;
  288. }
  289. .headerContent {
  290. display: flex;
  291. margin-top: 4vw;
  292. justify-content: space-between;
  293. }
  294. }
  295. .content {
  296. width: 100vw;
  297. height: 70vh;
  298. box-sizing: border-box;
  299. padding: 0 2vw;
  300. border-radius: 5px;
  301. overflow: hidden;
  302. .contentInfo {
  303. position: absolute;
  304. top: 45vw;
  305. width: 96vw;
  306. height: 70vh;
  307. box-sizing: border-box;
  308. padding: 2vw;
  309. background-color: white;
  310. border-radius: 10px;
  311. margin-top: 2vw;
  312. }
  313. }
  314. .button {
  315. width: 90vw;
  316. height: 10vw;
  317. margin-top: 10vw;
  318. background-color: red;
  319. line-height: 10vw;
  320. border-radius: 5vw;
  321. color: white;
  322. text-align: center;
  323. }
  324. }
  325. </style>