infoCollect.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. <template>
  2. <view class="info-collect-page">
  3. <!-- 产品信息 -->
  4. <view class="product-info">
  5. <view class="product-left">
  6. <!-- <image src="{{infoGoods.picUrl}}" mode="aspectFill"></image> {{infoGoods.name}} {{infoGoods.brief}} -->
  7. <image src="https://mall.zhaijieshi.cc/file/jzmall/weixin/new/icon-jpjzs.png" mode="aspectFill"></image>
  8. </view>
  9. <view class="product-right">
  10. <view>鲸品家政师</view>
  11. <view class="brief sub-color">服务类型:住家、白班、钟点工</view>
  12. </view>
  13. </view>
  14. <!-- 信息收集 -->
  15. <view class="collect-detail">
  16. <!-- <van-cell-group>
  17. <van-field
  18. v-model="customerName"
  19. label="客户名称"
  20. placeholder-style="color:#85868A;font-size:24rpx;font-family: PingFangSC-Light, helvetica, 'Heiti SC';font-weight:normal"
  21. placeholder="请输入客户名称"
  22. />
  23. <van-field
  24. v-model="customerTel"
  25. label="手 机"
  26. placeholder-style="color:#85868A;font-size:24rpx; font-family: PingFangSC-Light, helvetica, 'Heiti SC';font-weight:normal"
  27. placeholder="请输入手机号"
  28. maxlength="11"
  29. />
  30. <van-cell title="住 址" is-link :value="address" @click="selectAddress" />
  31. <van-cell title="服务类型" is-link :value="serviceModelText" @click="showServicePicker" />
  32. </van-cell-group> -->
  33. </view>
  34. <view class="collect-tip jz-color">*9:30-19:30 3小时内回复;以外时间次日10:30前回复</view>
  35. <!-- 提交按钮 -->
  36. <view class="bottom-fixed-btn-wrapper">
  37. <!-- <van-button type="info" block round @tap.native="confirmSubmit">确认</van-button> -->
  38. </view>
  39. <!-- <van-popup :show="typePickerShow" position="bottom">
  40. <van-picker show-toolbar :columns="typeColumns" @cancel="onTypeCancel" @confirm="onTypeConfirm" />
  41. </van-popup>
  42. <van-popup :show="timePickerShow" position="bottom">
  43. <van-datetime-picker type="date" :value="currentDate" @cancel="onTimeCancel" @confirm="onTimeConfirm" :min-date="minDate" @formatter="formatterDate" />
  44. </van-popup> -->
  45. </view>
  46. </template>
  47. <script>
  48. // import Dialog from '@vant/weapp/dialog/dialog';
  49. const util = require('../../../utils/util');
  50. const check = require('../../../utils/check');
  51. const api = require('../../../config/api');
  52. const app = getApp();
  53. export default {
  54. data() {
  55. return {
  56. infoGoods: app.globalData.infoGoods,
  57. customerName: '',
  58. customerTel: '',
  59. address: '请选择住址',
  60. addressId: '',
  61. serviceModelText: '请选择',
  62. serviceModel: '',
  63. // startServiceTime:'请选择',
  64. typePickerShow: false,
  65. timePickerShow: false,
  66. serviceModelList: [
  67. {
  68. id: '1',
  69. name: '钟点工'
  70. },
  71. {
  72. id: '2',
  73. name: '白班保姆'
  74. },
  75. {
  76. id: '3',
  77. name: '住家保姆'
  78. }
  79. // {id:'4',name:'月嫂'},
  80. // {id:'5',name:'代班保姆-钟点工'},
  81. // {id:'6',name:'代班保姆-保姆'},
  82. ],
  83. // typeColumns:['钟点工','白班保姆','住家保姆','月嫂','代班保姆-钟点工','代班保姆-保姆'],
  84. typeColumns: ['钟点工', '白班保姆', '住家保姆'],
  85. currentDate: new Date().getTime(),
  86. minDate: new Date().getTime(),
  87. startServiceTime: ''
  88. };
  89. }
  90. /**
  91. * 生命周期函数--监听页面加载
  92. */,
  93. onLoad: function (options) {},
  94. /**
  95. * 生命周期函数--监听页面初次渲染完成
  96. */
  97. onReady: function () {},
  98. /**
  99. * 生命周期函数--监听页面显示
  100. */
  101. onShow: function () {
  102. // let addressId = wx.getStorageSync('addressId');
  103. // if (addressId === "") {
  104. // addressId = 0;
  105. // }
  106. let addressId = app.globalData.infoAddress.addressId;
  107. if (addressId != '') {
  108. this.setData({
  109. addressId: addressId,
  110. address: app.globalData.infoAddress.addressDetail
  111. });
  112. }
  113. },
  114. /**
  115. * 生命周期函数--监听页面隐藏
  116. */
  117. onHide: function () {},
  118. /**
  119. * 生命周期函数--监听页面卸载
  120. */
  121. onUnload: function () {},
  122. /**
  123. * 页面相关事件处理函数--监听用户下拉动作
  124. */
  125. onPullDownRefresh: function () {},
  126. /**
  127. * 页面上拉触底事件的处理函数
  128. */
  129. onReachBottom: function () {},
  130. /**
  131. * 用户点击右上角分享
  132. */
  133. onShareAppMessage: function () {},
  134. methods: {
  135. selectAddress() {
  136. uni.navigateTo({
  137. url: '/pages/ucenter/address/address'
  138. });
  139. },
  140. formatterDate(type, value) {
  141. if (type === 'year') {
  142. return `${value}年`;
  143. }
  144. if (type === 'month') {
  145. return `${value}月`;
  146. }
  147. return value;
  148. },
  149. onTimeCancel() {
  150. this.setData({
  151. timePickerShow: false
  152. });
  153. },
  154. onTimeConfirm(event) {
  155. console.log(event);
  156. this.setData({
  157. startServiceTime: util.formetdate(new Date(event.detail)),
  158. timePickerShow: false
  159. });
  160. },
  161. showServicePicker() {
  162. this.setData({
  163. typePickerShow: true
  164. });
  165. },
  166. showTimePicker() {
  167. this.setData({
  168. timePickerShow: true
  169. });
  170. },
  171. onTypeCancel: function () {
  172. this.setData({
  173. typePickerShow: false
  174. });
  175. },
  176. onTypeConfirm: function (event) {
  177. this.setData({
  178. serviceModel: this.serviceModelList[event.detail.index].id,
  179. serviceModelText: event.detail.value,
  180. typePickerShow: false
  181. });
  182. },
  183. confirmSubmit() {
  184. if (this.customerName == '') {
  185. uni.showToast({
  186. title: '请输入客户名称',
  187. icon: 'none',
  188. duration: 2000
  189. });
  190. return false;
  191. }
  192. if (this.customerTel == '') {
  193. uni.showToast({
  194. title: '请输入手机号',
  195. icon: 'none',
  196. duration: 2000
  197. });
  198. return false;
  199. }
  200. if (!check.isValidPhone(this.customerTel)) {
  201. // util.showErrorToast('请输入正确的手机号码');
  202. uni.showToast({
  203. title: '输入正确的手机号码',
  204. icon: 'none',
  205. duration: 2000
  206. });
  207. return false;
  208. }
  209. if (this.address == '请选择住址') {
  210. uni.showToast({
  211. title: '请选择住址',
  212. icon: 'none',
  213. duration: 2000
  214. });
  215. return false;
  216. }
  217. if (this.serviceModelText == '请选择') {
  218. uni.showToast({
  219. title: '请选择服务类型',
  220. icon: 'none',
  221. duration: 2000
  222. });
  223. return false;
  224. }
  225. // if(this.data.startServiceTime=='请选择'){
  226. // wx.showToast({
  227. // title: '请选择服务时间',
  228. // icon: 'none',
  229. // duration: 2000
  230. // });
  231. // return false;
  232. // }
  233. console.log('校验成功');
  234. let userInfo = uni.getStorageSync('userInfo');
  235. uni.showLoading({
  236. title: '提交中...',
  237. mask: true
  238. });
  239. util.request(
  240. api.addClue,
  241. {
  242. customerName: this.customerName,
  243. customerTel: this.customerTel,
  244. mallAddressId: this.addressId,
  245. serviceModel: this.serviceModel,
  246. // "startServiceTime": this.data.startServiceTime,
  247. userId: userInfo.id
  248. },
  249. 'POST'
  250. )
  251. .then((res) => {
  252. uni.hideLoading();
  253. if (res.errno == 0) {
  254. app.globalData.infoGoods.type = '2';
  255. uni.navigateTo({
  256. url: '/pages/checkout/payResult/payResult'
  257. });
  258. } else {
  259. util.showErrorToast(res.errmsg);
  260. }
  261. })
  262. .catch(() => {
  263. uni.hideLoading();
  264. });
  265. }
  266. }
  267. };
  268. </script>
  269. <style>
  270. .info-collect-page {
  271. padding: 24rpx 30rpx 0;
  272. }
  273. .product-info {
  274. height: 162rpx;
  275. padding: 12rpx 12rpx 16rpx;
  276. background: #fff;
  277. border-radius: 10rpx;
  278. }
  279. .product-info {
  280. display: flex;
  281. align-items: center;
  282. }
  283. .product-left image {
  284. width: 132rpx;
  285. height: 136rpx;
  286. border-radius: 10rpx;
  287. }
  288. .product-right {
  289. margin: 0 0 0 36rpx;
  290. display: flex;
  291. flex-direction: column;
  292. justify-content: space-between;
  293. height: 136rpx;
  294. padding: 14rpx 0 36rpx;
  295. }
  296. .product-right view {
  297. white-space: nowrap;
  298. text-overflow: ellipsis;
  299. overflow: hidden;
  300. word-break: break-all;
  301. width: 500rpx;
  302. }
  303. .brief {
  304. font-size: 24rpx;
  305. }
  306. .collect-detail {
  307. margin: 20rpx 0 24rpx;
  308. }
  309. .collect-detail .van-cell {
  310. background-color: transparent;
  311. padding: 20rpx 10rpx;
  312. }
  313. .collect-detail .van-cell:after {
  314. border-bottom-color: #e4e4e4;
  315. border-bottom-width: 4rpx;
  316. left: 0;
  317. }
  318. .collect-detail .van-field__input {
  319. text-align: right;
  320. }
  321. .collect-tip {
  322. font-size: 24rpx;
  323. }
  324. .collect-detail .van-cell__value,
  325. .collect-detail .van-field__input {
  326. color: #85868a;
  327. font-size: 24rpx;
  328. font-family: PingFangSC-Light, helvetica, 'Heiti SC';
  329. }
  330. </style>