checkout.vue 69 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870
  1. <template>
  2. <view class="container">
  3. <view v-if="isNeedAppoint">
  4. <view class="address-box">
  5. <view class="address-item" @tap="selectAddress" v-if="checkedAddress.id > 0">
  6. <image class="map-icon" mode="aspectFit" src="/static/images/address/dingwei.png"></image>
  7. <view class="m">
  8. <text class="address">{{ checkedAddress.addressDetail }}</text>
  9. <view class="address-bottom">
  10. <text class="user-name">{{ checkedAddress.name }}</text>
  11. <text>{{ checkedAddress.tel }}</text>
  12. </view>
  13. </view>
  14. <view class="r">
  15. <van-icon name="arrow" />
  16. </view>
  17. </view>
  18. <view class="address-item address-empty" @tap="selectAddress" v-else>
  19. <view class="m">还没有收货地址,去添加</view>
  20. <view class="r">
  21. <van-icon name="arrow" />
  22. </view>
  23. </view>
  24. </view>
  25. <view style="text-align: right; height: 48rpx; line-height: 48rpx; font-size: 22rpx ;color: #d77958;"
  26. class="jz-color">*请确保服务地址正确,确保服务者顺利上门!</view>
  27. </view>
  28. <!-- 商品详情 -->
  29. <view class="goods-items">
  30. <view class="item" v-for="(item, index) in checkedGoodsList" :key="index">
  31. <!-- <view class="name">{{item.goodsName}}</view> -->
  32. <view style="display: flex">
  33. <view class="img">
  34. <image :src="item.picUrl" mode="aspectFill"></image>
  35. </view>
  36. <view class="info">
  37. <view class="name">{{ item.goodsName }}</view>
  38. <view class="m" style="margin-top: 10rpx">规格:{{ item.specifications[0] }}</view>
  39. <view class="m" v-if="item.goodsType == 4">服务次数:{{ item.product.serviceTimes }}</view>
  40. <view class="m" v-else-if="">购买份数:{{ item.number }}</view>
  41. <view class="b">单价:¥{{ item.price }}</view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <!-- 加购 -->
  47. <view class="plus-order" v-if="increaseSumPrice > 0">
  48. <view class="plus-title">加购</view>
  49. <view class="plus-name">
  50. {{ checkedGoodsList[0].product.specifications }}
  51. <text>x</text>
  52. <!-- <text class="plus-num">{{checkedGoodsList[0].unitPrice}}*{{checkedGoodsList[0].unitIncreaseNumber}}</text> -->
  53. <text class="plus-num">{{ checkedGoodsList[0].unitIncreaseNumber }}</text>
  54. </view>
  55. <view class="plus-amount">{{ increaseSumPrice }}</view>
  56. </view>
  57. <!-- 预约时间 -->
  58. <view class="appoint-time-block" v-if="goodsType != 6 && goodsType != 4 && (isNeedAppoint || couponId == 24)">
  59. <view class="appoint-time-operate"@tap="showAppoint">
  60. <view class="operate-left" v-if="!isFinishAppoint||!isOneAppoint" style="margin: 20rpx 0rpx;">预约上门时段
  61. </view>
  62. <view class="operate-left" v-if="isFinishAppoint&&isOneAppoint">
  63. <text>{{ oneTimeAppoint }}</text>
  64. <view class="" style="margin-top: 20rpx;">
  65. 距离今日<text
  66. style="color: #D77958; display: inline-block;margin-right:4rpx;margin-left: 4rpx;">{{daysDifference}}</text>天
  67. </view>
  68. </view>
  69. <view class="operate-right" >
  70. <text class="not-select" v-if="!isFinishAppoint" style="color: #D77958;">请选择</text>
  71. <text v-if="isFinishAppoint" style="color: #D77958;">更改</text>
  72. <van-icon name="arrow" color="##D77958" />
  73. </view>
  74. </view>
  75. <view class="appoint-time-show" v-if="isFinishAppoint">
  76. <view class="multi-times" v-if="!isOneAppoint">
  77. <view class="multi-times-item">
  78. <text>服务频率</text>
  79. <text>{{ activeTab == 3? '两周一次' : activeTab == 5 ? '一月一次' : '两月一次' }}</text>
  80. </view>
  81. <view class="multi-times-item">
  82. <text>服务时间</text>
  83. <text>{{ selectedDateList[0].weekStr + ' ' + selectedDateList[0].time }}</text>
  84. </view>
  85. <view class="multi-times-item">
  86. <text>首次服务时间</text>
  87. <text>{{ firstAppointList[firstDateIndex].date }}</text>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. <view class="coupon-box">
  93. <!-- 优惠 -->
  94. <view class="discount-title">
  95. <image mode="aspectFit" src="/static/images/new/icon-minus.png"></image>
  96. <text>优惠</text>
  97. </view>
  98. <view class="coupon-item" @tap="selectCoupon">
  99. <view class="l" v-if="couponId == 0">
  100. <text class="name">没有可用的优惠券</text>
  101. <text class="txt">0张</text>
  102. </view>
  103. <view class="l" v-else-if="couponId == -1">
  104. <text class="name">优惠券</text>
  105. <text class="txt">{{ availableCouponLength }}张</text>
  106. </view>
  107. <view class="l" v-else>
  108. <text class="name">优惠券</text>
  109. <text class="txt">{{ couponName }}</text>
  110. </view>
  111. <view class="r">
  112. <van-icon name="arrow" color="#85868A" />
  113. </view>
  114. </view>
  115. <view class="discount-line">
  116. <view class="l">
  117. <text class="name">已选择</text>
  118. <text class="txt">-¥{{ couponPrice }}</text>
  119. </view>
  120. </view>
  121. </view>
  122. <!-- 多次预约结果 -->
  123. <view class="appoint-result" v-if="appointFailTip">
  124. 根据您的预约需求,有
  125. <text class="orange-font">{{ noSerTimes }}</text>
  126. 个日期暂时无法提供预约服务,为您保留
  127. <text class="orange-font">{{ noSerTimes }}</text>
  128. 个保洁次卡,下单成功后在"
  129. <text class="orange-font">我的订单-查看服务</text>
  130. "里预约服务
  131. </view>
  132. <view class="order-box">
  133. <view class="order-item no-border">
  134. <view class="l">
  135. <text class="name">备注</text>
  136. </view>
  137. <view class="r">
  138. <input class="txt message-item" :disabled="remarkDisable" @input="bindMessageInput"
  139. placeholder="如需要,请输入备注信息" :value="message" />
  140. </view>
  141. </view>
  142. </view>
  143. <view class="order-box code-module" v-if="isRecommend">
  144. <view class="order-item no-border">
  145. <view class="l">
  146. <text class="name">推荐码</text>
  147. </view>
  148. <view class="r">
  149. <input
  150. class="txt message-item"
  151. :disabled="remarkDisable"
  152. @input="bindCodeInput"
  153. type="number"
  154. maxlength="9"
  155. placeholder="请输入"
  156. :value="recCode"
  157. />
  158. </view>
  159. </view>
  160. <view class="codeTips" :class="{'no-match': isNoMatch}" v-if="codeShow" :disabled="remarkDisable">
  161. {{recommendTips}}
  162. </view>
  163. </view>
  164. <view class="coupon-price">
  165. 优惠券:
  166. <text>¥{{ couponPrice }}</text>
  167. </view>
  168. <view class="actual-price">
  169. 需支付:
  170. <text>¥{{ actualPrice }}</text>
  171. </view>
  172. <view class="go-pay-wrapper">
  173. <van-button block round @tap="submitOrder" color="#d77958" v-if="!isNeedAppoint">去支付</van-button>
  174. <van-button block round @tap="submitOrdera" color="#d77958" v-else>支付并预约</van-button>
  175. </view>
  176. <!-- custom-style="height: 80%" -->
  177. <van-popup :show="choosePopup" round position="bottom" @click-overlay="onClose">
  178. <view :class="'popup-wrapper ' + (popupType == 1 ? 'popup-wrapper-special' : '')">
  179. <!-- 标题 -->
  180. <view
  181. :class="'popup-title ' + (popupType == 1 ? 'popup-title-special' : '') + ' ' + (popupType == 1 ? 'popup-title-new' : '')">
  182. <view>{{ popupType == 1 ? '选择服务开始时间' : popupType == 2 ? '选择服务频次' : '选择首次上门时段' }}</view>
  183. <view v-if="selectTimeValue >= 17" class="fee-tips">您选的时间段可能会加收夜间服务费,具体以与商家的沟通为准</view>
  184. </view>
  185. <block v-if="popupType == 1">
  186. <view :class="'popup-content ' + (popupType == 1 ? 'popup-content-special' : '')">
  187. <view class="time-select-left">
  188. <view class="time-select-left-item" @tap="dateCheck" :data-week="item.week"
  189. :data-index="index" :data-date="item.date" :data-isbook="item.isBook"
  190. v-for="(item, index) in dateList" :key="index">
  191. <view class="date-line-wrapper">
  192. <view :class="dateIndex == index ? 'current-date' : ''">
  193. {{ item.bookdate + ' ' + item.weekOfDay }}
  194. </view>
  195. <view>
  196. <text v-if="index <= 1" class="date-tag">{{ index == 0 ? '今天' : '明天' }}</text>
  197. </view>
  198. </view>
  199. <view :class="'date-msg ' + (item.dateMsg == '可约' ? 'avail-date' : '')">
  200. {{ item.dateMsg }}
  201. </view>
  202. </view>
  203. </view>
  204. <view class="time-select-right">
  205. <view class="noon-select" v-if="popupType == 1">
  206. <view :class="'noon-item ' + (noonType == '1' ? 'active-noon' : '')" data-noon="1"
  207. @tap="noonTab">上午</view>
  208. <view :class="'noon-item ' + (noonType == '2' ? 'active-noon' : '')" data-noon="2"
  209. @tap="noonTab">下午</view>
  210. </view>
  211. <view class="time-item-wrapper">
  212. <view :class="'time-select-right-item ' + (item.timeMsg ? 'invalid-time' : '')"
  213. @tap="timeCheck" :data-stock="item.stock" :data-index="index"
  214. :data-msg="item.timeMsg" v-for="(item, index) in timeList" :key="index">
  215. <!-- <view class="{{item.stock<=0?'zero-stock':''}}"> -->
  216. <view class="time-line">
  217. <text
  218. :class="(timeIndex === index ? 'current-date' : '') + ' '">{{ item.begin }}</text>
  219. <!-- <text class="stock-text">(库存:{{item.stock}})</text> -->
  220. <text v-if="selectTimeValue >= 17 && timeIndex == index && !item.timeMsg"
  221. class="extra-tips">收夜间服务费</text>
  222. <view v-if="item.timeMsg && item.timeMsg != null" class="time-msg">
  223. {{ item.timeMsg }}
  224. </view>
  225. <view v-if="timeIndex === index" class="date-tag">已选</view>
  226. </view>
  227. </view>
  228. </view>
  229. </view>
  230. </view>
  231. </block>
  232. <!-- 选择频次 -->
  233. <!-- -->
  234. <block v-if="popupType == 2">
  235. <van-tabs title-style="color:red;" v-if="choosePopup" :active="activeTab" color="#d77958" @change="onTabChange" >
  236. <van-tab title="两周一次" name="3"></van-tab>
  237. <van-tab title="一月一次" name="5"></van-tab>
  238. <van-tab title="两月一次" name="6"></van-tab>
  239. </van-tabs>
  240. <view class="popup-content select-week-times">
  241. <view class="time-select-left week-select-left">
  242. <view class="time-select-left-item" @tap="weekCheck" :data-index="index"
  243. v-for="(item, index) in weekArrList" :key="index">
  244. <view :class="'week-str ' + (weekIndex == index ? 'current-date' : '')">{{ item.week }}
  245. </view>
  246. <view class="select-num-tag" v-if="item.num > 0">{{ item.num }}</view>
  247. </view>
  248. </view>
  249. <view class="time-select-right">
  250. <view class="time-select-right-item" @tap="timeSelect" :data-index="index"
  251. :data-time="item.time" v-for="(item, index) in timeList" :key="index">
  252. <view :class="
  253. formatFuc.includeItem(selectedDateList, weekIndex, item.time) && formatFuc.defineIndexOf(selectedWeekList, weekIndex) > -1
  254. ? 'current-date'
  255. : ''
  256. ">
  257. {{ item.time }}
  258. </view>
  259. <view
  260. v-if="formatFuc.includeItem(selectedDateList, weekIndex, item.time) && formatFuc.defineIndexOf(selectedWeekList, weekIndex) > -1"
  261. class="date-tag">
  262. 已选
  263. </view>
  264. </view>
  265. </view>
  266. </view>
  267. </block>
  268. <!-- 选择首次预约时间 -->
  269. <block v-if="popupType == 3">
  270. <view class="popup-content">
  271. <view class="first-appoint-date-list">
  272. <view class="first-appoint-date-item" @tap="firstDateCheck" :data-index="index"
  273. v-for="(item, index) in firstAppointList" :key="index">
  274. <view :class="firstDateIndex == index ? 'current-date' : ''">
  275. {{ item.date + ' ' + item.week }}
  276. </view>
  277. <view v-if="firstDateIndex == index" class="first-time-selected date-tag">已选</view>
  278. </view>
  279. </view>
  280. </view>
  281. </block>
  282. </view>
  283. <!-- 确认按钮 -->
  284. <view :class="'popup-btn-wrapper ' + (popupType == 1 ? 'popup-btn-special' : '')">
  285. <van-button color="#d77958" block round @tap.native="confirmTime">确定</van-button>
  286. </view>
  287. </van-popup>
  288. <!-- 支付失败弹框 -->
  289. <van-overlay :show="payFailShow">
  290. <view class="overlay-wrapper">
  291. <view class="fail-wrapper">
  292. <image src="https://mall.zhaijieshi.cc/file/wx-huawang/bj3.png" mode="" style="width: 100%;height: 300rpx;display: block;"></image>
  293. <image src="https://mall.zhaijieshi.cc/file/wx-huawang/cc.png" style="position: absolute;top: 50rpx; left: 248rpx;width: 161rpx; height: 161rpx;"></image>
  294. <view class="fail-top">
  295. <view class="fail-text">支付失败</view>
  296. <view class="sub-color">支付遇到问题,请尝试重新支付</view>
  297. </view>
  298. <view class="fail-bottom">
  299. <view class="cancel-btn" @tap="cancelPay">取消</view>
  300. <view class="repay-btn" @tap="rePay">重新支付</view>
  301. </view>
  302. </view>
  303. </view>
  304. </van-overlay>
  305. </view>
  306. </template>
  307. <script module="formatFuc" lang="wxs" src="@/utils/formatFuc.wxs"></script>
  308. <script>
  309. var util = require('../../utils/util.js');
  310. var user = require('../../utils/user.js');
  311. var api = require('../../config/api.js');
  312. var check = require('../../utils/check.js');
  313. var app = getApp();
  314. export default {
  315. data() {
  316. return {
  317. traceId: '',
  318. //视频号的traceid
  319. requireOrder: 0,
  320. //视频号 是否需要推单,1:需要,0:不需要
  321. increaseSumPrice: 0,
  322. isRecommend: false,
  323. isNoMatch: true,
  324. codeShow: false,
  325. recCode: '',
  326. recommendTips: '',
  327. memberDiscount: '',
  328. isMember: false,
  329. orderId: '',
  330. payFailShow: false,
  331. choosePopup: false,
  332. noSerTimes: '',
  333. popupType: 1,
  334. //1单次预约 2 选择服务频次 3选择首次预约时间
  335. // timeList: check.getTimeList(1),
  336. timeList: [],
  337. // dateList: util.getDateList(new Date(new Date().getTime() + 60 * 60 * 1000 * 24 * 0), 1, 21),
  338. dateList: [],
  339. // firstAppointList:util.getDateList(new Date(new Date().getTime()+60*60*1000*24),7),
  340. firstAppointList: [],
  341. timeIndex: '',
  342. //选中的时间段
  343. dateIndex: 0,
  344. //单次预约选中的日期
  345. firstDateIndex: 0,
  346. //首次预约时间
  347. activeTab: 5,
  348. //频次
  349. weekIndex: 0,
  350. //选中的周几
  351. weekArrList: [{
  352. id: 1,
  353. week: '周一',
  354. num: 0
  355. },
  356. {
  357. id: 2,
  358. week: '周二',
  359. num: 0
  360. },
  361. {
  362. id: 3,
  363. week: '周三',
  364. num: 0
  365. },
  366. {
  367. id: 4,
  368. week: '周四',
  369. num: 0
  370. },
  371. {
  372. id: 5,
  373. week: '周五',
  374. num: 0
  375. },
  376. {
  377. id: 6,
  378. week: '周六',
  379. num: 0
  380. },
  381. {
  382. id: 0,
  383. week: '周日',
  384. num: 0
  385. }
  386. ],
  387. selectedWeekList: [],
  388. selectedDateList: [],
  389. selectTimeIndex: 'null',
  390. //选中的时间段
  391. oneTimeAppoint: '2021-04-22 周一 13:00-14:00',
  392. isNeedAppoint: false,
  393. //是否需要预约
  394. isFinishAppoint: false,
  395. //已选择预约
  396. isOneAppoint: true,
  397. //单次卡
  398. appointFailTip: false,
  399. //预约失败提示
  400. bookStartDate: '',
  401. //可预约时间段
  402. bookEndDate: '',
  403. multiIndex: [0, 0, 0, 0, 0, 0],
  404. multiArray: [],
  405. array: [],
  406. year: '',
  407. month: '',
  408. day: '',
  409. startHour: '',
  410. endHour: '',
  411. orderData: '',
  412. //此时间为预计上门时间
  413. checkedGoodsList: [],
  414. checkedAddress: {
  415. id: 0,
  416. addressDetail: '',
  417. name: '',
  418. tel: ''
  419. },
  420. availableCouponLength: 0,
  421. // 可用的优惠券数量
  422. goodsTotalPrice: 0,
  423. //商品总价
  424. freightPrice: 0,
  425. //快递费
  426. couponPrice: 0,
  427. //优惠券的价格
  428. grouponPrice: 0,
  429. //团购优惠价格
  430. orderTotalPrice: 0,
  431. //订单总价
  432. actualPrice: 0,
  433. //实际需要支付的总价
  434. cartId: 0,
  435. addressId: 0,
  436. addressMsg: '',
  437. couponId: 0,
  438. userCouponId: 0,
  439. message: '',
  440. grouponLinkId: 0,
  441. //参与的团购
  442. grouponRulesId: 0,
  443. //团购规则ID
  444. nurseId: 0,
  445. //安心包认证id
  446. petinfo: null,
  447. //宠物保险内容
  448. shareId: 0,
  449. userInfo: {},
  450. remarkDisable: false,
  451. fraId: '',
  452. //加盟商id
  453. rId: '',
  454. //阿姨推荐码
  455. channelId: 112,
  456. //渠道id
  457. goodsType: 1,
  458. //商品类型 如果是6 可以不填写预约时间,
  459. serviceDuration: '',
  460. noonType: 1,
  461. selectTimeValue: '',
  462. Varieties: '',
  463. Warehouse: '',
  464. unitIncreaseNumber: '',
  465. weekStr: '',
  466. time: '',
  467. date: '',
  468. daysDifference: '',
  469. appType:0,
  470. couponName:''
  471. };
  472. },
  473. onReady: function() {
  474. // 页面渲染完成
  475. },
  476. onShow: function() {
  477. // 页面显示
  478. user.checkLogin()
  479. .then((res) => {
  480. app.globalData.hasLogin = true;
  481. console.info('session 未过期');
  482. })
  483. .catch(() => {
  484. console.info('session 过期');
  485. app.globalData.hasLogin = false;
  486. uni.navigateTo({
  487. url: '/pages/auth/login/login'
  488. });
  489. });
  490. uni.showLoading({
  491. title: '加载中...'
  492. });
  493. try {
  494. var cartId = uni.getStorageSync('cartId');
  495. if (cartId === '') {
  496. cartId = 0;
  497. }
  498. var addressId = uni.getStorageSync('addressId');
  499. if (addressId === '') {
  500. addressId = 0;
  501. }else if (typeof addressId === 'number') {
  502. } else if ( (typeof addressId === 'string'&& addressId.indexOf("{") !== -1)||addressId.length>20) {
  503. addressId = JSON.parse(addressId).id;
  504. }
  505. var couponId = uni.getStorageSync('couponId');
  506. if (couponId === '') {
  507. couponId = 0;
  508. }
  509. var userCouponId = uni.getStorageSync('userCouponId');
  510. if (userCouponId === '') {
  511. userCouponId = 0;
  512. }
  513. var grouponRulesId = uni.getStorageSync('grouponRulesId');
  514. if (grouponRulesId === '') {
  515. grouponRulesId = 0;
  516. }
  517. var grouponLinkId = uni.getStorageSync('grouponLinkId');
  518. if (grouponLinkId === '') {
  519. grouponLinkId = 0;
  520. }
  521. //客户点选的预约动作
  522. var appType = uni.getStorageSync('appType');
  523. console.info(appType);
  524. this.setData({
  525. cartId: cartId,
  526. addressId: addressId,
  527. couponId: couponId,
  528. userCouponId: userCouponId,
  529. grouponRulesId: grouponRulesId,
  530. grouponLinkId: grouponLinkId,
  531. appType:appType
  532. });
  533. this.getCheckoutInfo(appType);
  534. } catch (e) {
  535. console.log('CatchClause', e);
  536. // Do something when catch error
  537. console.log(e);
  538. }
  539. },
  540. onHide: function() {
  541. // 页面隐藏
  542. },
  543. onUnload: function() {
  544. // 页面关闭
  545. //清空宠物保险的缓存数据
  546. console.info('checkout onload');
  547. //wx.setStorageSync('petinfo'+this.data.cartId, null);
  548. },
  549. /**
  550. * 生命周期函数--监听页面加载
  551. */
  552. onLoad: function(options) {
  553. this.setData({
  554. userInfo: app.globalData.userInfo
  555. });
  556. let that = this;
  557. if (options.nurseId) {
  558. this.setData({
  559. nurseId: options.nurseId
  560. });
  561. }
  562. var rId = uni.getStorageSync('rId');
  563. if (rId) {
  564. this.setData({
  565. rId: rId,
  566. recCode: rId
  567. });
  568. }
  569. var fraId = uni.getStorageSync('fraId');
  570. if (fraId) {
  571. this.setData({
  572. fraId: fraId
  573. });
  574. }
  575. var channelId = uni.getStorageSync('channelId');
  576. if (channelId) {
  577. this.setData({
  578. channelId: parseInt(channelId)
  579. });
  580. }
  581. if (typeof options.shareId != 'undefined' && options.shareId > 0) {
  582. that.setData({
  583. shareId: options.shareId
  584. });
  585. }
  586. //视频号,校验 wx.checkBeforeAddOrder
  587. uni.checkBeforeAddOrder({
  588. success(res) {
  589. console.log('checkBeforeAddOrder-success:', res);
  590. if (res.data.errcode == 0) {
  591. that.setData({
  592. traceId: res.data.traceId,
  593. requireOrder: res.data.requireOrder
  594. });
  595. }
  596. },
  597. fail(res) {
  598. console.log('checkBeforeAddOrder-fail:', res);
  599. }
  600. });
  601. var date = new Date();
  602. var year = date.getFullYear();
  603. var month = date.getMonth() + 1;
  604. var day = date.getDate();
  605. var hour = date.getHours();
  606. var surplusMonth = that.surplusMonth(year);
  607. console.log(surplusMonth);
  608. var surplusDay = this.surplusDay(year, month, day);
  609. console.log(surplusDay);
  610. var surplusHour = this.surplusHour(year, month, day, hour);
  611. console.log(surplusHour);
  612. //初始化picker
  613. that.setData({
  614. multiArray: [
  615. [year + '年', year + 1 + '年', year + 2 + '年'], surplusMonth, surplusDay, surplusHour[0],
  616. ['~'], surplusHour[1]
  617. ],
  618. year: year,
  619. month: month,
  620. day: day,
  621. startHour: surplusHour[0][0],
  622. endHour: surplusHour[1][0]
  623. });
  624. },
  625. methods: {
  626. //获取checkou信息
  627. getCheckoutInfo: function(appType) {
  628. let that = this;
  629. util.request(api.CartCheckout, {
  630. cartId: that.cartId,
  631. addressId: that.addressId,
  632. couponId: that.couponId,
  633. userCouponId: that.userCouponId,
  634. grouponRulesId: that.grouponRulesId,
  635. shareId: that.shareId,
  636. createOrderType:that.appType
  637. }).then(function(res) {
  638. console.log("1aaa", res);
  639. if (res.errno === 0) {
  640. that.setData({
  641. isRecommend: res.data.checkedGoodsList[0].goods.attribute != 1,
  642. isMember: res.data.isMember,
  643. memberDiscount: res.data.memberDiscount,
  644. checkedGoodsList: res.data.checkedGoodsList,
  645. checkedAddress: res.data.checkedAddress,
  646. availableCouponLength: res.data.availableCouponLength,
  647. actualPrice: res.data.actualPrice,
  648. couponPrice: res.data.couponPrice,
  649. grouponPrice: res.data.grouponPrice,
  650. freightPrice: res.data.freightPrice,
  651. goodsTotalPrice: res.data.goodsTotalPrice,
  652. orderTotalPrice: res.data.orderTotalPrice,
  653. addressId: res.data.addressId,
  654. addressMsg: res.data.addressMsg,
  655. couponId: res.data.couponId,
  656. userCouponId: res.data.userCouponId,
  657. grouponRulesId: res.data.grouponRulesId,
  658. isNeedAppoint: appType == '1' ? true : false,
  659. //0需要预约 服务类商品,1保险 2中介 3买约分离次卡res.data.checkedGoodsList[0].goods.type === 0 ||
  660. isOneAppoint: res.data.checkedGoodsList[0].product.serviceTimes == 1 ?
  661. true : false,
  662. //1为单次,其余为多次
  663. popupType: res.data.checkedGoodsList[0].product.serviceTimes == 1 ? 1 : 2,
  664. bookStartDate: res.data.bookStartDate,
  665. bookEndDate: res.data.bookEndDate,
  666. goodsType: res.data.goodsType,
  667. increaseSumPrice: res.data.increaseSumPrice,
  668. serviceDuration: res.data.serviceDuration,
  669. couponName:res.data.couponName
  670. });
  671. let serviceDuration = res.data.checkedGoodsList[0].product.serviceDuration;
  672. if (that.popupType == 2) {
  673. let timeList = [];
  674. if (res.data.timeRange != null && res.data.timeRange.length > 0) {
  675. res.data.timeRange.forEach((time, index) => {
  676. timeList.push({
  677. id: index + 1,
  678. time: time
  679. });
  680. });
  681. } else {
  682. timeList = check.getTimeList(serviceDuration);
  683. }
  684. that.setData({
  685. timeList: timeList
  686. });
  687. }
  688. if (res.data.addressId == null && res.data.addressMsg != null) {
  689. uni.showToast({
  690. title: res.data.addressMsg,
  691. icon: 'none',
  692. duration: 2000
  693. });
  694. }
  695. // that.LimitCanAppointmentDate();
  696. }
  697. uni.hideLoading();
  698. });
  699. },
  700. LimitCanAppointmentDate() {
  701. //特殊商品 如果需要限制可预约的时间范围 在次方法中实现
  702. if (this.checkedGoodsList[0].goodsId == 1190332) {
  703. let dates = [];
  704. this.dateList.forEach((item) => {
  705. if (item.date < '2022-04-01') {
  706. dates.push(item);
  707. }
  708. });
  709. this.setData({
  710. dateList: dates
  711. });
  712. }
  713. //控制可预约时间范围
  714. let that = this;
  715. if (that.bookStartDate) {
  716. let dates = [];
  717. let dateIndex = -1;
  718. that.dateList.forEach((item, index) => {
  719. if (item.date < that.bookStartDate || item.date > that.bookEndDate) {
  720. item.isBook = false;
  721. item.mark = '不可约';
  722. } else {
  723. //设置第一个可预约的时间index
  724. if (dateIndex < 0) {
  725. dateIndex = index;
  726. }
  727. }
  728. dates.push(item);
  729. });
  730. that.setData({
  731. dateList: dates,
  732. dateIndex: dateIndex
  733. });
  734. }
  735. console.info(that.dateList);
  736. console.info(that.dateIndex);
  737. //设置默认起始可预约 index:dateIndex 近7天如果有周六 周日 不允许预约
  738. //存在一种情况 如果今天是周四,如果起始index=2 则周日允许预约 虽然页面显示为”约满"
  739. // if(this.data.dateList[3].id==0) {
  740. // console.info(" dateIndex:4")
  741. // this.setData({
  742. // dateIndex:4
  743. // })
  744. // }else{
  745. // if(this.data.dateList[2].id==0) {
  746. // console.info(" dateIndex:3")
  747. // this.setData({
  748. // dateIndex:3
  749. // })
  750. // }
  751. // }
  752. },
  753. selectAddress() {
  754. uni.navigateTo({
  755. url: '/pages/ucenter/address/address'
  756. });
  757. },
  758. selectCoupon() {
  759. uni.navigateTo({
  760. url: '/pages/ucenter/couponSelect/couponSelect'
  761. });
  762. },
  763. bindMessageInput: function(e) {
  764. this.setData({
  765. message: e.detail.value
  766. });
  767. },
  768. bindCodeInput: function(e) {
  769. this.setData({
  770. recCode: e.detail.value
  771. });
  772. if (e.detail.value.length == 5) {
  773. // 校验服务者真实性
  774. this.recCodeCheck();
  775. // this.setData({
  776. // codeShow:true
  777. // })
  778. } else {
  779. this.setData({
  780. codeShow: false
  781. });
  782. }
  783. },
  784. recCodeCheck() {
  785. uni.showLoading({
  786. title: '加载中'
  787. });
  788. util.request(
  789. api.checkRecommend, {
  790. recCode: this.recCode
  791. },
  792. 'GET'
  793. )
  794. .then((res) => {
  795. uni.hideLoading();
  796. if (res.errno == 0) {
  797. if (res.data) {
  798. this.setData({
  799. codeShow: true,
  800. isNoMatch: false,
  801. recommendTips: '推荐人:' + res.data
  802. });
  803. } else {
  804. this.setData({
  805. codeShow: true,
  806. isNoMatch: true,
  807. recommendTips: '未匹配到推荐者,请您和推荐人核对'
  808. });
  809. }
  810. } else {
  811. this.setData({
  812. codeShow: false
  813. });
  814. uni.showToast({
  815. title: res.errmsg,
  816. icon: 'none',
  817. duration: 2000
  818. });
  819. }
  820. })
  821. .catch(function(err) {
  822. uni.hideLoading();
  823. this.setData({
  824. codeShow: false
  825. });
  826. uni.showToast({
  827. title: err.errMsg,
  828. icon: 'none'
  829. });
  830. });
  831. },
  832. submitOrder: function() {
  833. console.log("submitOrder");
  834. let that = this;
  835. // if (that.addressId <= 0) {
  836. // console.log("无地址");
  837. // //所选地址无服务门店,或选择其他地址
  838. // let errmsg = that.addressMsg == '' ? '请选择收货地址' : that.addressMsg;
  839. // //util.showErrorToast(errmsg);
  840. // uni.showModal({
  841. // title: '提示',
  842. // content: errmsg,
  843. // showCancel: false,
  844. // confirmColor: '#D77958',
  845. // });
  846. // return;
  847. // }
  848. // 检查是否已经预约
  849. if (that.goodsType != 6 && that.goodsType != 4 && that.isNeedAppoint && !that.isFinishAppoint) {
  850. // util.showErrorToast('请先预约服务时间');
  851. uni.showToast({
  852. title: '请先预约服务时间',
  853. icon: 'none',
  854. duration: 2000
  855. });
  856. return;
  857. }
  858. // uni.showLoading({
  859. // title: '检测中'
  860. // });
  861. that.submitInfo();
  862. },
  863. submitOrdera: function() {
  864. console.log("submitOrder");
  865. let that = this;
  866. if (that.addressId <= 0) {
  867. console.log("无地址");
  868. //所选地址无服务门店,或选择其他地址
  869. let errmsg = that.addressMsg == '' ? '请选择收货地址' : that.addressMsg;
  870. //util.showErrorToast(errmsg);
  871. uni.showModal({
  872. title: '提示',
  873. content: errmsg,
  874. showCancel: false,
  875. confirmColor: '#D77958',
  876. });
  877. return;
  878. }
  879. // 检查是否已经预约
  880. if (that.goodsType != 6 && that.goodsType != 4 && that.isNeedAppoint && !that.isFinishAppoint) {
  881. // util.showErrorToast('请先预约服务时间');
  882. uni.showToast({
  883. title: '请先预约服务时间',
  884. icon: 'none',
  885. duration: 2000
  886. });
  887. return;
  888. }
  889. // uni.showLoading({
  890. // title: '检测中'
  891. // });
  892. that.submitInfo();
  893. },
  894. submitInfo() {
  895. // 如果是多次卡先预估,单次卡不用预估
  896. console.log("submitInfo");
  897. if (!this.isOneAppoint) {
  898. console.log("submitInfo1");
  899. let weeks = [];
  900. this.selectedDateList.forEach((item) => {
  901. let obj = {
  902. dayOfWeek: this.weekArrList[item.week].id,
  903. startTime: item.time.split('-')[0],
  904. endTime: item.time.split('-')[1]
  905. };
  906. weeks.push(obj);
  907. });
  908. let tempStartDate = null;
  909. if (this.firstAppointList.length != 0 && this.firstAppointList.length >= this.firstDateIndex) {
  910. tempStartDate = this.firstAppointList[this.firstDateIndex].date;
  911. }
  912. let params = {
  913. weeks: weeks,
  914. type: this.activeTab,
  915. startDate: tempStartDate,
  916. //this.data.firstAppointList[this.data.firstDateIndex].date,
  917. lng: this.checkedAddress.lng,
  918. lat: this.checkedAddress.lat,
  919. shopId: this.checkedAddress.shopId,
  920. goodId: this.checkedGoodsList[0].goodsId
  921. };
  922. console.log(params);
  923. this.orderPay(params);
  924. } else {
  925. console.log("submitInfo2");
  926. let weeks = [];
  927. if (this.isNeedAppoint && this.goodsType != 6 && this.goodsType != 4) {
  928. weeks = [{
  929. dayOfWeek: new Date(this.dateList[this.dateIndex].bookdate).getDay(),
  930. startTime: this.timeList[this.timeIndex].begin,
  931. endTime: this.timeList[this.timeIndex].end
  932. }];
  933. }
  934. let params = {
  935. weeks: weeks,
  936. type: 0,
  937. //startDate: this.isNeedAppoint ? this.dateList[this.dateIndex].bookdate : null,
  938. startDate: this.dateList!='' && this.dateList.length>0?this.dateList[this.dateIndex].bookdate:null,
  939. lng: this.checkedAddress.lng,
  940. lat: this.checkedAddress.lat,
  941. shopId: this.checkedAddress.shopId,
  942. goodId: this.checkedGoodsList[0].goodsId
  943. };
  944. console.log(params);
  945. this.orderPay(params);
  946. }
  947. },
  948. orderPay(orderData) {
  949. let that = this;
  950. var orderInfo = {
  951. cartId: this.cartId,
  952. addressId: this.addressId,
  953. couponId: this.couponId,
  954. userCouponId: this.userCouponId,
  955. message: this.message,
  956. orderDate: this.orderData,
  957. grouponRulesId: this.grouponRulesId,
  958. grouponLinkId: this.grouponLinkId,
  959. nurseId: this.nurseId,
  960. petinfo: this.petinfo,
  961. shareId: this.shareId,
  962. recCode: this.recCode ? this.recCode : this.rId,
  963. //服务者推荐id(如果填写推荐码 以填写为准)
  964. fraId: this.fraId,
  965. //加盟商id
  966. channelId: this.channelId,
  967. //渠道码
  968. //预约参数信息
  969. orderDate: orderData,
  970. requireOrder: this.requireOrder,
  971. traceId: this.traceId ,//视频号
  972. createOrderType:this.appType
  973. };
  974. if (this.codeShow && !this.isNoMatch) {
  975. orderInfo.recCode = this.recCode;
  976. }
  977. console.log(orderInfo);
  978. util.request(api.OrderSubmit, orderInfo, 'POST').then((res) => {
  979. //视频号,校验 wx.checkBeforeAddOrder
  980. uni.checkBeforeAddOrder({
  981. success(res) {
  982. console.log('checkBeforeAddOrder-success:', res);
  983. if (res.data.errcode == 0) {
  984. that.setData({
  985. traceId: res.data.traceId,
  986. requireOrder: res.data.requireOrder
  987. });
  988. }
  989. },
  990. fail(res) {
  991. console.log('checkBeforeAddOrder-fail:', res);
  992. }
  993. });
  994. if (res.errno === 0) {
  995. console.log(res.data.isNeedPay);
  996. if (res.data.isNeedPay == false) {
  997. console.log('跳过支付');
  998. util.redirect('/pages/ucenter/order/order');
  999. return;
  1000. }
  1001. // 下单成功,重置couponId
  1002. uni.setStorageSync('couponId', 0);
  1003. const orderId = res.data.orderId;
  1004. this.setData({
  1005. orderId: orderId
  1006. });
  1007. const grouponLinkId = res.data.grouponLinkId;
  1008. util.request(
  1009. api.OrderPrepay, {
  1010. orderId: orderId
  1011. },
  1012. 'POST'
  1013. ).then((res) => {
  1014. if (res.errno === 0) {
  1015. const payParam = res.data;
  1016. console.log('支付过程开始');
  1017. if (this.requireOrder == 1) {
  1018. //视频号支付
  1019. uni.requestOrderPayment({
  1020. timeStamp: payParam.timeStamp,
  1021. nonceStr: payParam.nonceStr,
  1022. package: payParam.packageValue,
  1023. signType: payParam.signType,
  1024. paySign: payParam.paySign,
  1025. success: (res) => {
  1026. console.log('支付过程成功');
  1027. if (grouponLinkId) {
  1028. setTimeout(() => {
  1029. uni.redirectTo({
  1030. url: '/pages/groupon/grouponDetail/grouponDetail?id=' +
  1031. grouponLinkId
  1032. });
  1033. }, 1000);
  1034. } else {
  1035. uni.redirectTo({
  1036. url: '/pages/checkout/payResult/payResult?status=1&orderId=' +
  1037. orderId + '&actualPrice=' +
  1038. this.actualPrice
  1039. });
  1040. }
  1041. },
  1042. fail: (res) => {
  1043. console.log('支付过程失败');
  1044. // wx.redirectTo({
  1045. // url: '/pages/checkout/payResult/payResult?status=0&orderId=' + orderId
  1046. // });
  1047. // 弹出支付失败
  1048. this.setData({
  1049. payFailShow: true,
  1050. remarkDisable: true
  1051. });
  1052. },
  1053. complete: function(res) {
  1054. console.log('支付过程结束');
  1055. }
  1056. });
  1057. } else {
  1058. uni.requestPayment({
  1059. timeStamp: payParam.timeStamp,
  1060. nonceStr: payParam.nonceStr,
  1061. package: payParam.packageValue,
  1062. signType: payParam.signType,
  1063. paySign: payParam.paySign,
  1064. success: (res) => {
  1065. console.log('支付过程成功');
  1066. if (grouponLinkId) {
  1067. setTimeout(() => {
  1068. uni.redirectTo({
  1069. url: '/pages/groupon/grouponDetail/grouponDetail?id=' +
  1070. grouponLinkId
  1071. });
  1072. }, 1000);
  1073. } else {
  1074. uni.redirectTo({
  1075. url: '/pages/checkout/payResult/payResult?status=1&orderId=' +
  1076. orderId + '&actualPrice=' +
  1077. this.actualPrice
  1078. });
  1079. }
  1080. },
  1081. fail: (res) => {
  1082. console.log('支付过程失败');
  1083. // 弹出支付失败
  1084. this.setData({
  1085. payFailShow: true,
  1086. remarkDisable: true
  1087. });
  1088. },
  1089. complete: function(res) {
  1090. console.log('支付过程结束');
  1091. }
  1092. });
  1093. }
  1094. } else {
  1095. // 弹出支付失败
  1096. this.setData({
  1097. payFailShow: true,
  1098. remarkDisable: true
  1099. });
  1100. // wx.redirectTo({
  1101. // url: '/pages/checkout/payResult/payResult?status=0&orderId=' + orderId
  1102. // });
  1103. }
  1104. });
  1105. } else {
  1106. uni.showToast({
  1107. title: res.errmsg,
  1108. icon: 'none'
  1109. });
  1110. // util.showErrorToast(res.errmsg);
  1111. }
  1112. });
  1113. },
  1114. surplusMonth: function(year) {
  1115. var date = new Date();
  1116. var year2 = date.getFullYear();
  1117. var month = date.getMonth() + 1;
  1118. var day = date.getDate();
  1119. var hour = date.getHours();
  1120. var minute = date.getMinutes();
  1121. var second = date.getSeconds();
  1122. var monthDatas = [];
  1123. if (year == year2) {
  1124. var surplusMonth = 12 - month;
  1125. monthDatas.push(month + '月');
  1126. for (var i = month; i < 12; i++) {
  1127. monthDatas.push(i + 1 + '月');
  1128. }
  1129. } else {
  1130. for (var i = 0; i < 12; i++) {
  1131. monthDatas.push(i + 1 + '月');
  1132. }
  1133. }
  1134. return monthDatas;
  1135. },
  1136. //天数计算
  1137. surplusDay: function(year, month, day) {
  1138. var days = 31;
  1139. var dayDatas = [];
  1140. var date = new Date();
  1141. var year2 = date.getFullYear();
  1142. var month2 = date.getMonth() + 1;
  1143. switch (parseInt(month)) {
  1144. case 1:
  1145. case 3:
  1146. case 5:
  1147. case 7:
  1148. case 8:
  1149. case 10:
  1150. case 12:
  1151. days = 31;
  1152. break;
  1153. //对于2月份需要判断是否为闰年
  1154. case 2:
  1155. if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
  1156. days = 29;
  1157. break;
  1158. } else {
  1159. days = 28;
  1160. break;
  1161. }
  1162. case 4:
  1163. case 6:
  1164. case 9:
  1165. case 11:
  1166. days = 30;
  1167. break;
  1168. }
  1169. if (year == year2 && month == month2) {
  1170. // dayDatas.push(day + "日")
  1171. for (var i = day; i < days; i++) {
  1172. dayDatas.push(i + 1 + '日');
  1173. }
  1174. } else {
  1175. console.log(month + '月' + days + '天');
  1176. for (var i = 0; i < days; i++) {
  1177. dayDatas.push(i + 1 + '日');
  1178. }
  1179. }
  1180. return dayDatas;
  1181. },
  1182. //时间计算
  1183. surplusHour: function(year, month, day, hour) {
  1184. var date = new Date();
  1185. var year2 = date.getFullYear();
  1186. var month2 = date.getMonth() + 1;
  1187. var day2 = date.getDate();
  1188. var hourEnd = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21];
  1189. var hours = [
  1190. ['09时', '10时', '11时', '12时', '13时', '14时', '15时', '16时', '17时', '18时', '19时', '20时'],
  1191. ['10时', '11时', '12时', '13时', '14时', '15时', '16时', '17时', '18时', '19时', '20时', '21时']
  1192. ];
  1193. return hours;
  1194. },
  1195. varietiesChange: function(e) {
  1196. var Varieties = this.array[parseInt(e.detail.value)];
  1197. console.log(Varieties);
  1198. this.setData({
  1199. Varieties: Varieties
  1200. });
  1201. },
  1202. warehouseChange: function(e) {
  1203. var Warehouse = this.array[parseInt(e.detail.value)];
  1204. console.log(Warehouse);
  1205. this.setData({
  1206. Warehouse: Warehouse
  1207. });
  1208. },
  1209. //某一列的值改变时触发
  1210. bindMultiPickerColumnChange: function(e) {
  1211. var date = new Date();
  1212. var year1 = date.getFullYear();
  1213. var month1 = date.getMonth() + 1;
  1214. var day1 = date.getDate();
  1215. var hour1 = date.getHours();
  1216. console.log('当前月份' + this.month + '修改的列为', e.detail.column, ',值为', e.detail.value);
  1217. var data = {
  1218. multiArray: this.multiArray,
  1219. multiIndex: this.multiIndex,
  1220. year: this.year,
  1221. month: this.month,
  1222. day: this.day,
  1223. startHour: this.startHour,
  1224. endHour: this.startHour
  1225. };
  1226. data.multiIndex[e.detail.column] = e.detail.value;
  1227. switch (e.detail.column) {
  1228. case 0:
  1229. var yearStr = data.multiArray[e.detail.column][e.detail.value];
  1230. var year = yearStr.substring(0, yearStr.length - 1);
  1231. data.year = parseInt(year);
  1232. var surplusMonth = this.surplusMonth(year);
  1233. data.multiArray[1] = surplusMonth;
  1234. if (data.year == year1) {
  1235. data.month = month1;
  1236. } else {
  1237. data.month = 1;
  1238. }
  1239. if (data.year == year1 && month1 == data.month) {
  1240. data.day = day1;
  1241. } else {
  1242. data.day = 1;
  1243. }
  1244. var surplusDay = this.surplusDay(data.year, data.month, data.day);
  1245. data.multiArray[2] = surplusDay;
  1246. var surplusHour;
  1247. if (data.year == year1 && month1 == data.month && data.day == day1) {
  1248. surplusHour = this.surplusHour(data.year, data.month, data.day, hour1);
  1249. } else {
  1250. surplusHour = this.surplusHour(data.year, data.month, data.day, 1);
  1251. }
  1252. console.log(surplusHour);
  1253. data.multiArray[3] = surplusHour[0];
  1254. data.multiArray[5] = surplusHour[1];
  1255. data.startHour = surplusHour[0];
  1256. data.endHour = surplusHour[1];
  1257. data.multiIndex[1] = 0;
  1258. data.multiIndex[2] = 0;
  1259. data.multiIndex[3] = 0;
  1260. data.multiIndex[5] = 0;
  1261. break;
  1262. case 1:
  1263. console.log('选择月份' + data.multiArray[e.detail.column][e.detail.value]);
  1264. var monthStr = data.multiArray[e.detail.column][e.detail.value];
  1265. var month = monthStr.substring(0, monthStr.length - 1);
  1266. data.month = month;
  1267. data.day = 1;
  1268. if (data.year == year1 && month1 == data.month) {
  1269. data.day = day1;
  1270. } else {
  1271. data.day = 1;
  1272. }
  1273. var surplusDay = this.surplusDay(data.year, data.month, data.day);
  1274. data.multiArray[2] = surplusDay;
  1275. var surplusHour;
  1276. if (data.year == year1 && month1 == data.month && data.day == day1) {
  1277. surplusHour = this.surplusHour(data.year, data.month, data.day, hour1);
  1278. } else {
  1279. surplusHour = this.surplusHour(data.year, data.month, data.day, 1);
  1280. }
  1281. data.multiArray[3] = surplusHour[0];
  1282. data.multiArray[5] = surplusHour[1];
  1283. data.startHour = surplusHour[0];
  1284. data.endHour = surplusHour[1];
  1285. data.multiIndex[2] = 0;
  1286. data.multiIndex[3] = 0;
  1287. data.multiIndex[5] = 0;
  1288. break;
  1289. case 2:
  1290. console.log('选择日' + data.multiArray[e.detail.column][e.detail.value]);
  1291. var dayStr = data.multiArray[e.detail.column][e.detail.value];
  1292. var day = dayStr.substring(0, dayStr.length - 1);
  1293. data.day = day;
  1294. var surplusHour;
  1295. if (data.year == year1 && month1 == data.month && data.day == day1) {
  1296. surplusHour = this.surplusHour(data.year, data.month, data.day, hour1);
  1297. } else {
  1298. surplusHour = this.surplusHour(data.year, data.month, data.day, 1);
  1299. }
  1300. data.multiArray[3] = surplusHour[0];
  1301. data.multiArray[5] = surplusHour[1];
  1302. data.startHour = surplusHour[0];
  1303. data.endHour = surplusHour[1];
  1304. data.multiIndex[3] = 0;
  1305. data.multiIndex[5] = 0;
  1306. break;
  1307. case 3:
  1308. console.log('起始时间' + data.multiArray[e.detail.column][e.detail.value]);
  1309. var hourStr = data.multiArray[e.detail.column][e.detail.value];
  1310. var hour = hourStr.substring(0, hourStr.length - 1);
  1311. data.startHour = hour;
  1312. console.log('起始时间' + hour + ' day1:' + day1);
  1313. /*var endhours2 = [];
  1314. var end = ['09时', '11时', '12时', '13时', '14时', '15时', '16时', '17时', '18时', '19时', '20时', '20时'];
  1315. for (var i = e.detail.value; i < end.length; i++) {
  1316. endhours2.push(end[i]);
  1317. }
  1318. data.multiArray[5] = endhours2; */
  1319. if (e.detail.value > data.multiIndex[5]) {
  1320. data.multiIndex[5] = e.detail.value;
  1321. }
  1322. break;
  1323. case 5:
  1324. var hourStr = data.multiArray[e.detail.column][e.detail.value];
  1325. var hour = hourStr.substring(0, hourStr.length - 1);
  1326. data.endHour = hour;
  1327. if (e.detail.value < data.multiIndex[3]) {
  1328. data.multiIndex[3] = e.detail.value;
  1329. }
  1330. //console.log('index:'+data.multiIndex[3]+'value:'+e.detail.value+'结束时间' + data.multiArray[e.detail.column][e.detail.value]);
  1331. break;
  1332. }
  1333. this.setData(data);
  1334. },
  1335. //value 改变时触发 change 事件
  1336. bindMultiPickerChange: function(e) {
  1337. console.info(e);
  1338. console.info(this.multiArray);
  1339. console.info(this);
  1340. console.info(this.multiIndex);
  1341. var dateStr =
  1342. this.multiArray[0][this.multiIndex[0]] +
  1343. this.multiArray[1][this.multiIndex[1]] +
  1344. this.multiArray[2][this.multiIndex[2]] +
  1345. this.multiArray[3][this.multiIndex[3]] +
  1346. this.multiArray[4][this.multiIndex[4]] +
  1347. this.multiArray[5][this.multiIndex[5]];
  1348. console.log('picker发送选择改变,携带值为', dateStr);
  1349. this.setData({
  1350. orderData: dateStr
  1351. });
  1352. },
  1353. onClose() {
  1354. this.setData({
  1355. choosePopup: false,
  1356. remarkDisable: false
  1357. });
  1358. },
  1359. dateCheck(e) {
  1360. let index = e.currentTarget.dataset.index;
  1361. let date = e.currentTarget.dataset.date;
  1362. let week = e.currentTarget.dataset.week;
  1363. let isbook = e.currentTarget.dataset.isbook;
  1364. console.info('dateCheck:' + index);
  1365. this.setData({
  1366. dateIndex: index
  1367. });
  1368. let period = this.dateList[this.dateIndex].period;
  1369. let current = this.noonType == 1 ? '上午' : '下午';
  1370. let list = period.filter((item) => {
  1371. return item.ofTime == current;
  1372. });
  1373. this.setData({
  1374. timeList: list
  1375. });
  1376. let isNoTime = list.every((item) => {
  1377. return item.timeMsg && item.timeMsg != null;
  1378. });
  1379. if (isNoTime) {
  1380. this.setData({
  1381. timeIndex: -1,
  1382. selectTimeValue: ''
  1383. });
  1384. }
  1385. },
  1386. noonTab(e) {
  1387. let noon = e.currentTarget.dataset.noon;
  1388. this.setData({
  1389. timeIndex: -1,
  1390. noonType: noon,
  1391. selectTimeValue: ''
  1392. });
  1393. let period = this.dateList[this.dateIndex].period;
  1394. let current = this.noonType == 1 ? '上午' : '下午';
  1395. let list = period.filter((item) => {
  1396. return item.ofTime == current;
  1397. });
  1398. this.setData({
  1399. timeList: list
  1400. });
  1401. },
  1402. timeCheck(e) {
  1403. let index = e.currentTarget.dataset.index;
  1404. // let stock = e.currentTarget.dataset.stock;
  1405. let msg = e.currentTarget.dataset.msg;
  1406. if (msg == null || msg == '') {
  1407. let time = this.timeList[index].begin.split(':')[0];
  1408. this.setData({
  1409. timeIndex: index,
  1410. selectTimeValue: Number(time)
  1411. });
  1412. }
  1413. },
  1414. weekCheck(e) {
  1415. let index = e.currentTarget.dataset.index;
  1416. this.setData({
  1417. weekIndex: index
  1418. // selectTimeIndex:'null'
  1419. });
  1420. },
  1421. timeSelect(e) {
  1422. let index = e.currentTarget.dataset.index;
  1423. let time = e.currentTarget.dataset.time;
  1424. if (this.activeTab) {
  1425. let weekList = this.weekArrList;
  1426. weekList.forEach((item) => {
  1427. item.num = 0;
  1428. });
  1429. this.setData({
  1430. weekArrList: weekList
  1431. });
  1432. let itemData = 'weekArrList[' + this.weekIndex + '].num';
  1433. let selectedDateList = [];
  1434. let dateItem = {
  1435. week: this.weekIndex,
  1436. time: time,
  1437. weekStr: this.weekArrList[this.weekIndex].week
  1438. };
  1439. selectedDateList.push(dateItem);
  1440. console.log(this);
  1441. this.setData({
  1442. selectTimeIndex: index,
  1443. [itemData]: 1,
  1444. selectedWeekList: [this.weekIndex],
  1445. selectedDateList: selectedDateList
  1446. });
  1447. console.log(this);
  1448. }
  1449. },
  1450. firstDateCheck(e) {
  1451. let index = e.currentTarget.dataset.index;
  1452. this.setData({
  1453. firstDateIndex: index
  1454. });
  1455. },
  1456. onTabChange(e) {
  1457. let weekList = this.weekArrList;
  1458. weekList.forEach((item) => {
  1459. item.num = 0;
  1460. });
  1461. console.log("e.detail.name", e.detail.name);
  1462. this.setData({
  1463. weekArrList: weekList,
  1464. activeTab: e.detail.name,
  1465. selectTimeIndex: 'null',
  1466. selectedWeekList: [],
  1467. selectedDateList: []
  1468. });
  1469. },
  1470. showAppoint() {
  1471. if (this.addressId == 0) {
  1472. util.showErrorToast('请选择服务地址');
  1473. return;
  1474. }
  1475. this.setData({
  1476. activeTab:"3",
  1477. choosePopup: true,
  1478. remarkDisable: true,
  1479. popupType: this.popupType == 3 ? 2 : this.popupType,
  1480. isFinishAppoint: false
  1481. });
  1482. if (this.popupType == '1') {
  1483. this.getDayTime();
  1484. }
  1485. let that=this
  1486. },
  1487. confirmTime() {
  1488. console.log(this);
  1489. if (this.popupType == 1) {
  1490. if (this.timeIndex === '' || this.timeIndex < 0) {
  1491. uni.showToast({
  1492. title: '请选择服务时间',
  1493. icon: 'none',
  1494. duration: 2000
  1495. });
  1496. return false;
  1497. }
  1498. let date = this.dateList[this.dateIndex].bookdate;
  1499. let week = this.dateList[this.dateIndex].weekOfDay;
  1500. let time = this.timeList[this.timeIndex].begin + '-' + this.timeList[this.timeIndex].end;
  1501. console.log(week, time);
  1502. const date1 = new Date();
  1503. // 获取今天日期的毫秒数
  1504. const date2 = new Date(date);
  1505. // 计算两个日期的毫秒数差
  1506. const timeDifference = date2.getTime() - date1.getTime();
  1507. // 将毫秒数转换为天数(1天 = 24小时 * 60分钟 * 60秒 * 1000毫秒)
  1508. const daysDifference = Math.ceil(timeDifference / (1000 * 60 * 60 * 24));
  1509. // console.log(`两个日期相差 ${daysDifference} 天`);
  1510. this.setData({
  1511. oneTimeAppoint: date + ' ' + week + ' ' + time,
  1512. choosePopup: false,
  1513. remarkDisable: false,
  1514. isFinishAppoint: true,
  1515. daysDifference: daysDifference
  1516. });
  1517. } else if (this.popupType == 2) {
  1518. //这个0是瞎填的,只是为了不走这个if判断,后期可以删除
  1519. if (this.activeTab === 0) {
  1520. if (this.selectedDateList.length < 1) {
  1521. uni.showToast({
  1522. title: '请选择服务时间',
  1523. icon: 'none',
  1524. duration: 2000
  1525. });
  1526. } else if (this.selectedDateList.length == 1) {
  1527. uni.showToast({
  1528. title: '请选择第二次服务时间',
  1529. icon: 'none',
  1530. duration: 2000
  1531. });
  1532. } else {
  1533. // 选择频次
  1534. let futureDateList = util.getDateList(new Date(new Date().getTime() + 3600000 * 24), 1);
  1535. let minIndex = Math.min.apply(null, this.selectedWeekList);
  1536. console.log(minIndex);
  1537. console.log(this.weekArrList[minIndex].id);
  1538. let beginDate = futureDateList.filter((item) => {
  1539. return new Date(item.date).getDay() == this.weekArrList[minIndex].id;
  1540. });
  1541. console.log(beginDate);
  1542. let inter = 7;
  1543. let firstAppointList = util.getDateList(new Date(new Date(beginDate[0].date).getTime()),
  1544. inter);
  1545. this.setData({
  1546. popupType: 3,
  1547. firstAppointList: firstAppointList
  1548. });
  1549. }
  1550. } else {
  1551. if (this.selectedDateList.length == 0) {
  1552. uni.showToast({
  1553. title: '请选择服务时间',
  1554. icon: 'none',
  1555. duration: 2000
  1556. });
  1557. } else {
  1558. // 选择频次
  1559. let futureDateList = util.getDateList(new Date(new Date().getTime() + 3600000 * 24), 1);
  1560. let minIndex = Math.min.apply(null, this.selectedWeekList);
  1561. console.log(minIndex);
  1562. let beginDate = futureDateList.filter((item) => {
  1563. return new Date(item.date).getDay() == this.weekArrList[minIndex].id;
  1564. });
  1565. let inter = (this.activeTab == 3 ? 14 : this.activeTab == 5 ?util.getNextMonthDays(1) : util.getNextMonthDays(1)+util.getNextMonthDays(2));
  1566. let firstAppointList = util.getDateList(new Date(new Date(beginDate[0].date).getTime()),
  1567. inter);
  1568. this.setData({
  1569. popupType: 3,
  1570. firstAppointList: firstAppointList
  1571. });
  1572. }
  1573. }
  1574. } else if (this.popupType == 3) {
  1575. let firstTime = this.firstAppointList[this.firstDateIndex].date;
  1576. console.log(firstTime);
  1577. console.log(this.selectedDateList);
  1578. this.setData({
  1579. choosePopup: false,
  1580. remarkDisable: false,
  1581. isFinishAppoint: true,
  1582. popupType: 2
  1583. });
  1584. }
  1585. },
  1586. orderAppoint() {
  1587. // 如果是多次卡先预估,单次卡不用预估
  1588. let weeks = [];
  1589. this.selectedDateList.forEach((item) => {
  1590. let obj = {
  1591. dayOfWeek: this.weekArrList[item.week].id,
  1592. startTime: item.time.split('-')[0],
  1593. endTime: item.time.split('-')[1]
  1594. };
  1595. weeks.push(obj);
  1596. });
  1597. let params = {
  1598. weeks: weeks,
  1599. type: this.activeTab,
  1600. startDate: this.firstAppointList[this.firstDateIndex].date,
  1601. lng: this.checkedAddress.lng,
  1602. lat: this.checkedAddress.lat,
  1603. shopId: this.checkedAddress.shopId,
  1604. goodId: this.checkedGoodsList[0].goodsId
  1605. };
  1606. uni.showLoading({
  1607. title: '加载中'
  1608. });
  1609. util.request(api.OrderAppoint, params, 'POST')
  1610. .then((res) => {
  1611. uni.hideLoading();
  1612. if (res.errno == 0) {
  1613. // this.orderPay(params);
  1614. this.setData({
  1615. choosePopup: false,
  1616. remarkDisable: false,
  1617. isFinishAppoint: true,
  1618. popupType: 2
  1619. });
  1620. } else {
  1621. uni.showToast({
  1622. title: res.errmsg,
  1623. icon: 'none',
  1624. duration: 2000
  1625. });
  1626. }
  1627. })
  1628. .catch(function(err) {
  1629. console.log(err);
  1630. uni.hideLoading();
  1631. uni.showToast({
  1632. title: err.errMsg,
  1633. icon: 'none'
  1634. });
  1635. });
  1636. },
  1637. cancelPay() {
  1638. this.setData({
  1639. payFailShow: false,
  1640. remarkDisable: false
  1641. });
  1642. uni.navigateBack({
  1643. delta: 1
  1644. });
  1645. },
  1646. rePay() {
  1647. uni.showLoading({
  1648. title: '支付中'
  1649. });
  1650. this.setData({
  1651. payFailShow: false,
  1652. remarkDisable: false
  1653. });
  1654. util.request(
  1655. api.OrderPrepay, {
  1656. orderId: this.orderId
  1657. },
  1658. 'POST'
  1659. )
  1660. .then((res) => {
  1661. if (res.errno === 0) {
  1662. const payParam = res.data;
  1663. console.log('支付过程开始');
  1664. uni.requestPayment({
  1665. timeStamp: payParam.timeStamp,
  1666. nonceStr: payParam.nonceStr,
  1667. package: payParam.packageValue,
  1668. signType: payParam.signType,
  1669. paySign: payParam.paySign,
  1670. success: (res) => {
  1671. console.log('支付过程成功');
  1672. uni.redirectTo({
  1673. url: '/pages/checkout/payResult/payResult?status=1&orderId=' +
  1674. this.orderId + '&actualPrice=' + this.actualPrice
  1675. });
  1676. },
  1677. fail: (res) => {
  1678. console.log('支付过程失败');
  1679. util.showErrorToast('支付失败');
  1680. },
  1681. complete: (res) => {
  1682. uni.hideLoading();
  1683. console.log('支付过程结束');
  1684. }
  1685. });
  1686. } else {
  1687. uni.hideLoading();
  1688. }
  1689. })
  1690. .catch((res) => {
  1691. uni.hideLoading();
  1692. });
  1693. },
  1694. goBuyMember() {
  1695. uni.navigateTo({
  1696. url: '/pages/member/buyMember/buyMember'
  1697. });
  1698. },
  1699. getDayStock() {
  1700. if (this.dateIndex < 0) {
  1701. return false;
  1702. }
  1703. let params = {
  1704. day: this.dateList[this.dateIndex].date,
  1705. goodsId: this.checkedGoodsList[0].goodsId,
  1706. lng: this.checkedAddress.lng,
  1707. lat: this.checkedAddress.lat,
  1708. productId: this.checkedGoodsList[0].product.id,
  1709. serviceDuration: this.serviceDuration
  1710. };
  1711. uni.showLoading({
  1712. title: '加载中'
  1713. });
  1714. util.request(api.EveryDayStock, params, 'GET')
  1715. .then((res) => {
  1716. uni.hideLoading();
  1717. if (res.errno == 0) {
  1718. this.setData({
  1719. timeList: res.data,
  1720. timeIndex: 0
  1721. });
  1722. } else {
  1723. uni.showToast({
  1724. title: res.errmsg,
  1725. icon: 'none',
  1726. duration: 2000
  1727. });
  1728. this.setData({
  1729. timeList: [],
  1730. timeIndex: ''
  1731. });
  1732. }
  1733. })
  1734. .catch(function(err) {
  1735. console.log(err);
  1736. uni.hideLoading();
  1737. uni.showToast({
  1738. title: err.errMsg,
  1739. icon: 'none',
  1740. duration: 2000
  1741. });
  1742. this.setData({
  1743. timeList: [],
  1744. timeIndex: ''
  1745. });
  1746. });
  1747. },
  1748. getDayTime() {
  1749. let params = {
  1750. days: 30,
  1751. productId: this.checkedGoodsList[0].productId,
  1752. serviceDuration: this.serviceDuration
  1753. };
  1754. uni.showLoading({
  1755. title: '加载中'
  1756. });
  1757. util.request(api.everyDayTime, params, 'GET')
  1758. .then((res) => {
  1759. uni.hideLoading();
  1760. if (res.errno == 0) {
  1761. this.setData({
  1762. dateList: res.data,
  1763. dateIndex: 0,
  1764. timeIndex: -1,
  1765. noonType: 1
  1766. });
  1767. let period = res.data[0].period;
  1768. let list = period.filter((item) => {
  1769. return item.ofTime == '上午';
  1770. });
  1771. this.setData({
  1772. timeList: list
  1773. });
  1774. } else {
  1775. uni.showToast({
  1776. title: res.errmsg,
  1777. icon: 'none',
  1778. duration: 2000
  1779. });
  1780. this.setData({
  1781. timeList: [],
  1782. timeIndex: ''
  1783. });
  1784. }
  1785. })
  1786. .catch(function(err) {
  1787. console.log(err);
  1788. uni.hideLoading();
  1789. uni.showToast({
  1790. title: err.errMsg,
  1791. icon: 'none',
  1792. duration: 1000
  1793. });
  1794. this.setData({
  1795. timeList: [],
  1796. timeIndex: ''
  1797. });
  1798. });
  1799. }
  1800. }
  1801. };
  1802. </script>
  1803. <style>
  1804. page {
  1805. height: 100%;
  1806. background: #f4f4f4;
  1807. }
  1808. .container {
  1809. padding: 50rpx 28rpx 180rpx;
  1810. }
  1811. .address-box {
  1812. width: 100%;
  1813. border-radius: 20rpx;
  1814. }
  1815. .address-item {
  1816. display: flex;
  1817. background: #fff;
  1818. padding: 36rpx 16rpx 32rpx;
  1819. border-radius: 20rpx;
  1820. }
  1821. .address-item.address-empty {
  1822. line-height: 75rpx;
  1823. text-align: center;
  1824. }
  1825. .address-item .map-icon {
  1826. width: 28rpx;
  1827. height: 28rpx;
  1828. margin: 0 18rpx 0 0;
  1829. }
  1830. .address-box .l {
  1831. width: 125rpx;
  1832. height: 100%;
  1833. }
  1834. .address-box .l .name {
  1835. margin-left: 6.25rpx;
  1836. margin-top: -7.25rpx;
  1837. display: block;
  1838. width: 125rpx;
  1839. height: 43rpx;
  1840. line-height: 43rpx;
  1841. font-size: 30rpx;
  1842. color: #333;
  1843. margin-bottom: 5rpx;
  1844. }
  1845. .address-box .l .default {
  1846. margin-left: 6.25rpx;
  1847. display: block;
  1848. width: 62rpx;
  1849. height: 33rpx;
  1850. border-radius: 5rpx;
  1851. border: 1px solid #b4282d;
  1852. font-size: 20.5rpx;
  1853. text-align: center;
  1854. line-height: 29rpx;
  1855. color: #b4282d;
  1856. }
  1857. .address-box .m {
  1858. flex: 1;
  1859. }
  1860. .address-box .mobile {
  1861. display: block;
  1862. height: 29rpx;
  1863. line-height: 29rpx;
  1864. margin-bottom: 6.25rpx;
  1865. font-size: 26rpx;
  1866. }
  1867. .address-box .address {
  1868. display: block;
  1869. /* height: 30rpx; */
  1870. line-height: 30rpx;
  1871. font-size: 26rpx;
  1872. margin: 0 0 18rpx 0;
  1873. }
  1874. .address-bottom {
  1875. color: #85868a;
  1876. line-height: 24rpx;
  1877. height: 24rpx;
  1878. font-size: 22rpx;
  1879. }
  1880. .address-bottom .user-name {
  1881. margin: 0 32rpx 0 0;
  1882. }
  1883. .address-box .r {
  1884. width: 77rpx;
  1885. height: 77rpx;
  1886. display: flex;
  1887. justify-content: center;
  1888. align-items: center;
  1889. }
  1890. .address-box .r image {
  1891. width: 52.078rpx;
  1892. height: 52.078rpx;
  1893. }
  1894. .coupon-box {
  1895. width: 100%;
  1896. height: 210rpx;
  1897. background: #fff;
  1898. border-radius: 20rpx;
  1899. margin-top: 20rpx;
  1900. }
  1901. .coupon-box .coupon-item {
  1902. margin: 0 10rpx;
  1903. height: 70rpx;
  1904. overflow: hidden;
  1905. background: #fff;
  1906. display: flex;
  1907. padding: 0 20rpx 0 10rpx;
  1908. align-items: center;
  1909. justify-content: space-between;
  1910. border-bottom: 2rpx solid #e4e4e4;
  1911. color: #999;
  1912. }
  1913. .coupon-box .l {
  1914. flex: 1;
  1915. height: 70rpx;
  1916. display: flex;
  1917. align-items: center;
  1918. justify-content: space-between;
  1919. color: #999;
  1920. }
  1921. .coupon-box .l .name {
  1922. font-size: 24rpx;
  1923. }
  1924. .coupon-box .l .txt {
  1925. font-size: 24rpx;
  1926. }
  1927. .coupon-box .r {
  1928. width: 30rpx;
  1929. height: 40rpx;
  1930. display: flex;
  1931. justify-content: center;
  1932. align-items: center;
  1933. }
  1934. .coupon-box .r image {
  1935. width: 52.078rpx;
  1936. height: 52.078rpx;
  1937. }
  1938. .message-box {
  1939. margin-top: 20rpx;
  1940. width: 100%;
  1941. height: auto;
  1942. overflow: hidden;
  1943. background: #fff;
  1944. }
  1945. .message-box .message-item {
  1946. height: 86.078rpx;
  1947. overflow: hidden;
  1948. background: #fff;
  1949. display: flex;
  1950. margin-left: 31.25rpx;
  1951. padding-right: 31.25rpx;
  1952. }
  1953. .message-box .message-app {
  1954. height: 74.078rpx;
  1955. overflow: hidden;
  1956. background: #fff;
  1957. display: flex;
  1958. margin-left: 31.25rpx;
  1959. padding-right: 31.25rpx;
  1960. padding-top: 18rpx;
  1961. border-radius: 20rpx;
  1962. }
  1963. .order-box {
  1964. margin-top: 20rpx;
  1965. width: 100%;
  1966. height: auto;
  1967. overflow: hidden;
  1968. background: #fff;
  1969. border-radius: 20rpx!important;
  1970. }
  1971. .order-box .order-item {
  1972. height: 94rpx!important;
  1973. color: #999;
  1974. overflow: hidden;
  1975. background: #fff;
  1976. display: flex;
  1977. align-items: center;
  1978. justify-content: space-between;
  1979. padding: 0 20rpx;
  1980. border-bottom: 1px solid #d9d9d9;
  1981. }
  1982. .order-box .order-item.tip-item {
  1983. padding-bottom: 26rpx;
  1984. height: auto;
  1985. display: flex;
  1986. flex-direction: column;
  1987. }
  1988. .order-box .order-item .l {
  1989. width: 100rpx;
  1990. height: 70rpx;
  1991. line-height: 70rpx;
  1992. align-items: center;
  1993. }
  1994. .order-box .order-item .l .name {
  1995. font-size: 24rpx;
  1996. }
  1997. .order-box .order-item .r {
  1998. line-height: 70rpx;
  1999. flex: 1;
  2000. height: 70rpx;
  2001. line-height: 70rpx;
  2002. align-items: center;
  2003. text-align: right;
  2004. }
  2005. .order-box .order-item.no-border {
  2006. border-bottom: none;
  2007. }
  2008. .goods-items {
  2009. background: #fff;
  2010. border-radius: 20rpx;
  2011. padding: 20rpx 12rpx;
  2012. }
  2013. .goods-items .item {
  2014. height: 210rpx;
  2015. align-items: center;
  2016. }
  2017. .goods-items .item .name {
  2018. font-size: 28rpx;
  2019. line-height: 32rpx;
  2020. color: #2a2a2a;
  2021. }
  2022. .goods-items .item.no-border {
  2023. border-bottom: none;
  2024. }
  2025. .goods-items .item:last-child {
  2026. border-bottom: none;
  2027. }
  2028. .goods-items .img {
  2029. height: 178rpx;
  2030. width: 178rpx;
  2031. margin-right: 26rpx;
  2032. border-radius: 10rpx;
  2033. }
  2034. .goods-items .img image {
  2035. height: 178rpx;
  2036. width: 178rpx;
  2037. border-radius: 10rpx;
  2038. }
  2039. .goods-items .info {
  2040. flex: 1;
  2041. height: 210rpx;
  2042. padding: 14rpx 0 0;
  2043. }
  2044. .goods-items .t {
  2045. height: 33rpx;
  2046. line-height: 33rpx;
  2047. margin-bottom: 10rpx;
  2048. overflow: hidden;
  2049. font-size: 30rpx;
  2050. color: #333;
  2051. }
  2052. .goods-items .t .name {
  2053. display: block;
  2054. float: left;
  2055. }
  2056. .goods-items .t .number {
  2057. display: block;
  2058. float: right;
  2059. text-align: right;
  2060. }
  2061. .goods-items .m {
  2062. height: 28rpx;
  2063. overflow: hidden;
  2064. line-height: 28rpx;
  2065. margin-bottom: 16rpx;
  2066. font-size: 24rpx;
  2067. color: #85868a;
  2068. margin-top: 5rpx;
  2069. }
  2070. .goods-items .b {
  2071. height: 28rpx;
  2072. line-height: 28rpx;
  2073. font-size: 24rpx;
  2074. color: #85868a;
  2075. }
  2076. .order-total {
  2077. position: fixed;
  2078. left: 0;
  2079. bottom: 0;
  2080. height: 100rpx;
  2081. width: 100%;
  2082. display: flex;
  2083. }
  2084. .order-total .l {
  2085. flex: 1;
  2086. height: 100rpx;
  2087. line-height: 100rpx;
  2088. color: #b4282d;
  2089. background: #fff;
  2090. font-size: 33rpx;
  2091. padding-left: 31.25rpx;
  2092. border-top: 1rpx solid rgba(0, 0, 0, 0.2);
  2093. border-bottom: 1rpx solid rgba(0, 0, 0, 0.2);
  2094. }
  2095. .order-total .r {
  2096. width: 233rpx;
  2097. height: 100rpx;
  2098. background: #b4282d;
  2099. border: 1px solid #b4282d;
  2100. line-height: 100rpx;
  2101. text-align: center;
  2102. color: #fff;
  2103. font-size: 30rpx;
  2104. }
  2105. .actual-price {
  2106. color: #2a2a2a;
  2107. font-size: 32rpx;
  2108. text-align: right;
  2109. margin: 14rpx 0 0;
  2110. }
  2111. .actual-price text {
  2112. color: #df1717;
  2113. }
  2114. .coupon-price {
  2115. color: #FF4545;
  2116. font-size: 25rpx;
  2117. text-align: right;
  2118. margin: 52rpx 0 20rpx 0;
  2119. }
  2120. .go-pay-wrapper {
  2121. position: fixed;
  2122. bottom: 0;
  2123. left: 0;
  2124. right: 0;
  2125. height: 130rpx;
  2126. padding: 20rpx 24rpx;
  2127. /* background:#fff; */
  2128. }
  2129. view.go-pay-wrapper button>view {
  2130. color: #fff;
  2131. }
  2132. .appoint-time-block {
  2133. margin-top: 20rpx;
  2134. background: #fff;
  2135. border-radius: 20rpx;
  2136. }
  2137. .appoint-time-block view.appoint-time-operate {
  2138. background: #FFFFFF;
  2139. border-radius: 20rpx;
  2140. border: 2rpx solid #D77958;
  2141. padding: 20rpx 34rpx;
  2142. display: flex;
  2143. align-items: center;
  2144. justify-content: space-between;
  2145. font-size: 24rpx;
  2146. }
  2147. view.operate-left {
  2148. color: #999999;
  2149. }
  2150. view.operate-right {
  2151. display: flex;
  2152. align-items: center;
  2153. }
  2154. view.operate-right {
  2155. color: #d77958;
  2156. }
  2157. view.operate-right .not-select {
  2158. color: #333;
  2159. }
  2160. .appoint-time-show {
  2161. border-top: 2rpx solid #e4e4e4;
  2162. padding: 0 24rpx;
  2163. font-size: 24rpx;
  2164. }
  2165. view.one-time {
  2166. height: 70rpx;
  2167. display: flex;
  2168. align-items: center;
  2169. justify-content: space-between;
  2170. }
  2171. view.one-time text {
  2172. color: #999;
  2173. font-size: 26rpx;
  2174. }
  2175. .multi-times {
  2176. padding: 30rpx 0;
  2177. }
  2178. .multi-times-item {
  2179. height: 54rpx;
  2180. display: flex;
  2181. align-items: center;
  2182. justify-content: space-between;
  2183. }
  2184. .multi-times-item text {
  2185. font-weight: bold;
  2186. font-size: 24rpx;
  2187. }
  2188. view.appoint-result {
  2189. margin-top: 18rpx;
  2190. border: 2rpx solid #d77958;
  2191. border-radius: 20rpx;
  2192. line-height: 46rpx;
  2193. font-size: 26rpx;
  2194. padding: 10rpx;
  2195. }
  2196. .orange-font {
  2197. color: #fa6400;
  2198. font-weight: bold;
  2199. font-size: 26rpx;
  2200. }
  2201. .order-item .message-item {
  2202. color: #2a2a2a;
  2203. font-size: 24rpx;
  2204. font-weight: normal;
  2205. height: 70rpx;
  2206. }
  2207. /* 选择时间 */
  2208. view.popup-wrapper {
  2209. color: #333;
  2210. display: flex;
  2211. flex-direction: column;
  2212. justify-content: space-between;
  2213. height: 100%;
  2214. z-index: 999;
  2215. overflow: hidden;
  2216. }
  2217. .popup-wrapper view {
  2218. color: #888;
  2219. font-size: 30rpx;
  2220. }
  2221. .popup-content {
  2222. flex: 1;
  2223. }
  2224. .popup-title {
  2225. height: 96rpx;
  2226. line-height: 96rpx;
  2227. text-align: center;
  2228. border-bottom: 1rpx solid #ddd;
  2229. }
  2230. .popup-content {
  2231. display: flex;
  2232. }
  2233. .time-select-left {
  2234. border-right: 1rpx solid #ddd;
  2235. padding: 0 8rpx 0 20rpx;
  2236. width: 370rpx;
  2237. }
  2238. .time-select-right {
  2239. flex: 1.6;
  2240. height: 900rpx;
  2241. overflow-y: hidden;
  2242. }
  2243. .popup-content-special .time-select-right {
  2244. flex: 1;
  2245. }
  2246. .time-select-left-item {
  2247. height: 108rpx;
  2248. display: flex;
  2249. flex-direction: column;
  2250. padding: 4rpx 0;
  2251. }
  2252. .date-line-wrapper {
  2253. flex: 1;
  2254. display: flex;
  2255. align-items: center;
  2256. }
  2257. .time-select-left-item .date-msg {
  2258. height: 36rpx;
  2259. line-height: 36rpx;
  2260. color: #888;
  2261. font-size: 24rpx;
  2262. }
  2263. .time-select-left-item .date-msg.avail-date {
  2264. color: #3fa10d;
  2265. font-weight: bold;
  2266. }
  2267. .popup-wrapper .popup-content .current-date {
  2268. color: #d77958;
  2269. font-weight: bold;
  2270. }
  2271. view.popup-wrapper .time-select-right-item {
  2272. height: 104rpx;
  2273. border-bottom: 1rpx solid #d1d1d1;
  2274. display: flex;
  2275. align-items: center;
  2276. justify-content: space-between;
  2277. padding: 0 24rpx;
  2278. }
  2279. .time-select-right-item view {
  2280. color: #6d7278;
  2281. }
  2282. view.popup-btn-wrapper {
  2283. margin: 20rpx 0 0;
  2284. padding: 0 24rpx 20rpx;
  2285. }
  2286. view.popup-btn-wrapper button>view {
  2287. color: #fff;
  2288. }
  2289. view.popup-wrapper .date-tag {
  2290. color: #d77958;
  2291. height: 44rpx;
  2292. line-height: 42rpx;
  2293. width: 76rpx;
  2294. border: 2rpx solid #d77958;
  2295. border-radius: 44rpx;
  2296. text-align: center;
  2297. font-weight: normal;
  2298. font-size: 22rpx;
  2299. display: inline-block;
  2300. margin-left: 8rpx;
  2301. }
  2302. view.popup-wrapper .time-select-right-item.invalid-time text {
  2303. color: #999;
  2304. }
  2305. view.popup-wrapper .time-select-right-item.invalid-time {
  2306. background: #eee;
  2307. }
  2308. .time-select-right-item view.time-msg {
  2309. height: 40rpx;
  2310. line-height: 38rpx;
  2311. border-radius: 40rpx;
  2312. padding: 0 8rpx;
  2313. font-size: 22rpx;
  2314. border: 2rpx solid #999;
  2315. color: #999;
  2316. font-weight: normal;
  2317. white-space: nowrap;
  2318. }
  2319. view.popup-wrapper .full-time {
  2320. color: #d77958;
  2321. font-size: 24rpx;
  2322. margin: 0 0 0 20rpx;
  2323. height: 44rpx;
  2324. line-height: 44rpx;
  2325. float: right;
  2326. padding-right: 40rpx;
  2327. }
  2328. .first-appoint-date-item {
  2329. height: 108rpx;
  2330. display: flex;
  2331. align-items: center;
  2332. padding: 0 0 0 240rpx;
  2333. }
  2334. .first-time-selected {
  2335. margin: 0 0 0 60rpx;
  2336. }
  2337. .select-week-times {
  2338. border-top: 1rpx solid #ddd;
  2339. }
  2340. .week-select-left {
  2341. flex: 1.2;
  2342. }
  2343. .week-select-left>view.time-select-left-item {
  2344. padding: 0 0 0 60rpx;
  2345. display: flex;
  2346. align-items: flex-start;
  2347. justify-content: flex-start;
  2348. flex-direction: row;
  2349. padding: 10rpx 0 0 60rpx;
  2350. }
  2351. .week-select-left>view.time-select-left-item .week-str {
  2352. padding: 12rpx 0 0 0;
  2353. }
  2354. view.popup-wrapper view.select-num-tag {
  2355. width: 32rpx;
  2356. height: 32rpx;
  2357. line-height: 32rpx;
  2358. background: #d77958;
  2359. border-radius: 34rpx;
  2360. font-size: 20rpx;
  2361. color: #fff;
  2362. text-align: center;
  2363. margin: 0 0 0 6rpx;
  2364. }
  2365. /* 支付失败弹框 */
  2366. .overlay-wrapper {
  2367. display: flex;
  2368. align-items: center;
  2369. justify-content: center;
  2370. height: 100%;
  2371. }
  2372. .fail-wrapper {
  2373. width: 652rpx;
  2374. height: 580rpx;
  2375. border-radius: 22rpx;
  2376. background-color: #fff;
  2377. background-size: 100% 40%;
  2378. position: relative;
  2379. font-size: 24rpx;
  2380. display: flex;
  2381. flex-direction: column;
  2382. justify-content: space-between;
  2383. }
  2384. .fail-top {
  2385. display: flex;
  2386. flex-direction: column;
  2387. align-items: center;
  2388. }
  2389. .fail-text {
  2390. font-size: 34rpx;
  2391. font-weight: bold;
  2392. margin: 4rpx 0 40rpx;
  2393. height: 34rpx;
  2394. }
  2395. .fail-bottom {
  2396. height: 132rpx;
  2397. display: flex;
  2398. justify-content: space-around;
  2399. align-items: center;
  2400. }
  2401. .cancel-btn {
  2402. width: 250rpx;
  2403. height: 72rpx;
  2404. line-height: 72rpx;
  2405. border: 2rpx solid #85868a;
  2406. color: #282728;
  2407. border-radius: 72rpx;
  2408. text-align: center;
  2409. }
  2410. .repay-btn {
  2411. width: 250rpx;
  2412. height: 72rpx;
  2413. line-height: 72rpx;
  2414. /* background: #d77958; */
  2415. color: #d77958;
  2416. border-radius: 72rpx;
  2417. text-align: center;
  2418. border: 1rpx solid #d77958;
  2419. }
  2420. .discount-title {
  2421. height: 70rpx;
  2422. background: #feebd7;
  2423. padding: 0 10rpx;
  2424. display: flex;
  2425. align-items: center;
  2426. border-radius: 20rpx 20rpx 0rpx 0rpx;
  2427. }
  2428. .discount-title image {
  2429. width: 24rpx;
  2430. height: 26rpx;
  2431. margin: 0 8rpx 0 0;
  2432. }
  2433. .discount-title text {
  2434. font-size: 28rpx;
  2435. font-weight: bold;
  2436. color: #323232;
  2437. }
  2438. .discount-line {
  2439. padding: 0 50rpx 0 20rpx;
  2440. }
  2441. .discount-line .txt {
  2442. color: #df1717;
  2443. font-size: 24rpx;
  2444. }
  2445. .member-benefit,
  2446. .buy-member {
  2447. margin: 20rpx 0 0;
  2448. height: 70rpx;
  2449. background: #fff;
  2450. border-radius: 10rpx;
  2451. padding: 0 20rpx;
  2452. display: flex;
  2453. align-items: center;
  2454. justify-content: space-between;
  2455. }
  2456. .member-benefit .member-tip {
  2457. text-align: right;
  2458. }
  2459. .member-tag {
  2460. width: 142rpx;
  2461. padding: 0 10rpx;
  2462. height: 44rpx;
  2463. line-height: 44rpx;
  2464. text-align: center;
  2465. background: #2e3235;
  2466. border-radius: 5rpx;
  2467. }
  2468. .member-tag text {
  2469. font-size: 24rpx;
  2470. color: #2a2a2a;
  2471. background: linear-gradient(177deg, #f1e3c8 0%, #e6c162 100%);
  2472. -webkit-background-clip: text;
  2473. -webkit-text-fill-color: transparent;
  2474. }
  2475. .member-tip {
  2476. flex: 1;
  2477. margin: 0 0 0 26rpx;
  2478. color: #df1717;
  2479. font-size: 24rpx;
  2480. }
  2481. .popup-content-special {
  2482. position: relative;
  2483. }
  2484. .popup-title-special {
  2485. position: absolute;
  2486. left: 0;
  2487. top: 0;
  2488. right: 0;
  2489. background: #fff;
  2490. }
  2491. .popup-content-special {
  2492. height: 900rpx;
  2493. margin-top: 116rpx;
  2494. }
  2495. .popup-content-special .time-select-left {
  2496. height: 900rpx;
  2497. overflow-y: scroll;
  2498. }
  2499. .stock-text {
  2500. font-size: 20rpx;
  2501. font-weight: normal;
  2502. color: #888;
  2503. }
  2504. .zero-stock {
  2505. color: #ccc;
  2506. }
  2507. .order-box.code-module {
  2508. border-radius: 10rpx;
  2509. padding: 8rpx 0;
  2510. }
  2511. .codeTips {
  2512. height: 52rpx;
  2513. line-height: 40rpx;
  2514. padding-bottom: 20rpx;
  2515. color: #d77958;
  2516. font-size: 26rpx;
  2517. text-align: right;
  2518. padding: 0 20rpx;
  2519. }
  2520. .codeTips.no-match {
  2521. color: #fa6400;
  2522. }
  2523. .plus-order {
  2524. margin-top: 20rpx;
  2525. width: 694rpx;
  2526. border-radius: 10rpx;
  2527. height: 100rpx;
  2528. display: flex;
  2529. padding: 0 20rpx;
  2530. background: #fff;
  2531. align-items: center;
  2532. }
  2533. .plus-order .plus-title {
  2534. color: #999;
  2535. }
  2536. .plus-order .plus-name {
  2537. flex: 1;
  2538. margin: 0 20rpx;
  2539. font-size: 30rpx;
  2540. color: #333;
  2541. }
  2542. .plus-name .plus-num {
  2543. color: #d77958;
  2544. font-size: 30rpx;
  2545. font-weight: bold;
  2546. }
  2547. .plus-amount {
  2548. color: #d77958;
  2549. font-size: 32rpx;
  2550. font-weight: bold;
  2551. }
  2552. .noon-select {
  2553. height: 64rpx;
  2554. display: flex;
  2555. border-bottom: 1rpx solid #ddd;
  2556. }
  2557. .time-select-right .noon-item {
  2558. flex: 1;
  2559. text-align: center;
  2560. line-height: 64rpx;
  2561. color: #979797;
  2562. font-size: 26rpx;
  2563. }
  2564. .time-select-right view.noon-item.active-noon {
  2565. color: #fff;
  2566. background: #d77958;
  2567. }
  2568. view.popup-wrapper .time-select-right-item .date-tag {
  2569. width: 80rpx;
  2570. height: 40rpx;
  2571. line-height: 38rpx;
  2572. margin-left: 0;
  2573. /* margin-left:120rpx; */
  2574. }
  2575. .popup-title-new.popup-title {
  2576. display: flex;
  2577. flex-direction: column;
  2578. justify-content: center;
  2579. align-items: center;
  2580. height: 116rpx;
  2581. line-height: normal;
  2582. }
  2583. .popup-title-new view {
  2584. color: #333;
  2585. font-size: 32rpx;
  2586. }
  2587. .popup-title-new view.fee-tips {
  2588. color: #ff5735;
  2589. font-size: 22rpx;
  2590. }
  2591. .time-select-right-item text {
  2592. color: #888;
  2593. }
  2594. .time-select-right .time-item-wrapper {
  2595. height: 836rpx;
  2596. overflow-y: scroll;
  2597. }
  2598. .time-line {
  2599. display: flex;
  2600. align-items: center;
  2601. justify-content: space-between;
  2602. width: 100%;
  2603. }
  2604. .time-select-right-item text.extra-tips {
  2605. color: #ff5735;
  2606. font-size: 22rpx;
  2607. }
  2608. .van-tab--active.van-tab > view.van-ellipsis{
  2609. color:#d77958;
  2610. }
  2611. </style>