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.

737 lines
20 KiB

  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. <view class="order-type-select"
  28. style="padding-bottom: 0rpx;"
  29. v-if="buyInfo.teacher">
  30. <view class="order-type-title order-type-title-custom"
  31. style="border-radius: 10rpx;">
  32. <view class="order-type-title-main"
  33. style="padding-left: 10rpx;">
  34. <image style="width: 40rpx; height: 40rpx; margin-right: 10rpx;" src="https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/petServiceOrder/OrderIcon.png"></image>
  35. <view class="main-title">
  36. 下单方式指定喂养员 - {{buyInfo.teacher.userName}}
  37. </view>
  38. </view>
  39. <view class="sub-title">
  40. 若伴宠师1小时内无响应或拒绝单则系统派单
  41. </view>
  42. </view>
  43. </view>
  44. <uni-popup ref="companionInfoPopup" type="center">
  45. <view class="companion-info-popup">
  46. <view class="companion-info-title">
  47. <text>{{ popupTitle }}</text>
  48. </view>
  49. <view class="companion-info-content">
  50. <view class="companion-info-item">
  51. <text class="companion-info-label">等级:</text>
  52. <text class="companion-info-value">{{ popupLevel }}</text>
  53. </view>
  54. <view class="companion-info-item">
  55. <text class="companion-info-label">价格:</text>
  56. <text class="companion-info-value">要根据规城市不同展示不同的价格</text>
  57. </view>
  58. <view class="companion-info-item">
  59. <text class="companion-info-label">分类标准:</text>
  60. <text class="companion-info-value">文字描述初级是什么类型的高级是什么类型的 :)</text>
  61. </view>
  62. </view>
  63. <view class="companion-info-close" @click="closeCompanionInfo">
  64. <uni-icons type="close" size="24" color="#fff"></uni-icons>
  65. </view>
  66. </view>
  67. </uni-popup>
  68. <view class="service-new-address">
  69. <uni-card padding=0 :is-shadow="false">
  70. <view class="service-new-title" slot="title">
  71. <view class="service-new-title-left">
  72. <view class="service-new-flag"></view>
  73. <view>服务地址</view>
  74. </view>
  75. </view>
  76. <view class="split-line"></view>
  77. <view class="service-new-address-content">
  78. <view v-if="isAddressSelected" class="service-new-address-selected" >
  79. <view class="personal-address-info">
  80. <view class="personal-address-text">
  81. {{currentAddress.province}} {{currentAddress.city}} {{currentAddress.detailAddress}}
  82. </view>
  83. <view class="personal-address-people">
  84. <view>
  85. {{currentAddress.name}}
  86. </view>
  87. <view style="border: solid #7D8196 1px; margin: 0 10px; height: 12px;"> </view>
  88. <view>
  89. {{currentAddress.phone}}
  90. </view>
  91. </view>
  92. </view>
  93. <view>
  94. <uni-icons type="right" size="28rpx" color="#AAA" @click="selectAddress"></uni-icons>
  95. </view>
  96. </view>
  97. <view v-else class="service-new-unselect">
  98. <view style="width: 50%;">
  99. <u-button color="#FFBF60" icon="plus-circle-fill" text="添加地址" shape="circle" plain @click="selectAddress">
  100. </u-button>
  101. </view>
  102. </view>
  103. </view>
  104. </uni-card>
  105. </view>
  106. <view class="service-new-pet">
  107. <uni-card padding=0 :is-shadow="false">
  108. <view class="service-new-title" slot="title">
  109. <view class="service-new-title-left">
  110. <view class="service-new-flag">
  111. </view>
  112. <view class="service-new-title-text">
  113. 服务宠物
  114. </view>
  115. </view>
  116. <view v-if="isPetSelected" class="add-pet" @click="selectPet">
  117. <u-icon name="plus-circle-fill" color="#FFBF60" size="28rpx" style="margin-right: 10rpx;"></u-icon>
  118. 添加宠物
  119. </view>
  120. </view>
  121. <view class="split-line"></view>
  122. <view class="service-new-pet-content">
  123. <view v-if="isPetSelected" class="personal-pet-list">
  124. <view v-for="(item,index) in currentPets" :key="index">
  125. <view class="personal-pet-list-item">
  126. <view class="personal-pet-info">
  127. <!-- 左侧头像 -->
  128. <view class="pet-avatar">
  129. <u-avatar :src="item.photo?item.photo:defaultPhoto" size="60" shape="circle"></u-avatar>
  130. </view>
  131. <!-- 中间内容 -->
  132. <view class="pet-info" style="flex: 1; margin: 0 20rpx; max-width: 50%;">
  133. <view class="pet-name-gender" style="display: flex; align-items: center;">
  134. <view>{{item.name}}</view>
  135. <view class="pet-gender" style="margin-left: 10rpx; display: flex;align-items: center;">
  136. <img :src="item.gender=='男生'?'../../static/images/details/boy.svg':'../../static/images/details/girl.svg'" alt="sex"
  137. style="width: 16px;height: 16px;"/>
  138. </view>
  139. </view>
  140. <view class="pet-dates ellipsis" >
  141. {{ getSelectedDateString(item.selectedDate) }}
  142. </view>
  143. </view>
  144. <!-- 右侧天数统计 -->
  145. <view class="date-total" style="margin-left: auto;width: 140rpx;text-align: end;">
  146. {{item.selectedDate.length}}
  147. <uni-icons type="right" size="28rpx" color="#AAA" @click="selectPet"></uni-icons>
  148. </view>
  149. </view>
  150. </view>
  151. </view>
  152. </view>
  153. <view v-else class="service-new-unselect">
  154. <view style="width: 50%;">
  155. <u-button color="#FFBF60" icon="plus-circle-fill" text="添加宠物" shape="circle" plain @click="selectPet">
  156. </u-button>
  157. </view>
  158. </view>
  159. </view>
  160. </uni-card>
  161. </view>
  162. <view class="service-new-pet">
  163. <uni-card padding=0 :is-shadow="false">
  164. <view class="service-new-title" slot="title">
  165. <view class="service-new-title-left">
  166. <view class="service-new-flag">
  167. </view>
  168. <view class="service-new-title-text">
  169. 服务细则
  170. </view>
  171. </view>
  172. </view>
  173. <view class="split-line"></view>
  174. <view class="service-new-details-content">
  175. <view style="margin: 30rpx 0;">
  176. <u-checkbox-group
  177. v-model="needPreFamiliarize"
  178. iconPlacement="right"
  179. placement="column">
  180. <u-checkbox activeColor="#FFBF60" label="是否提前熟悉" name="是否提前熟悉" shape="circle"></u-checkbox>
  181. </u-checkbox-group>
  182. </view>
  183. <view class="split-line"></view>
  184. <view class="service-new-details-desc">
  185. <view style="display: flex;">
  186. <text style="width: 20rpx;">*</text>
  187. <text style="flex: 1;">价格{{ priceConfig.preFamiliarize.price }}/</text>
  188. </view>
  189. <view style="display: flex; margin: 20rpx 0;">
  190. <text style="width: 20rpx;">*</text>
  191. <text style="flex: 1;">服务内容: 购买此服务后伴宠师将在您离家前按照约定日期提前上门沟通熟悉喂养要求及宠物</text>
  192. </view>
  193. <view style="display: flex;">
  194. <text style="width: 20rpx;">*</text>
  195. <text style="flex: 1;">服务保障: 购买此服务后平台支持在提前熟悉后上门服务第一天前无理由免费更换伴宠师1次</text>
  196. </view>
  197. </view>
  198. </view>
  199. </uni-card>
  200. </view>
  201. <view class="details-subscribe">
  202. <button class="details-btn" @click="goNext">下一步</button>
  203. </view>
  204. </view>
  205. </template>
  206. <script>
  207. import {
  208. getProductList,
  209. getOpenId
  210. } from "@/api/system/user"
  211. import { setToken,getToken,getOpenIdKey,setOpenIdKey } from '@/utils/auth'
  212. export default {
  213. data()
  214. {
  215. return {
  216. isAddressSelected:false,
  217. currentAddress:{},
  218. isPetSelected:false,
  219. currentPets:[],
  220. needPreFamiliarize:[],
  221. defaultPhoto:'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/pet/catdog.png',
  222. companionLevel: 'junior', // 默认选择初级伴宠师
  223. companionLevelList: ['', 'junior', 'senior'], // 默认选择初级伴宠师
  224. popupTitle: '',
  225. popupLevel: '',
  226. // 购买信息 - 包含指定喂养员信息
  227. buyInfo: {
  228. teacher: null
  229. },
  230. // 价格配置 - 与其他页面保持一致
  231. priceConfig: {
  232. // 基础价格配置
  233. basePrice: {
  234. normal: 75, // 普通价格
  235. holiday: 85, // 节假日价格
  236. weekend: 80 // 周末价格
  237. },
  238. // 会员折扣配置
  239. memberDiscount: {
  240. 'new': 0.95, // 新晋家长9.5折
  241. 'regular': 0.9, // 普卡会员9折
  242. 'silver': 0.88, // 银卡会员8.8折
  243. 'gold': 0.85 // 金卡会员8.5折
  244. },
  245. // 提前熟悉费用配置
  246. preFamiliarize: {
  247. price: 40, // 基础价格
  248. holidayRate: 1.2 // 节假日倍率
  249. },
  250. // 多次服务费用配置
  251. multiService: {
  252. two: {
  253. price: 45, // 一天两次基础费用
  254. holidayRate: 1.1 // 节假日倍率
  255. },
  256. three: {
  257. price: 130, // 一天三次基础费用
  258. holidayRate: 1.1 // 节假日倍率
  259. }
  260. },
  261. // 宠物额外费用配置
  262. petExtra: {
  263. largeDog: {
  264. price: 40, // 大型犬基础费用
  265. holidayRate: 1.1
  266. },
  267. mediumDog: {
  268. price: 30, // 中型犬基础费用
  269. holidayRate: 1.1
  270. },
  271. smallDog: {
  272. price: 15, // 小型犬基础费用
  273. holidayRate: 1.1
  274. },
  275. cat: {
  276. price: 10, // 猫基础费用
  277. holidayRate: 1.1
  278. }
  279. },
  280. // 套餐免费额度配置
  281. freeQuota: {
  282. threshold: 30, // 免费阈值金额
  283. rules: [
  284. {
  285. type: 'cat',
  286. count: 3,
  287. freeAmount: 30,
  288. description: '3只及以上猫免费30元'
  289. },
  290. {
  291. type: 'smallDog',
  292. count: 2,
  293. freeAmount: 30,
  294. description: '2只及以上小型犬免费30元'
  295. },
  296. {
  297. type: 'mediumDog',
  298. count: 1,
  299. freeAmount: 30,
  300. description: '1只及以上中型犬免费30元'
  301. },
  302. {
  303. type: 'mixed',
  304. count: 0,
  305. freeAmount: 25,
  306. description: '混合类型免费25元(1猫1小型犬)'
  307. }
  308. ]
  309. },
  310. // 节假日配置 - 后台配置的节假日列表
  311. holidays: [
  312. '2024-07-15', '2024-07-16', '2024-07-17',
  313. '2024-10-01', '2024-10-02', '2024-10-03'
  314. ],
  315. // 周末配置
  316. weekends: [0, 6], // 0=周日, 6=周六
  317. // 定制服务配置
  318. customServices: {
  319. priceConfig: {},
  320. holidayRate: 1.1 // 节假日倍率
  321. },
  322. // 城市差异化配置
  323. cityConfig: {
  324. currentCity: 'default',
  325. priceRates: {
  326. 'beijing': 1.2,
  327. 'shanghai': 1.15,
  328. 'guangzhou': 1.1,
  329. 'shenzhen': 1.15,
  330. 'default': 1.0
  331. }
  332. }
  333. }
  334. }
  335. },
  336. onLoad: function(option) {
  337. },
  338. onShow() {
  339. if (!getToken() || !getOpenIdKey()) {
  340. this.login()
  341. }
  342. if(this.$globalData.mainSku.length < 1 || !this.$globalData.mainSku[0].price){
  343. // 获取主产品
  344. this.getProductList()
  345. }
  346. this.currentAddress = this.$globalData.newOrderData.currentAddress
  347. if(this.currentAddress&&this.currentAddress.name){
  348. this.isAddressSelected=true
  349. }
  350. this.currentPets = this.$globalData.newOrderData.currentPets
  351. if(this.currentPets&&this.currentPets.length>0){
  352. this.isPetSelected=true
  353. }
  354. this.needPreFamiliarize = this.$globalData.newOrderData.needPreFamiliarize
  355. // 初始化购买信息
  356. this.buyInfo = this.$globalData.buyInfo || { teacher: null }
  357. // 初始化伴宠师等级
  358. if(this.$globalData.newOrderData.companionLevel) {
  359. this.companionLevel = this.$globalData.newOrderData.companionLevel
  360. }else{
  361. this.$globalData.newOrderData.companionLevel = this.companionLevel
  362. }
  363. },
  364. methods:{
  365. selectAddress(){
  366. uni.navigateTo({
  367. url: "/pages/newOrder/addressList"
  368. });
  369. },
  370. selectPet(){
  371. uni.navigateTo({
  372. url: "/pages/newOrder/petList"
  373. });
  374. },
  375. selectCompanionLevel(level) {
  376. this.companionLevel = level;
  377. // 将选择的伴宠师等级保存到全局数据
  378. this.$globalData.newOrderData.companionLevel = level;
  379. },
  380. showCompanionInfo(level) {
  381. if(level === 'junior') {
  382. this.popupTitle = '初级伴宠师';
  383. this.popupLevel = '初级伴宠师';
  384. } else {
  385. this.popupTitle = '高级伴宠师';
  386. this.popupLevel = '高级伴宠师';
  387. }
  388. this.$refs.companionInfoPopup.open();
  389. },
  390. closeCompanionInfo() {
  391. this.$refs.companionInfoPopup.close();
  392. },
  393. getProductList() {
  394. getProductList({
  395. "publishStatus": 1,
  396. "categoryId": 76,
  397. "needSku": true
  398. }).then(response => {
  399. if (response && response.content && response.content.length > 0) {
  400. const skus = response && response.content[0].skus
  401. if(skus && skus.length>0){
  402. let productSku = {
  403. "skuId": skus[0].id,
  404. "price":skus[0].price,
  405. "name":response.content[0].name,
  406. "quantity": 1,
  407. "isMainProduct":true
  408. }
  409. this.$globalData.mainSku = [productSku]
  410. }
  411. }else {
  412. uni.showToast('获取主产品失败,请联系管理员')
  413. }
  414. console.log(response);
  415. })
  416. },
  417. login() {
  418. uni.login({
  419. provider: 'weixin',
  420. success: (loginRes) => {
  421. this.getOpenId(loginRes.code)
  422. },
  423. fail: function(error) {
  424. // 授权失败处理
  425. uni.showToast('授权失败,请授权后再试')
  426. }
  427. });
  428. },
  429. getOpenId(code) {
  430. getOpenId(code).then(res => {
  431. if (res.code == 200 && res.data) {
  432. let resData = JSON.parse(res.data)
  433. let token = resData.token;
  434. let openId = resData.openId;
  435. setOpenIdKey(openId)
  436. if(token){
  437. setToken(token)
  438. }
  439. }
  440. })
  441. },
  442. goNext(){
  443. console.log('this.needPreFamiliarize', this.needPreFamiliarize)
  444. if(!this.isAddressSelected) {
  445. this.$modal.showToast('请选择服务地址');
  446. return;
  447. }
  448. if(!this.isPetSelected) {
  449. this.$modal.showToast('请选择宠物');
  450. return;
  451. }
  452. this.$globalData.newOrderData.needPreFamiliarize = this.needPreFamiliarize
  453. uni.navigateTo({
  454. url: "/pages/newOrder/serviceNew2"
  455. });
  456. console.log(this.$globalData.newOrderData)
  457. },
  458. getSelectedDateString(selectDate){
  459. //显示日期为01/01;01/02;
  460. if(!selectDate || selectDate.length === 0) return '';
  461. return selectDate.map(date => {
  462. // 从日期字符串中提取月和日
  463. const [,month, day] = date.date.split('-');
  464. return `${month}/${day}`;
  465. }).join(';');
  466. }
  467. }
  468. }
  469. </script>
  470. <style scoped lang="less">
  471. .container {
  472. position: relative;
  473. height: 100%;
  474. padding-bottom: 78px;
  475. .order-type-select {
  476. padding: 20rpx 30rpx;
  477. margin-bottom: 20rpx;
  478. .order-type-title {
  479. background-color: #FFF9F0;
  480. display: flex;
  481. align-items: center;
  482. font-size: 28rpx;
  483. color: #333;
  484. margin-bottom: 20rpx;
  485. padding: 20rpx;
  486. border-radius: 40rpx;
  487. }
  488. .order-type-options {
  489. display: flex;
  490. justify-content: space-between;
  491. margin-top: 20rpx;
  492. .order-type-option {
  493. display: flex;
  494. align-items: center;
  495. width: 48%;
  496. height: 80rpx;
  497. background-color: #FFFFFF;
  498. border-radius: 40rpx;
  499. padding: 0 20rpx;
  500. font-size: 28rpx;
  501. color: #666;
  502. position: relative;
  503. border: 2rpx solid transparent;
  504. &.active {
  505. border: 2rpx solid #FFB13F;
  506. background-color: #FFF5E5;
  507. }
  508. .info-icon {
  509. position: absolute;
  510. right: 20rpx;
  511. }
  512. }
  513. }
  514. }
  515. .companion-info-popup {
  516. width: 600rpx;
  517. background-color: #FFFFFF;
  518. border-radius: 20rpx;
  519. padding: 40rpx;
  520. position: relative;
  521. &::after {
  522. content: '';
  523. display: flex;
  524. position: absolute;
  525. top: 0rpx;
  526. left: 0;
  527. width: 100%;
  528. height: 100rpx;
  529. background-color: #FFB13F;
  530. }
  531. .companion-info-title {
  532. font-size: 32rpx;
  533. font-weight: bold;
  534. color: #fff;
  535. text-align: center;
  536. border-bottom: 1rpx solid #EFEFEF;
  537. position: relative;
  538. z-index: 2;
  539. height: 100rpx;
  540. }
  541. .companion-info-content {
  542. .companion-info-item {
  543. margin-bottom: 40rpx;
  544. .companion-info-label {
  545. font-size: 28rpx;
  546. color: #666;
  547. margin-right: 10rpx;
  548. }
  549. .companion-info-value {
  550. font-size: 28rpx;
  551. color: #333;
  552. }
  553. }
  554. }
  555. .companion-info-close {
  556. position: absolute;
  557. bottom: -80rpx;
  558. left: 50%;
  559. transform: translateX(-50%);
  560. width: 80rpx;
  561. height: 80rpx;
  562. border-radius: 50%;
  563. display: flex;
  564. align-items: center;
  565. justify-content: center;
  566. }
  567. }
  568. .details-subscribe {
  569. background-color: #FFFFFF;
  570. padding: 10px;
  571. width: 100%;
  572. height: 78px;
  573. position: fixed;
  574. bottom: 0;
  575. z-index: 100;
  576. .details-btn {
  577. width: 100%;
  578. border-radius: 6px;
  579. background: #FFB13F;
  580. font-size: 16px;
  581. color: #FFFFFF;
  582. }
  583. }
  584. }
  585. .service-new{
  586. .service-new-flag {
  587. width: 8rpx;
  588. height: 32rpx;
  589. background: #FFBF60;
  590. border-radius: 30rpx 30rpx 30rpx 30rpx;
  591. margin-right: 10rpx;
  592. }
  593. .split-line{
  594. width: 100%;
  595. height: 1rpx;
  596. background: #EFEFEF;
  597. }
  598. .service-new-title{
  599. display: flex;
  600. font-weight: 500;
  601. font-size: 28rpx;
  602. color: #333333;
  603. line-height: 33rpx;
  604. margin: 42rpx 0 30rpx;
  605. justify-content: space-between;
  606. .service-new-title-left{
  607. display: flex;
  608. align-items: center;
  609. }
  610. }
  611. .service-new-unselect{
  612. height: 156rpx;
  613. display: flex;
  614. justify-content: center;
  615. align-items: center;
  616. }
  617. .add-pet{
  618. font-weight: 400;
  619. font-size: 28rpx;
  620. color: #FFAA48;
  621. line-height: 40rpx;
  622. display: flex;
  623. align-items: center;
  624. }
  625. .service-new-details-desc{
  626. font-weight: 400;
  627. font-size: 24rpx;
  628. color: #A94F20;
  629. line-height: 28rpx;
  630. text-align: left;
  631. padding: 26rpx 0;
  632. }
  633. .personal-address-info{
  634. display: flex;
  635. align-items: center;
  636. justify-content: flex-start;
  637. flex-wrap: wrap;
  638. margin: 32rpx 0;
  639. width: 80%;
  640. .personal-address-text{
  641. color: #333;
  642. font-size: 28rpx;
  643. font-weight: bold;
  644. width: 100%;
  645. }
  646. .personal-address-people{
  647. color: #7D8196;
  648. font-size: 28rpx;
  649. font-weight: 400;
  650. display: flex;
  651. justify-content: flex-start;
  652. align-items: center;
  653. }
  654. }
  655. .service-new-address-selected{
  656. display: flex;
  657. justify-content: space-between;
  658. align-items: center;
  659. }
  660. }
  661. .personal-pet-list {
  662. margin-top: 20rpx;
  663. .personal-pet-list-item {
  664. margin-bottom: 20rpx;
  665. background-color: #F9F9F9;
  666. height: 172rpx;
  667. border-radius: 8rpx;
  668. .personal-pet-info {
  669. height: 100%;
  670. display: flex;
  671. align-items: center;
  672. padding: 0 20rpx;
  673. }
  674. }
  675. }
  676. .order-type-title-custom {
  677. background-color: #FFF9F0;
  678. font-size: 28rpx;
  679. color: #333;
  680. margin-bottom: 20rpx;
  681. padding: 20rpx;
  682. border-radius: 20rpx;
  683. display: flex;
  684. flex-direction: column;
  685. align-items: flex-start !important;
  686. }
  687. .order-type-title-main {
  688. display: flex;
  689. align-items: flex-start;
  690. }
  691. .main-title {
  692. font-size: 28rpx;
  693. font-weight: bold;
  694. line-height: 1.2;
  695. color: #D97B2B;
  696. }
  697. .sub-title {
  698. font-size: 24rpx;
  699. color: #D97B2B;
  700. margin-top: 6rpx;
  701. line-height: 1.2;
  702. }
  703. </style>