You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

577 lines
16 KiB

1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
  1. <template>
  2. <view class="service-new container">
  3. <view class="order-type-select" v-if="!buyInfo.teacher">
  4. <view class="order-type-title">
  5. <image style="width: 40rpx; height: 40rpx;margin-right: 10rpx;" slot='cover' src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/petServiceOrder/OrderIcon.png">
  6. </image>
  7. <!-- <image style="width: 32rpx; height: 32rpx; margin-right: 10rpx;" src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/petServiceOrder/SystemOrderCircle.png"></image> -->
  8. 下单方式系统派单 <text style="color: #999;font-size: 26rpx;">(需先选择伴宠师等级)</text>
  9. </view>
  10. <view class="order-type-options">
  11. <view class="order-type-option" :class="{active: companionLevel === 'junior'}" @click="selectCompanionLevel('junior')">
  12. <image style="width: 40rpx; height: 40rpx; margin-right: 10rpx;" src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/pet/catdog.png"></image>
  13. 初级伴宠师
  14. <view class="info-icon" @click.stop="showCompanionInfo('junior')">
  15. <uni-icons type="info" size="20" color="#FFB13F"></uni-icons>
  16. </view>
  17. </view>
  18. <view class="order-type-option" :class="{active: companionLevel === 'senior'}" @click="selectCompanionLevel('senior')">
  19. <image style="width: 40rpx; height: 40rpx; margin-right: 10rpx;" src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/pet/catdog.png"></image>
  20. 高级伴宠师
  21. <view class="info-icon" @click.stop="showCompanionInfo('senior')">
  22. <uni-icons type="info" size="20" color="#FFB13F"></uni-icons>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <uni-popup ref="companionInfoPopup" type="center">
  28. <view class="companion-info-popup">
  29. <view class="companion-info-title">
  30. <text>{{ popupTitle }}</text>
  31. </view>
  32. <view class="companion-info-content">
  33. <view class="companion-info-item">
  34. <text class="companion-info-label">等级:</text>
  35. <text class="companion-info-value">{{ popupLevel }}</text>
  36. </view>
  37. <view class="companion-info-item">
  38. <text class="companion-info-label">价格:</text>
  39. <text class="companion-info-value">要根据规城市不同展示不同的价格</text>
  40. </view>
  41. <view class="companion-info-item">
  42. <text class="companion-info-label">分类标准:</text>
  43. <text class="companion-info-value">文字描述初级是什么类型的高级是什么类型的 :)</text>
  44. </view>
  45. </view>
  46. <view class="companion-info-close" @click="closeCompanionInfo">
  47. <uni-icons type="close" size="24" color="#fff"></uni-icons>
  48. </view>
  49. </view>
  50. </uni-popup>
  51. <view class="service-new-address">
  52. <uni-card padding=0 :is-shadow="false">
  53. <view class="service-new-title" slot="title">
  54. <view class="service-new-title-left">
  55. <view class="service-new-flag"></view>
  56. <view>服务地址</view>
  57. </view>
  58. </view>
  59. <view class="split-line"></view>
  60. <view class="service-new-address-content">
  61. <view v-if="isAddressSelected" class="service-new-address-selected" >
  62. <view class="personal-address-info">
  63. <view class="personal-address-text">
  64. {{currentAddress.province}} {{currentAddress.city}} {{currentAddress.detailAddress}}
  65. </view>
  66. <view class="personal-address-people">
  67. <view>
  68. {{currentAddress.name}}
  69. </view>
  70. <view style="border: solid #7D8196 1px; margin: 0 10px; height: 12px;"> </view>
  71. <view>
  72. {{currentAddress.phone}}
  73. </view>
  74. </view>
  75. </view>
  76. <view>
  77. <uni-icons type="right" size="28rpx" color="#AAA" @click="selectAddress"></uni-icons>
  78. </view>
  79. </view>
  80. <view v-else class="service-new-unselect">
  81. <view style="width: 50%;">
  82. <u-button color="#FFBF60" icon="plus-circle-fill" text="添加地址" shape="circle" plain @click="selectAddress">
  83. </u-button>
  84. </view>
  85. </view>
  86. </view>
  87. </uni-card>
  88. </view>
  89. <view class="service-new-pet">
  90. <uni-card padding=0 :is-shadow="false">
  91. <view class="service-new-title" slot="title">
  92. <view class="service-new-title-left">
  93. <view class="service-new-flag">
  94. </view>
  95. <view class="service-new-title-text">
  96. 服务宠物
  97. </view>
  98. </view>
  99. <view v-if="isPetSelected" class="add-pet" @click="selectPet">
  100. <u-icon name="plus-circle-fill" color="#FFBF60" size="28rpx" style="margin-right: 10rpx;"></u-icon>
  101. 添加宠物
  102. </view>
  103. </view>
  104. <view class="split-line"></view>
  105. <view class="service-new-pet-content">
  106. <view v-if="isPetSelected" class="personal-pet-list">
  107. <view v-for="(item,index) in currentPets" :key="index">
  108. <view class="personal-pet-list-item">
  109. <view class="personal-pet-info">
  110. <!-- 左侧头像 -->
  111. <view class="pet-avatar">
  112. <u-avatar :src="item.photo?item.photo:defaultPhoto" size="60" shape="circle"></u-avatar>
  113. </view>
  114. <!-- 中间内容 -->
  115. <view class="pet-info" style="flex: 1; margin: 0 20rpx; max-width: 50%;">
  116. <view class="pet-name-gender" style="display: flex; align-items: center;">
  117. <view>{{item.name}}</view>
  118. <view class="pet-gender" style="margin-left: 10rpx; display: flex;align-items: center;">
  119. <img :src="item.gender=='男生'?'../../static/images/details/boy.svg':'../../static/images/details/girl.svg'" alt="sex"
  120. style="width: 16px;height: 16px;"/>
  121. </view>
  122. </view>
  123. <view class="pet-dates ellipsis" >
  124. {{ getSelectedDateString(item.selectedDate) }}
  125. </view>
  126. </view>
  127. <!-- 右侧天数统计 -->
  128. <view class="date-total" style="margin-left: auto;width: 140rpx;text-align: end;">
  129. {{item.selectedDate.length}}
  130. <uni-icons type="right" size="28rpx" color="#AAA" @click="selectPet"></uni-icons>
  131. </view>
  132. </view>
  133. </view>
  134. </view>
  135. </view>
  136. <view v-else class="service-new-unselect">
  137. <view style="width: 50%;">
  138. <u-button color="#FFBF60" icon="plus-circle-fill" text="添加宠物" shape="circle" plain @click="selectPet">
  139. </u-button>
  140. </view>
  141. </view>
  142. </view>
  143. </uni-card>
  144. </view>
  145. <view class="service-new-pet">
  146. <uni-card padding=0 :is-shadow="false">
  147. <view class="service-new-title" slot="title">
  148. <view class="service-new-title-left">
  149. <view class="service-new-flag">
  150. </view>
  151. <view class="service-new-title-text">
  152. 服务细则
  153. </view>
  154. </view>
  155. </view>
  156. <view class="split-line"></view>
  157. <view class="service-new-details-content">
  158. <view style="margin: 30rpx 0;">
  159. <u-checkbox-group
  160. v-model="needPreFamiliarize"
  161. iconPlacement="right"
  162. placement="column">
  163. <u-checkbox activeColor="#FFBF60" label="是否提前熟悉" name="是否提前熟悉" shape="circle"></u-checkbox>
  164. </u-checkbox-group>
  165. </view>
  166. <view class="split-line"></view>
  167. <view class="service-new-details-desc">
  168. <view style="display: flex;">
  169. <text style="width: 20rpx;">*</text>
  170. <text style="flex: 1;">价格40元/</text>
  171. </view>
  172. <view style="display: flex; margin: 20rpx 0;">
  173. <text style="width: 20rpx;">*</text>
  174. <text style="flex: 1;">服务内容: 购买此服务后伴宠师将在您离家前按照约定日期提前上门沟通熟悉喂养要求及宠物</text>
  175. </view>
  176. <view style="display: flex;">
  177. <text style="width: 20rpx;">*</text>
  178. <text style="flex: 1;">服务保障: 购买此服务后平台支持在提前熟悉后上门服务第一天前无理由免费更换伴宠师1次</text>
  179. </view>
  180. </view>
  181. </view>
  182. </uni-card>
  183. </view>
  184. <view class="details-subscribe">
  185. <button class="details-btn" @click="goNext">下一步</button>
  186. </view>
  187. </view>
  188. </template>
  189. <script>
  190. import {
  191. getProductList,
  192. getOpenId
  193. } from "@/api/system/user"
  194. import { setToken,getToken,getOpenIdKey,setOpenIdKey } from '@/utils/auth'
  195. export default {
  196. data()
  197. {
  198. return {
  199. isAddressSelected:false,
  200. currentAddress:{},
  201. isPetSelected:false,
  202. currentPets:[],
  203. needPreFamiliarize:[],
  204. defaultPhoto:'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/pet/catdog.png',
  205. companionLevel: 'junior', // 默认选择初级伴宠师
  206. popupTitle: '',
  207. popupLevel: '',
  208. }
  209. },
  210. onLoad: function(option) {
  211. },
  212. onShow() {
  213. if (!getToken() || !getOpenIdKey()) {
  214. this.login()
  215. }
  216. if(this.$globalData.mainSku.length < 1 || !this.$globalData.mainSku[0].price){
  217. // 获取主产品
  218. this.getProductList()
  219. }
  220. this.currentAddress = this.$globalData.newOrderData.currentAddress
  221. if(this.currentAddress&&this.currentAddress.name){
  222. this.isAddressSelected=true
  223. }
  224. this.currentPets = this.$globalData.newOrderData.currentPets
  225. if(this.currentPets&&this.currentPets.length>0){
  226. this.isPetSelected=true
  227. }
  228. this.needPreFamiliarize = this.$globalData.newOrderData.needPreFamiliarize
  229. // 初始化伴宠师等级
  230. if(this.$globalData.newOrderData.companionLevel) {
  231. this.companionLevel = this.$globalData.newOrderData.companionLevel
  232. }
  233. },
  234. methods:{
  235. selectAddress(){
  236. uni.navigateTo({
  237. url: "/pages/newOrder/addressList"
  238. });
  239. },
  240. selectPet(){
  241. uni.navigateTo({
  242. url: "/pages/newOrder/petList"
  243. });
  244. },
  245. selectCompanionLevel(level) {
  246. this.companionLevel = level;
  247. // 将选择的伴宠师等级保存到全局数据
  248. this.$globalData.newOrderData.companionLevel = level;
  249. },
  250. showCompanionInfo(level) {
  251. if(level === 'junior') {
  252. this.popupTitle = '初级伴宠师';
  253. this.popupLevel = '初级伴宠师';
  254. } else {
  255. this.popupTitle = '高级伴宠师';
  256. this.popupLevel = '高级伴宠师';
  257. }
  258. this.$refs.companionInfoPopup.open();
  259. },
  260. closeCompanionInfo() {
  261. this.$refs.companionInfoPopup.close();
  262. },
  263. getProductList() {
  264. getProductList({
  265. "publishStatus": 1,
  266. "categoryId": 76,
  267. "needSku": true
  268. }).then(response => {
  269. if (response && response.content && response.content.length > 0) {
  270. const skus = response && response.content[0].skus
  271. if(skus && skus.length>0){
  272. let productSku = {
  273. "skuId": skus[0].id,
  274. "price":skus[0].price,
  275. "name":response.content[0].name,
  276. "quantity": 1,
  277. "isMainProduct":true
  278. }
  279. this.$globalData.mainSku = [productSku]
  280. }
  281. }else {
  282. uni.showToast('获取主产品失败,请联系管理员')
  283. }
  284. console.log(response);
  285. })
  286. },
  287. login() {
  288. uni.login({
  289. provider: 'weixin',
  290. success: (loginRes) => {
  291. this.getOpenId(loginRes.code)
  292. },
  293. fail: function(error) {
  294. // 授权失败处理
  295. uni.showToast('授权失败,请授权后再试')
  296. }
  297. });
  298. },
  299. getOpenId(code) {
  300. getOpenId(code).then(res => {
  301. if (res.code == 200 && res.data) {
  302. let resData = JSON.parse(res.data)
  303. let token = resData.token;
  304. let openId = resData.openId;
  305. setOpenIdKey(openId)
  306. if(token){
  307. setToken(token)
  308. }
  309. }
  310. })
  311. },
  312. goNext(){
  313. console.log(this.needPreFamiliarize)
  314. if(!this.isAddressSelected) {
  315. this.$modal.showToast('请选择服务地址');
  316. return;
  317. }
  318. if(!this.isPetSelected) {
  319. this.$modal.showToast('请选择宠物');
  320. return;
  321. }
  322. this.$globalData.newOrderData.needPreFamiliarize = this.needPreFamiliarize
  323. uni.navigateTo({
  324. url: "/pages/newOrder/serviceNew2"
  325. });
  326. console.log(this.$globalData.newOrderData)
  327. },
  328. getSelectedDateString(selectDate){
  329. //显示日期为01/01;01/02;
  330. if(!selectDate || selectDate.length === 0) return '';
  331. return selectDate.map(date => {
  332. // 从日期字符串中提取月和日
  333. const [,month, day] = date.date.split('-');
  334. return `${month}/${day}`;
  335. }).join(';');
  336. }
  337. }
  338. }
  339. </script>
  340. <style scoped lang="less">
  341. .container {
  342. position: relative;
  343. height: 100%;
  344. padding-bottom: 78px;
  345. .order-type-select {
  346. padding: 20rpx 30rpx;
  347. margin-bottom: 20rpx;
  348. .order-type-title {
  349. background-color: #FFF9F0;
  350. display: flex;
  351. align-items: center;
  352. font-size: 28rpx;
  353. color: #333;
  354. margin-bottom: 20rpx;
  355. padding: 20rpx;
  356. border-radius: 40rpx;
  357. }
  358. .order-type-options {
  359. display: flex;
  360. justify-content: space-between;
  361. margin-top: 20rpx;
  362. .order-type-option {
  363. display: flex;
  364. align-items: center;
  365. width: 48%;
  366. height: 80rpx;
  367. background-color: #FFFFFF;
  368. border-radius: 40rpx;
  369. padding: 0 20rpx;
  370. font-size: 28rpx;
  371. color: #666;
  372. position: relative;
  373. border: 2rpx solid transparent;
  374. &.active {
  375. border: 2rpx solid #FFB13F;
  376. background-color: #FFF5E5;
  377. }
  378. .info-icon {
  379. position: absolute;
  380. right: 20rpx;
  381. }
  382. }
  383. }
  384. }
  385. .companion-info-popup {
  386. width: 600rpx;
  387. background-color: #FFFFFF;
  388. border-radius: 20rpx;
  389. padding: 40rpx;
  390. position: relative;
  391. &::after {
  392. content: '';
  393. display: flex;
  394. position: absolute;
  395. top: 0rpx;
  396. left: 0;
  397. width: 100%;
  398. height: 100rpx;
  399. background-color: #FFB13F;
  400. }
  401. .companion-info-title {
  402. font-size: 32rpx;
  403. font-weight: bold;
  404. color: #fff;
  405. text-align: center;
  406. border-bottom: 1rpx solid #EFEFEF;
  407. position: relative;
  408. z-index: 2;
  409. height: 100rpx;
  410. }
  411. .companion-info-content {
  412. .companion-info-item {
  413. margin-bottom: 40rpx;
  414. .companion-info-label {
  415. font-size: 28rpx;
  416. color: #666;
  417. margin-right: 10rpx;
  418. }
  419. .companion-info-value {
  420. font-size: 28rpx;
  421. color: #333;
  422. }
  423. }
  424. }
  425. .companion-info-close {
  426. position: absolute;
  427. bottom: -80rpx;
  428. left: 50%;
  429. transform: translateX(-50%);
  430. width: 80rpx;
  431. height: 80rpx;
  432. border-radius: 50%;
  433. display: flex;
  434. align-items: center;
  435. justify-content: center;
  436. }
  437. }
  438. .details-subscribe {
  439. background-color: #FFFFFF;
  440. padding: 10px;
  441. width: 100%;
  442. height: 78px;
  443. position: fixed;
  444. bottom: 0;
  445. z-index: 100;
  446. .details-btn {
  447. width: 100%;
  448. border-radius: 6px;
  449. background: #FFB13F;
  450. font-size: 16px;
  451. color: #FFFFFF;
  452. }
  453. }
  454. }
  455. .service-new{
  456. .service-new-flag {
  457. width: 8rpx;
  458. height: 32rpx;
  459. background: #FFBF60;
  460. border-radius: 30rpx 30rpx 30rpx 30rpx;
  461. margin-right: 10rpx;
  462. }
  463. .split-line{
  464. width: 100%;
  465. height: 1rpx;
  466. background: #EFEFEF;
  467. }
  468. .service-new-title{
  469. display: flex;
  470. font-weight: 500;
  471. font-size: 28rpx;
  472. color: #333333;
  473. line-height: 33rpx;
  474. margin: 42rpx 0 30rpx;
  475. justify-content: space-between;
  476. .service-new-title-left{
  477. display: flex;
  478. align-items: center;
  479. }
  480. }
  481. .service-new-unselect{
  482. height: 156rpx;
  483. display: flex;
  484. justify-content: center;
  485. align-items: center;
  486. }
  487. .add-pet{
  488. font-weight: 400;
  489. font-size: 28rpx;
  490. color: #FFAA48;
  491. line-height: 40rpx;
  492. display: flex;
  493. align-items: center;
  494. }
  495. .service-new-details-desc{
  496. font-weight: 400;
  497. font-size: 24rpx;
  498. color: #A94F20;
  499. line-height: 28rpx;
  500. text-align: left;
  501. padding: 26rpx 0;
  502. }
  503. .personal-address-info{
  504. display: flex;
  505. align-items: center;
  506. justify-content: flex-start;
  507. flex-wrap: wrap;
  508. margin: 32rpx 0;
  509. width: 80%;
  510. .personal-address-text{
  511. color: #333;
  512. font-size: 28rpx;
  513. font-weight: bold;
  514. width: 100%;
  515. }
  516. .personal-address-people{
  517. color: #7D8196;
  518. font-size: 28rpx;
  519. font-weight: 400;
  520. display: flex;
  521. justify-content: flex-start;
  522. align-items: center;
  523. }
  524. }
  525. .service-new-address-selected{
  526. display: flex;
  527. justify-content: space-between;
  528. align-items: center;
  529. }
  530. }
  531. .personal-pet-list {
  532. margin-top: 20rpx;
  533. .personal-pet-list-item {
  534. margin-bottom: 20rpx;
  535. background-color: #F9F9F9;
  536. height: 172rpx;
  537. border-radius: 8rpx;
  538. .personal-pet-info {
  539. height: 100%;
  540. display: flex;
  541. align-items: center;
  542. padding: 0 20rpx;
  543. }
  544. }
  545. }
  546. </style>