payOrder.vue 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061
  1. <template>
  2. <view class="pages">
  3. <!-- 地址 -->
  4. <view class="text-center text-red" v-if="isTrue && orderType == 2">超出配送距离</view>
  5. <view class="food">
  6. <view class="flex bg justify-between padding-lr-xl">
  7. <view @click="switchTab(2)" :class="orderType == 2 ? 'select' : ''" class="tabBtn" v-if="XCXIsSelect == '是' && showReach != 1 && shopTypeName != '三大运营商'">
  8. <view class="title">外卖配送</view>
  9. <view :class="orderType == 2 ? 'active' : ''"></view>
  10. </view>
  11. <view @click="switchTab(1)" :class="orderType == 1 ? 'select' : ''" class="tabBtn" v-if="showReach != 2">
  12. <view class="title">到店自取</view>
  13. <view :class="orderType == 1 ? 'active' : ''"></view>
  14. </view>
  15. </view>
  16. <view v-if="orderType == 1">
  17. <view class="flex margin-top">
  18. <u-icon name="map" size="50"></u-icon>
  19. <!-- <text>商家信息</text> -->
  20. <view class="flex-sub padding-tb-sm margin-left-sm">
  21. <view class="text-lg text-bold text-black">
  22. <text>{{ dataList.shopName }}</text>
  23. <text class="margin-left-sm" @click="call"><u-icon name="phone" size="40"></u-icon></text>
  24. </view>
  25. <view class="text-df margin-top-xs" style="color: #999999" @click="goMap">
  26. {{ dataList.detailedAddress }}
  27. </view>
  28. </view>
  29. </view>
  30. <view class="flex margin-top" style="align-items: center">
  31. <view style="font-size: 32rpx; color: #333333; font-weight: bold">是否店内就餐?</view>
  32. <view style="margin-left: 140px; transform: scale(0.8)"><switch :checked="ispackType" @change="handleSwitchChange" color="#4cd964" /></view>
  33. </view>
  34. <view style="color: #ea0018">(店内就餐减免打包费)</view>
  35. <view class="flex margin-top" style="align-items: center" v-if="shopTypeName == '三大运营商'">
  36. <view>请填写身份证号:</view>
  37. <input type="idcard" v-model="idcard1" style="border: 1px solid" />
  38. </view>
  39. </view>
  40. <view class="" v-if="orderType == 2">
  41. <view class="goods_address" v-if="JSON.stringify(address) == '{}'" @click="goAddress">
  42. <view class="address_box">
  43. <view class="address_name">请选择收货地址</view>
  44. <view class="address_image margin-left">
  45. <image src="../../../static/images/index/right.png"></image>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="flex margin-top" style="" v-else @click="goAddress">
  50. <u-icon name="map" size="50"></u-icon>
  51. <view class="flex-sub padding-tb-sm margin-left-sm">
  52. <view class="text-lg text-bold text-black">
  53. <text>{{ address.userName }}</text>
  54. <text class="margin-left-sm">{{ address.userPhone }}</text>
  55. </view>
  56. <view class="text-df margin-top-xs" style="color: #999999">{{ address.province }}{{ address.city }}{{ address.district }}{{ address.addressDetail }}</view>
  57. </view>
  58. <view class="address_image margin-left">
  59. <image src="../../../static/images/index/right.png"></image>
  60. </view>
  61. </view>
  62. <!-- 预约送达时间 -->
  63. <!-- <view class="goods_address" v-if="reservationOpenFlag==1">
  64. <view class="address_box">
  65. <view class="address_name">送达时间</view>
  66. <picker class='time-picker' mode="multiSelector" @change="bindStartMultiPickerChange"
  67. @columnchange="bindMultiPickerColumnChange" :range="data.multiArray">
  68. {{data.startDate}}
  69. </picker>
  70. <view class="songda_image">
  71. <image src="../../../static/images/index/right.png"></image>
  72. </view>
  73. </view>
  74. </view> -->
  75. </view>
  76. </view>
  77. <!-- 商品 -->
  78. <view class="food">
  79. <view class="tosend_header_food" v-for="(item, index) in dataList.orderGoodsList" :key="index">
  80. <view class="tosend_header_food_le">
  81. <image :src="item.goodsPicture[0]" style="border-radius: 10rpx" mode=""></image>
  82. </view>
  83. <view class="flex-sub margin-left-sm">
  84. <view class="flex justify-between align-center">
  85. <view class="text-lg text-bold text-black">{{ item.goodsName }}</view>
  86. <view class="text-lg text-bold text-black">
  87. <text class="text-sm">¥</text>
  88. {{ item.goodsPrice }}
  89. </view>
  90. </view>
  91. <view class="flex justify-between align-center text-gray">
  92. <view v-if="item.skuMessage">{{ item.skuMessage }}</view>
  93. <view>x{{ item.goodsNum }}</view>
  94. </view>
  95. <view class="flex justify-between align-center text-gray margin-tb-sm" v-if="item.goodsPack && packType == 1">
  96. <view>打包费</view>
  97. <view class="">¥{{ item.goodsPack }} / 份</view>
  98. </view>
  99. </view>
  100. </view>
  101. <!-- <view class="tosend_header_do do_top" v-if="item.goodsPack>0" >
  102. <view>打包费</view>
  103. <view class="tosend_header_do_ri">¥{{item.goodsPack}}</view>
  104. </view> -->
  105. <view class="tosend_header_do justify-between" v-if="paotuiMoney > 0 && orderType == 2">
  106. <view>跑腿费</view>
  107. <view class="tosend_header_do_ri">¥{{ paotuiMoney }}</view>
  108. </view>
  109. <view class="tosend_header_do justify-between" v-if="address.insideDeliveryFee && orderType == 2">
  110. <view>特殊地址跑腿费</view>
  111. <view class="tosend_header_do_ri">¥{{ address.insideDeliveryFee }}</view>
  112. </view>
  113. <view class="tosend_header_do justify-between" v-if="Vipmoney.canReduceFlag == '1'">
  114. <view>会员立减</view>
  115. <view class="tosend_header_do_ri">- ¥{{ Vipmoney.reduceAmount }}</view>
  116. </view>
  117. <view class="tosend_header_do justify-between do_bot" v-if="Vipmoney.canReduceFlag == '1'">
  118. <view>优惠券</view>
  119. <!-- <view class="tosend_header_do_ri" v-if="coupon">- ¥{{ coupon.money }}</view>
  120. <view v-else>
  121. <image src="../../../static/images/order/right1.png" style="width: 14rpx; height: 24rpx" mode=""></image>
  122. </view> -->
  123. </view>
  124. <view class="tosend_header_do justify-between do_bot" @click="isShow" v-if="Vipmoney.canReduceFlag == '0'">
  125. <view>优惠券</view>
  126. <view class="tosend_header_do_ri" v-if="coupon">- ¥{{ coupon.money }}</view>
  127. <view v-else>
  128. <image src="../../../static/images/order/right1.png" style="width: 14rpx; height: 24rpx" mode=""></image>
  129. </view>
  130. </view>
  131. <view class="tosend_header_do justify-between do_bot" v-if="Vipmoney.canReduceFlag == '1'">
  132. <view>优惠活动</view>
  133. <!-- <view class="tosend_header_do_ri" v-if="huodong">- ¥{{ huodong.discountAmount }}</view>
  134. <view v-else>
  135. <image src="../../../static/images/order/right1.png" style="width: 14rpx; height: 24rpx" mode=""></image>
  136. </view> -->
  137. </view>
  138. <view class="tosend_header_do justify-between do_bot" @click="huodongShow" v-if="Vipmoney.canReduceFlag == '0'">
  139. <view>优惠活动</view>
  140. <view class="tosend_header_do_ri" v-if="huodong">- ¥{{ huodong.discountAmount }}</view>
  141. <view v-else>
  142. <image src="../../../static/images/order/right1.png" style="width: 14rpx; height: 24rpx" mode=""></image>
  143. </view>
  144. </view>
  145. <view class="tosend_header_do justify-between">
  146. <view class="tosend_header_do_le2">合计</view>
  147. <view class="tosend_header_do_ri2">
  148. <text>¥</text>
  149. {{ totalPrice12 }}
  150. </view>
  151. </view>
  152. </view>
  153. <!-- 积分介绍 -->
  154. <view class="food" v-if="isIntegral">
  155. <view class="food_top">
  156. <view class="">获取积分</view>
  157. <view class="">{{ intergral }}</view>
  158. </view>
  159. <view class="food_bottom">
  160. 实付满{{ ruleAmount1 }}元得
  161. <text class="bottom_text">{{ ruleValue1 }}分</text>
  162. ,超过{{ ruleMaxAmount }}元部分,每满{{ ruleAmount2 }}元得
  163. <text class="bottom_text">{{ ruleValue2 }}分</text>
  164. ;每笔订单上限
  165. <text class="bottom_text">{{ maxIntegral }}分</text>
  166. </view>
  167. </view>
  168. <!-- 订单备注 -->
  169. <view class="food">
  170. <view class="padding-tb-sm text-lg text-bold text-bold text-black">订单备注</view>
  171. <view class="flex align-center justify-between padding-tb-sm padding-lr" style="background: #f5f5f5; width: 100%">
  172. <u-input v-model="remark" type="textarea" placeholder="请输入订单备注" height="180" maxlength="200" style="width: 100%"></u-input>
  173. </view>
  174. </view>
  175. <!-- 支付方式 -->
  176. <view class="margin-top padding-lr radius bg-white" style="width: 94%; margin: 0 auto; border-radius: 18rpx">
  177. <view class="padding-tb-sm text-lg text-bold text-bold text-black">支付方式</view>
  178. <view style="height: 100upx" v-for="(item, index) in openLists" :key="index">
  179. <view class="flex align-center justify-between padding-tb" v-if="item.text != '零钱'">
  180. <image :src="item.image" style="width: 55rpx; height: 55rpx; border-radius: 50upx"></image>
  181. <view class="flex-sub text-xl margin-left">{{ item.text }}</view>
  182. <radio-group name="openWay" style="margin-left: 20upx" @change="selectWay(item)">
  183. <label class="tui-radio">
  184. <radio class="red" :checked="openWay === item.id ? true : false" />
  185. </label>
  186. </radio-group>
  187. </view>
  188. <view class="flex align-center justify-between padding-tb" v-if="item.text === '零钱'">
  189. <image :src="item.image" style="width: 55rpx; height: 55rpx; border-radius: 50upx"></image>
  190. <view class="flex-sub text-xl margin-left">
  191. {{ item.text }}
  192. <text style="font-size: 30rpx; margin-left: 10rpx" v-if="userMoney && userMoney > 0">(余额:{{ userMoney }})</text>
  193. <!-- <text v-else style="font-size: 30rpx; margin-left: 10rpx; text-decoration: underline; color: #ea0000" @tap="goCash()">去充值</text> -->
  194. </view>
  195. <radio-group name="openWay" style="margin-left: 20upx" @change="selectWay(item)">
  196. <label class="tui-radio">
  197. <radio class="red" :checked="openWay === item.id ? true : false" />
  198. </label>
  199. </radio-group>
  200. </view>
  201. </view>
  202. </view>
  203. <view style="height: 120rpx"></view>
  204. <!-- 结算 -->
  205. <view class="goorder">
  206. <view class="goorder_but" :class="isTrue && orderType == 2 ? 'goorder_but_' : ''" @click="toSettlement">立即结算</view>
  207. </view>
  208. <u-popup
  209. v-model="show"
  210. mode="center"
  211. :closeable="true"
  212. close-icon-pos="top-right"
  213. close-icon="close-circle"
  214. close-icon-size="50"
  215. border-radius="20"
  216. width="80%"
  217. @close="close"
  218. >
  219. <view class="padding bg-gray">
  220. <view class="text-center text-lg text-bold margin-bottom-sm">可用优惠券</view>
  221. <scroll-view scroll-y="true" style="height: 600rpx" v-if="couponList.length > 0">
  222. <view
  223. class="flex justify-between align-center radius margin-tb-sm padding-sm bg-white"
  224. v-for="(item, index) in couponList"
  225. :key="index"
  226. @click="selCoupon(item)"
  227. >
  228. <view>
  229. <view>{{ item.couponName }}</view>
  230. <view>有效期至{{ item.expirationTime }}</view>
  231. </view>
  232. <view class="text-sm text-bold">
  233. ¥
  234. <text class="text-lg">{{ item.money }}</text>
  235. </view>
  236. </view>
  237. </scroll-view>
  238. <view v-if="couponList.length == 0" style="height: 100rpx; line-height: 100rpx; text-align: center; font-weight: 700">暂无可用优惠券</view>
  239. </view>
  240. </u-popup>
  241. <!-- 选择优惠活动 -->
  242. <u-popup
  243. v-model="youhui"
  244. mode="center"
  245. :closeable="true"
  246. close-icon-pos="top-right"
  247. close-icon="close-circle"
  248. close-icon-size="50"
  249. border-radius="20"
  250. width="80%"
  251. @close="closeYouhui()"
  252. >
  253. <view class="padding bg-gray">
  254. <view class="text-center text-lg text-bold margin-bottom-sm">可用优惠活动</view>
  255. <scroll-view scroll-y="true" style="height: 600rpx" v-if="huoList.length > 0">
  256. <view class="flex justify-between align-center radius margin-tb-sm padding-sm bg-white" v-for="(item, index) in huoList" :key="index" @click="selctHuo(item)">
  257. <view>
  258. <view>{{ item.activityTitle }}</view>
  259. <view>有效期至{{ item.activityEndTime }}</view>
  260. </view>
  261. <!-- <view class="text-sm text-bold">
  262. ¥
  263. <text class="text-lg" v-if="item.activityType=='2'">{{ item.money }}</text>
  264. <text class="text-lg" v-if="item.activityType=='2'">{{ item.money }}</text>
  265. <text class="text-lg" v-if="item.activityType=='4'">全场打{{ item.discountAmount }}折</text>
  266. </view> -->
  267. </view>
  268. </scroll-view>
  269. <view v-if="huoList.length == 0" style="height: 100rpx; line-height: 100rpx; text-align: center; font-weight: 700">暂无可用优惠活动</view>
  270. </view>
  271. </u-popup>
  272. <view class="hintPopul" v-if="shopDet && shopDet.putawayFlag == 1">
  273. <view class="content_">
  274. <image src="../../../static/images/index/shop.png" style="width: 200rpx; height: 180rpx"></image>
  275. <view class="text-xl text-bold">店铺打烊啦</view>
  276. <view class="hintText margin-top-sm text-gray">现在店铺已经打烊了,营业时间</view>
  277. <view class="margin-top-xs text-gray margin-bottom">{{ shopDet.businessHours }}-{{ shopDet.lockHours }}</view>
  278. <view class="Btns" @click="goBack()">知道了</view>
  279. </view>
  280. </view>
  281. </view>
  282. </template>
  283. <script>
  284. /**
  285. * 获取任意时间
  286. */
  287. function getDate(date, AddDayCount = 0) {
  288. if (!date) {
  289. date = new Date()
  290. }
  291. if (typeof date !== 'object') {
  292. date = date.replace(/-/g, '/')
  293. }
  294. const dd = new Date(date)
  295. dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
  296. var a = new Array('日', '一', '二', '三', '四', '五', '六')
  297. var week = new Date().getDay()
  298. var week2 = new Date().getDay() + 1
  299. const y = dd.getFullYear()
  300. const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0
  301. const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0
  302. const h = dd.getHours() < 10 ? '0' + dd.getHours() : dd.getHours()
  303. const f = dd.getMinutes() < 10 ? '0' + dd.getMinutes() : dd.getMinutes()
  304. const s = dd.getSeconds() < 10 ? '0' + dd.getSeconds() : dd.getSeconds()
  305. return {
  306. fullDate: y + '-' + m + '-' + d,
  307. fullDate2: y + '-' + m + '-' + d + ' ' + h + ':' + f + ':' + s,
  308. fullTime: m + '月' + d + '日',
  309. year: y,
  310. month: m,
  311. date: d,
  312. day: dd.getDay(),
  313. sWeek: '周' + a[week],
  314. eWeek: '周' + a[week2]
  315. }
  316. }
  317. export default {
  318. data() {
  319. return {
  320. userMoney: 0,
  321. storeCommodityId: 0,
  322. openLists: [
  323. {
  324. image: '../../../static/images/my/weixin.png',
  325. text: '微信',
  326. id: 2
  327. }
  328. // {
  329. // image: '../../../static/images/my/zhifubao.png',
  330. // text: '支付宝',
  331. // id: 3
  332. // },
  333. // {
  334. // image: '../../../static/images/my/jinbi.png',
  335. // text: '零钱',
  336. // id: 1
  337. // }
  338. ],
  339. openWay: 2,
  340. hintShow: true,
  341. page: 1,
  342. limit: 100,
  343. dataList: {},
  344. packMoney: 0, //打包费
  345. totalPrice: 0,
  346. totalPrice1: 0,
  347. totalPrice12: 0,
  348. address: {
  349. insideDeliveryFee: 0
  350. }, //地址
  351. addressId: '',
  352. parentId: '',
  353. orderId: '',
  354. show: false,
  355. youhui: false, //优惠活动
  356. coupon: '',
  357. shopDet: '',
  358. huodong: '', //选择的活动信息
  359. Vipmoney: {
  360. canReduceFlag: '0',
  361. reduceAmount: 0,
  362. vipReduceDesc: ''
  363. }, //会员立减金额
  364. couponList: [],
  365. huoList: [], //可用活动
  366. orderType: 2, //1表示到店自取 2表示外卖配送
  367. paotuiMoney: 0,
  368. dabaoMoney: 0,
  369. goodsMoney: 0,
  370. distance: 0,
  371. isTrue: false,
  372. XCXIsSelect: '是',
  373. remark: '',
  374. GoodsorderId: '',
  375. isThrottle: true,
  376. lng: '',
  377. lat: '',
  378. data: {
  379. multiArray: [],
  380. warning: '',
  381. startDate: '请选择'
  382. },
  383. workStart: '', //骑手上班时间
  384. workEnd: '', //骑手下班时间
  385. yusongTime: '', //骑手预计送达时长
  386. reservationFlag: 0, //是否预约单 1是、0否
  387. expectDeliveryTime: '', //预约送达时间
  388. timer: '', //定时器
  389. autoSendOrder: 0, //autoSendOrder为1商家自配,0平台配送
  390. ifPaotui: 0, //是否满减
  391. reservationOpenFlag: 0, //1预约,0不预约
  392. shopId: '',
  393. showReach: null,
  394. // 基础实付满多少
  395. ruleAmount1: 0,
  396. // 基础实付满多少送的积分
  397. ruleValue1: 0,
  398. // 超过多少
  399. ruleMaxAmount: 0,
  400. // 第二阶段实付满多少
  401. ruleAmount2: 0,
  402. // 第二阶段实付满多少送的积分
  403. ruleValue2: 0,
  404. // 每笔订单获取的积分上限
  405. maxIntegral: 0,
  406. // 可获得积分
  407. intergral: 0,
  408. // 是否显示积分模块
  409. isIntegral: false,
  410. shopTypeName: '', //店铺类型
  411. idcard1: '', //身份证号
  412. packType: 1, //堂食0,到店外卖打包1
  413. ispackType: false
  414. }
  415. },
  416. onLoad(option) {
  417. this.shopTypeName = option.shopTypeName
  418. if (option.showReach) {
  419. this.showReach = option.showReach
  420. }
  421. // #ifdef MP-WEIXIN
  422. this.XCXIsSelect = this.$queue.getData('XCXIsSelect') ? this.$queue.getData('XCXIsSelect') : '是'
  423. // #endif
  424. this.shopId = option.shopId
  425. if (option.shopTypeName == '三大运营商') {
  426. this.orderType = 1
  427. } else {
  428. this.orderType = option.orderType
  429. }
  430. if (option.orderId) {
  431. this.orderId = option.orderId
  432. }
  433. uni.showLoading({
  434. title: '加载中...',
  435. mask: true // 是否显示透明蒙层,防止触摸穿透
  436. })
  437. //获取店铺信息
  438. uni.getLocation({
  439. type: 'gcj02', //返回可以用于uni.openLocation的经纬度
  440. success: (res) => {
  441. // console.log(res, '经纬度')
  442. this.lat = res.latitude
  443. this.lng = res.longitude
  444. }
  445. })
  446. this.getAddressList()
  447. // this.getQishou()
  448. },
  449. onUnload() {
  450. // 页面销毁时清除定时器
  451. if (this.timer) {
  452. clearInterval(this.timer)
  453. }
  454. },
  455. onShow() {
  456. this.getMsgData()
  457. this.addressId = this.addressId ? this.addressId : uni.getStorageSync('addressId')
  458. if (this.addressId) {
  459. this.getAddressDet(this.addressId)
  460. }
  461. this.getShopDet(this.shopId)
  462. // 设置定时器
  463. this.timer = setInterval(() => {
  464. // 定时器执行的操作
  465. // this.getQishou()
  466. // console.log('每分钟执行一次');
  467. // 这里可以放置你需要每分钟执行的代码
  468. this.getCouponList()
  469. this.getHuoList()
  470. }, 60 * 1000) // 60 * 1000 毫秒代表一分钟
  471. },
  472. watch: {
  473. totalPrice1() {
  474. this.getIntegralRules()
  475. }
  476. },
  477. methods: {
  478. // 开关状态变化时触发
  479. handleSwitchChange(e) {
  480. this.ispackType = e.detail.value // 更新状态
  481. console.log('开关状态:', this.ispackType)
  482. // 可在此处添加业务逻辑(如保存状态到缓存、调用接口等)
  483. if (this.ispackType) {
  484. this.packType = 0
  485. } else {
  486. this.packType = 1
  487. }
  488. console.log('堂食或:packType', this.packType)
  489. if (this.orderType == 2) {
  490. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
  491. } else {
  492. if (this.packType == 1) {
  493. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2)
  494. } else {
  495. this.totalPrice1 = parseFloat(this.totalPrice).toFixed(2)
  496. }
  497. }
  498. this.getvipMoney()
  499. let totalMoney = 0
  500. if (this.Vipmoney.canReduceFlag == '1') {
  501. totalMoney = parseFloat(this.totalPrice1 - (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)).toFixed(2)
  502. } else {
  503. totalMoney = parseFloat(
  504. this.totalPrice1 -
  505. (this.coupon.money ? this.coupon.money : 0) -
  506. (this.huodong.discountAmount ? this.huodong.discountAmount : 0) -
  507. (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)
  508. ).toFixed(2)
  509. }
  510. if (totalMoney <= 0) {
  511. this.totalPrice12 = 0.01
  512. } else {
  513. this.totalPrice12 = totalMoney
  514. }
  515. },
  516. //获取会员立减金额
  517. getvipMoney() {
  518. let data = {
  519. // shopId: this.shopId,
  520. userId: uni.getStorageSync('userId')
  521. // originalPrice:this.totalPrice1
  522. }
  523. this.$Request.get(`/app/vip/get-can-reduce/${this.dataList.orderId}`, data).then((res) => {
  524. console.log(res, '会员立减')
  525. if (res.code == 0 && res.data) {
  526. this.Vipmoney = res.data
  527. let totalMoney = 0
  528. if (this.Vipmoney.canReduceFlag == '1') {
  529. totalMoney = parseFloat(this.totalPrice1 - (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)).toFixed(2)
  530. } else {
  531. totalMoney = parseFloat(
  532. this.totalPrice1 -
  533. (this.coupon.money ? this.coupon.money : 0) -
  534. (this.huodong.discountAmount ? this.huodong.discountAmount : 0) -
  535. (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)
  536. ).toFixed(2)
  537. }
  538. if (totalMoney <= 0) {
  539. this.totalPrice12 = 0.01
  540. } else {
  541. this.totalPrice12 = totalMoney
  542. }
  543. this.getCouponList()
  544. }
  545. })
  546. },
  547. getIntegralRules() {
  548. let data = {
  549. money: this.totalPrice12
  550. }
  551. this.$Request.get('/app/userintegral/getIntegralByMoney', data).then((res) => {
  552. console.log(res, '999')
  553. if (res.code == 0) {
  554. this.intergral = res.data.intergral
  555. this.maxIntegral = res.data.maxIntegral
  556. this.ruleAmount1 = res.data.ruleAmount1
  557. this.ruleAmount2 = res.data.ruleAmount2
  558. this.ruleMaxAmount = res.data.ruleMaxAmount
  559. this.ruleValue1 = res.data.ruleValue1
  560. this.ruleValue2 = res.data.ruleValue2
  561. if (res.data.flag == 1) {
  562. this.isIntegral = true
  563. } else {
  564. this.isIntegral = false
  565. }
  566. }
  567. })
  568. },
  569. //获取骑手上下班时间
  570. getQishou() {
  571. this.$Request.get('/app/tbindent/work-time').then((res) => {
  572. if (res.code == 0 && res.data) {
  573. if (this.orderType == 2) {
  574. if (this.autoSendOrder == 0) {
  575. //0是平台配
  576. this.workStart = parseInt(res.data.workingHoursOfRider.substring(0, 2))
  577. this.workStartMin = parseInt(res.data.workingHoursOfRider.substring(3, 5))
  578. this.workEnd = parseInt(res.data.workingHoursOfRider.substring(6, 8))
  579. } else if (this.autoSendOrder == 1) {
  580. this.workStart = parseInt(this.shopDet.businessHours.substring(0, 2))
  581. this.workStartMin = parseInt(this.shopDet.businessHours.substring(3, 5))
  582. this.workEnd = parseInt(this.shopDet.lockHours.substring(0, 2))
  583. }
  584. } else if (this.orderType == 1) {
  585. this.workStart = parseInt(this.shopDet.businessHours.substring(0, 2))
  586. this.workStartMin = parseInt(this.shopDet.businessHours.substring(3, 5))
  587. this.workEnd = parseInt(this.shopDet.lockHours.substring(0, 2))
  588. }
  589. this.yusongTime = res.data.timeOfRider
  590. var date = new Date()
  591. var currentHours = date.getHours()
  592. var currentMinute = date.getMinutes()
  593. var temp = []
  594. // currentHours = 12;
  595. var temp_time = []
  596. //如果当前时间大于20点
  597. var minite = parseInt(this.yusongTime - parseInt(this.yusongTime / 60) * 60)
  598. if (parseInt(this.yusongTime / 60) == 0) {
  599. var h1 = 0
  600. var h2 = parseInt(this.yusongTime - parseInt(this.yusongTime / 60) * 60)
  601. } else {
  602. var h1 = parseInt(this.yusongTime / 60)
  603. var h2 = parseInt(this.yusongTime - parseInt(this.yusongTime / 60) * 60)
  604. }
  605. var acc = currentHours + h1
  606. var bcc = currentMinute + h2
  607. var teshu = this.workStart + h1
  608. if (bcc >= 60) {
  609. var b = bcc - 60
  610. var a = acc + 1
  611. } else {
  612. var b = bcc
  613. var a = acc
  614. }
  615. var a1 = a + 1
  616. var s1 = a.toString()
  617. var s2 = a1.toString()
  618. var e1 = b.toString()
  619. var cc = (this.workStartMin + h2).toString()
  620. if (currentHours >= this.workEnd - h1) {
  621. // this.$queue.setData({
  622. // warning:'当前时间段不在服务范围,现在下单,最早将于明早8点上门安装',
  623. // startDate:'明早 | 8:00-10:00'
  624. // })
  625. var time2 = teshu + 1
  626. uni.showModal({
  627. title: '提示',
  628. content: '当前时间段无骑手配送,现在下单,最早将于明日' + teshu + ':00' + '送达',
  629. success: function (res) {
  630. if (res.confirm) {
  631. } else if (res.cancel) {
  632. }
  633. }
  634. })
  635. // this.data.startDate = '明早 | '+a + ':'+b + '-' + a1 + ':'+b
  636. temp[0] = ['明天']
  637. temp[1] = []
  638. for (let i = teshu; i < this.workEnd - h1; ) {
  639. var i1 = i + 1
  640. var ss1 = i.toString()
  641. var ss2 = i1.toString()
  642. temp[1].push(ss1.padStart(2, 0) + ':' + cc.padStart(2, 0) + '-' + ss2.padStart(2, 0) + ':' + cc.padStart(2, 0))
  643. i += 1
  644. }
  645. } else if (currentHours < this.workStart) {
  646. // this.$queue.setData({
  647. // warning:'当前时间段不在服务范围,现在下单,最早将于今早8点上门安装',
  648. // startDate:'明早 | 8:00-10:00'
  649. // })
  650. var time2 = teshu + 1
  651. uni.showModal({
  652. title: '提示',
  653. content: '当前时间段无骑手配送,现在下单,最早将于今日' + teshu + ':00' + '送达',
  654. success: function (res) {
  655. if (res.confirm) {
  656. } else if (res.cancel) {
  657. }
  658. }
  659. })
  660. temp[0] = ['今天', '明天']
  661. temp[1] = []
  662. for (let i = teshu; i < this.workEnd - h1; ) {
  663. var i1 = i + 1
  664. var ss1 = i.toString()
  665. var ss2 = i1.toString()
  666. temp[1].push(ss1.padStart(2, 0) + ':' + cc.padStart(2, 0) + '-' + ss2.padStart(2, 0) + ':' + cc.padStart(2, 0))
  667. i += 1
  668. }
  669. } else {
  670. // this.$queue.setData({
  671. // startDate:'尽快送达 | 两小时内'
  672. // })
  673. // this.data.startDate = '尽快送达 | 两小时内'
  674. // this.data.startDate = s1.padStart(2,0) + ':'+e1.padStart(2,0) + '-' + s2.padStart(2,0) + ':'+e1.padStart(2,0)
  675. temp[0] = ['今天', '明天']
  676. temp[1] = []
  677. for (let i = a; i < this.workEnd - h1; ) {
  678. var i1 = i + 1
  679. var ss1 = i.toString()
  680. var ss2 = i1.toString()
  681. temp[1].push(ss1.padStart(2, 0) + ':' + e1.padStart(2, 0) + '-' + ss2.padStart(2, 0) + ':' + e1.padStart(2, 0))
  682. i += 1
  683. }
  684. }
  685. // this.$queue.setData({
  686. // multiArray:temp,
  687. // })
  688. this.data.multiArray = temp
  689. if (this.data.warning != '') {
  690. wx.showToast({
  691. title: this.data.warning,
  692. icon: 'none',
  693. duration: 3000
  694. })
  695. }
  696. }
  697. })
  698. },
  699. bindMultiPickerColumnChange: function (e) {
  700. let c = e.detail.column
  701. let v = e.detail.value
  702. var time = []
  703. var date = new Date()
  704. console.log(date)
  705. var date = new Date()
  706. var currentHours = date.getHours()
  707. var currentMinute = date.getMinutes()
  708. var minite = parseInt(this.yusongTime - parseInt(this.yusongTime / 60) * 60)
  709. if (parseInt(this.yusongTime / 60) == 0) {
  710. var h2 = parseInt(this.yusongTime - parseInt(this.yusongTime / 60) * 60)
  711. } else {
  712. var h1 = parseInt(this.yusongTime / 60)
  713. var h2 = parseInt(this.yusongTime - parseInt(this.yusongTime / 60) * 60)
  714. }
  715. var acc = currentHours + h1
  716. var bcc = currentMinute + h2
  717. var teshu = this.workStart + h1
  718. if (bcc >= 60) {
  719. var b = bcc - 60
  720. var a = acc + 1
  721. } else {
  722. var b = bcc
  723. var a = acc
  724. }
  725. var a1 = a + 1
  726. var s1 = a.toString()
  727. var s2 = a1.toString()
  728. var e1 = b.toString()
  729. var cc = (this.workStartMin + h2).toString()
  730. // console.log(this.workStartMin,h2,'kkk')
  731. var temp = this.data.multiArray
  732. // currentHours = 12;
  733. if (c == 0) {
  734. if (temp[c][v] == '今天') {
  735. temp[1] = []
  736. for (let i = a; i < this.workEnd - h1; ) {
  737. var i1 = i + 1
  738. var ss1 = i.toString()
  739. var ss2 = i1.toString()
  740. temp[1].push(ss1.padStart(2, 0) + ':' + e1.padStart(2, 0) + '-' + ss2.padStart(2, 0) + ':' + e1.padStart(2, 0))
  741. i += 1
  742. }
  743. } else {
  744. temp[1] = []
  745. for (let i = teshu; i < this.workEnd - h1; ) {
  746. var i1 = i + 1
  747. var ss1 = i.toString()
  748. var ss2 = i1.toString()
  749. temp[1].push(ss1.padStart(2, 0) + ':' + cc.padStart(2, 0) + '-' + ss2.padStart(2, 0) + ':' + cc.padStart(2, 0))
  750. i += 1
  751. }
  752. }
  753. // this.$queue.setData({
  754. // multiArray:temp
  755. // })
  756. this.data.multiArray = temp
  757. this.$forceUpdate()
  758. }
  759. },
  760. bindStartMultiPickerChange: function (e) {
  761. let temp = this.data.multiArray
  762. // this.$queue.setData({
  763. // startDate:temp[0][e.detail.value[0]]+' | '+temp[1][e.detail.value[1]]
  764. // })
  765. this.data.startDate = temp[0][e.detail.value[0]] + ' | ' + temp[1][e.detail.value[1]]
  766. if (this.data.startDate) {
  767. this.reservationFlag = 1
  768. if (temp[0][e.detail.value[0]] == '今天') {
  769. var date = getDate(new Date()).fullDate
  770. this.expectDeliveryTime = date + ' ' + temp[1][e.detail.value[1]].substring(0, 5) + ':00'
  771. } else if (temp[0][e.detail.value[0]] == '明天') {
  772. var date = getDate(new Date(), 1).fullDate
  773. this.expectDeliveryTime = date + ' ' + temp[1][e.detail.value[1]].substring(0, 5) + ':00'
  774. } else if (temp[0][e.detail.value[0]] == '后天') {
  775. var date = getDate(new Date(), 2).fullDate
  776. this.expectDeliveryTime = date + ' ' + temp[1][e.detail.value[1]].substring(0, 5) + ':00'
  777. }
  778. }
  779. },
  780. goCash() {
  781. uni.navigateTo({
  782. url: '/my/wallet/index'
  783. })
  784. },
  785. getMsgData() {
  786. this.$Request.get('/app/userintegral/findUserMessage').then((res) => {
  787. if (res.code == 0 && res.data) {
  788. this.userMoney = res.data.userMoney ? res.data.userMoney : 0
  789. }
  790. })
  791. },
  792. //获取店铺详情
  793. getShopDet(shopId) {
  794. let data = {
  795. shopId,
  796. lng: this.lng,
  797. lat: this.lat
  798. }
  799. this.$Request.get('/app/goods/selectGoodsList', data).then((res) => {
  800. console.log(res, 'data')
  801. if (res.code == 0 && res.data) {
  802. this.reservationOpenFlag = res.data.goodsShop.reservationOpenFlag
  803. this.autoSendOrder = res.data.goodsShop.autoSendOrder
  804. this.shopDet = res.data.goodsShop
  805. this.ifPaotui = res.data.goodsShop.enableFullReductionFlag
  806. this.getOrderList()
  807. // this.getQishou()
  808. }
  809. })
  810. },
  811. goBack() {
  812. uni.navigateBack({})
  813. },
  814. isShow() {
  815. this.show = true
  816. },
  817. //选择优惠活动弹框
  818. huodongShow() {
  819. this.youhui = true
  820. },
  821. getDistance() {
  822. if (this.address.lng && this.dataList.shopLng) {
  823. let data = {
  824. ol: this.address.lng,
  825. od: this.address.lat,
  826. dl: this.dataList.shopLng,
  827. dd: this.dataList.shopLat
  828. }
  829. this.$Request.post('/app/tbindent/distance', data).then((res) => {
  830. // console.log(res, '963')
  831. if (res.code == 0) {
  832. this.distance = res.data
  833. if (this.distance > Number(this.dataList.distributionDistance)) {
  834. this.isTrue = true
  835. } else {
  836. this.isTrue = false
  837. }
  838. }
  839. })
  840. }
  841. },
  842. close() {
  843. this.show = false
  844. },
  845. closeYouhui() {
  846. this.youhui = false
  847. },
  848. switchTab(e) {
  849. // this.page = 1
  850. // this.status = ''
  851. this.coupon = ''
  852. this.huodong = ''
  853. this.orderType = e
  854. // this.current = 0;
  855. console.log(e)
  856. if (JSON.stringify(this.address) != '{}') {
  857. this.getDistance()
  858. }
  859. if (this.orderType == 2) {
  860. this.packType = 1
  861. this.ispackType = false
  862. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
  863. this.getvipMoney()
  864. } else {
  865. this.packType = 1
  866. this.ispackType = false
  867. if (this.packType == 1) {
  868. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2)
  869. } else {
  870. this.totalPrice1 = parseFloat(this.totalPrice).toFixed(2)
  871. }
  872. this.getvipMoney()
  873. }
  874. let totalMoney = 0
  875. if (this.Vipmoney.canReduceFlag == '1') {
  876. totalMoney = parseFloat(this.totalPrice1 - (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)).toFixed(2)
  877. } else {
  878. totalMoney = parseFloat(
  879. this.totalPrice1 -
  880. (this.coupon.money ? this.coupon.money : 0) -
  881. (this.huodong.discountAmount ? this.huodong.discountAmount : 0) -
  882. (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)
  883. ).toFixed(2)
  884. }
  885. if (totalMoney <= 0) {
  886. this.totalPrice12 = 0.01
  887. } else {
  888. this.totalPrice12 = totalMoney
  889. }
  890. if (this.coupon) {
  891. if (this.orderType == 2) {
  892. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
  893. } else {
  894. if (this.packType == 1) {
  895. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2)
  896. } else {
  897. this.totalPrice1 = parseFloat(this.totalPrice).toFixed(2)
  898. }
  899. }
  900. let totalMoney = 0
  901. if (this.Vipmoney.canReduceFlag == '1') {
  902. totalMoney = parseFloat(this.totalPrice1 - (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)).toFixed(2)
  903. } else {
  904. totalMoney = parseFloat(
  905. this.totalPrice1 -
  906. (this.coupon.money ? this.coupon.money : 0) -
  907. (this.huodong.discountAmount ? this.huodong.discountAmount : 0) -
  908. (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)
  909. ).toFixed(2)
  910. }
  911. if (totalMoney <= 0) {
  912. this.totalPrice12 = 0.01
  913. } else {
  914. this.totalPrice12 = totalMoney
  915. }
  916. }
  917. if (this.huodong) {
  918. if (this.orderType == 2) {
  919. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
  920. } else {
  921. if (this.packType == 1) {
  922. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2)
  923. } else {
  924. this.totalPrice1 = parseFloat(this.totalPrice).toFixed(2)
  925. }
  926. }
  927. let totalMoney = 0
  928. if (this.Vipmoney.canReduceFlag == '1') {
  929. totalMoney = parseFloat(this.totalPrice1 - (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)).toFixed(2)
  930. } else {
  931. totalMoney = parseFloat(
  932. this.totalPrice1 -
  933. (this.coupon.money ? this.coupon.money : 0) -
  934. (this.huodong.discountAmount ? this.huodong.discountAmount : 0) -
  935. (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)
  936. ).toFixed(2)
  937. }
  938. if (totalMoney <= 0) {
  939. this.totalPrice12 = 0.01
  940. } else {
  941. this.totalPrice12 = totalMoney
  942. }
  943. }
  944. if (this.Vipmoney.canReduceFlag == '1') {
  945. if (this.orderType == 2) {
  946. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
  947. } else {
  948. if (this.packType == 1) {
  949. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2)
  950. } else {
  951. this.totalPrice1 = parseFloat(this.totalPrice).toFixed(2)
  952. }
  953. }
  954. let totalMoney = 0
  955. if (this.Vipmoney.canReduceFlag == '1') {
  956. totalMoney = parseFloat(this.totalPrice1 - (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)).toFixed(2)
  957. } else {
  958. totalMoney = parseFloat(
  959. this.totalPrice1 -
  960. (this.coupon.money ? this.coupon.money : 0) -
  961. (this.huodong.discountAmount ? this.huodong.discountAmount : 0) -
  962. (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)
  963. ).toFixed(2)
  964. }
  965. if (totalMoney <= 0) {
  966. this.totalPrice12 = 0.01
  967. } else {
  968. this.totalPrice12 = totalMoney
  969. }
  970. }
  971. },
  972. // 删除优惠券
  973. detCoupon() {
  974. let data = {
  975. orderId: this.dataList.orderId
  976. }
  977. this.$Request.post('/app/order/deleteCouponByOrderId', data).then((res) => {
  978. if (res.code == 0) {
  979. }
  980. })
  981. },
  982. // 选择优惠券
  983. selCoupon(item) {
  984. this.coupon = item
  985. if (this.orderType == 2) {
  986. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
  987. } else {
  988. if (this.packType == 1) {
  989. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2)
  990. } else {
  991. this.totalPrice1 = parseFloat(this.totalPrice).toFixed(2)
  992. }
  993. }
  994. let totalMoney = 0
  995. if (this.Vipmoney.canReduceFlag == '1') {
  996. totalMoney = parseFloat(this.totalPrice1 - (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)).toFixed(2)
  997. } else {
  998. totalMoney = parseFloat(
  999. this.totalPrice1 -
  1000. (this.coupon.money ? this.coupon.money : 0) -
  1001. (this.huodong.discountAmount ? this.huodong.discountAmount : 0) -
  1002. (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)
  1003. ).toFixed(2)
  1004. }
  1005. if (totalMoney <= 0) {
  1006. this.totalPrice12 = 0.01
  1007. } else {
  1008. this.totalPrice12 = totalMoney
  1009. }
  1010. let data = {
  1011. parentId: this.dataList.parentId,
  1012. couponId: this.coupon ? this.coupon.id : ''
  1013. }
  1014. this.$Request.post('/app/order/employCoupon', data).then((res) => {
  1015. if (res.code == 0) {
  1016. this.show = false
  1017. } else {
  1018. this.$queue.showToast(res.msg)
  1019. }
  1020. })
  1021. },
  1022. //选择活动activityId
  1023. selctHuo(item) {
  1024. this.huodong = item
  1025. if (this.orderType == 2) {
  1026. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
  1027. } else {
  1028. if (this.packType == 1) {
  1029. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2)
  1030. } else {
  1031. this.totalPrice1 = parseFloat(this.totalPrice).toFixed(2)
  1032. }
  1033. }
  1034. let totalMoney = 0
  1035. if (this.Vipmoney.canReduceFlag == '1') {
  1036. totalMoney = parseFloat(this.totalPrice1 - (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)).toFixed(2)
  1037. } else {
  1038. totalMoney = parseFloat(
  1039. this.totalPrice1 -
  1040. (this.coupon.money ? this.coupon.money : 0) -
  1041. (this.huodong.discountAmount ? this.huodong.discountAmount : 0) -
  1042. (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)
  1043. ).toFixed(2)
  1044. }
  1045. if (totalMoney <= 0) {
  1046. this.totalPrice12 = 0.01
  1047. } else {
  1048. this.totalPrice12 = totalMoney
  1049. }
  1050. this.youhui = false
  1051. },
  1052. // 获取优惠券列表
  1053. getCouponList() {
  1054. console.log(this.totalPrice)
  1055. console.log(this.dataList.shopId)
  1056. let minMoney =
  1057. this.orderType == 2
  1058. ? parseFloat(parseFloat(this.totalPrice) + parseFloat(this.paotuiMoney) + parseFloat(this.dabaoMoney)).toFixed(2)
  1059. : parseFloat(this.totalPrice).toFixed(2)
  1060. let data = {
  1061. shopId: this.dataList.shopId,
  1062. page: 1,
  1063. limit: 20,
  1064. minMoney: minMoney
  1065. }
  1066. this.$Request.get('/app/coupon/selectUserCouponList', data).then((res) => {
  1067. console.log(res, '优惠券')
  1068. if (res.code == 0) {
  1069. this.couponList = res.data.list
  1070. if (this.coupon) {
  1071. let activityExists = this.couponList.some((item) => item.couponId === this.coupon.couponId)
  1072. if (!activityExists) {
  1073. this.coupon = ''
  1074. if (this.orderType == 2) {
  1075. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
  1076. } else {
  1077. if (this.packType == 1) {
  1078. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2)
  1079. } else {
  1080. this.totalPrice1 = parseFloat(this.totalPrice).toFixed(2)
  1081. }
  1082. }
  1083. let totalMoney = 0
  1084. if (this.Vipmoney.canReduceFlag == '1') {
  1085. totalMoney = parseFloat(this.totalPrice1 - (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)).toFixed(2)
  1086. } else {
  1087. totalMoney = parseFloat(
  1088. this.totalPrice1 -
  1089. (this.coupon.money ? this.coupon.money : 0) -
  1090. (this.huodong.discountAmount ? this.huodong.discountAmount : 0) -
  1091. (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)
  1092. ).toFixed(2)
  1093. }
  1094. if (totalMoney <= 0) {
  1095. this.totalPrice12 = 0.01
  1096. } else {
  1097. this.totalPrice12 = totalMoney
  1098. }
  1099. uni.showModal({
  1100. title: '提示',
  1101. content: '当前选择的优惠券已过期,请重新选择',
  1102. success: function (res) {
  1103. if (res.confirm) {
  1104. this.coupon = ''
  1105. } else if (res.cancel) {
  1106. this.coupon = ''
  1107. }
  1108. }
  1109. })
  1110. }
  1111. }
  1112. }
  1113. })
  1114. },
  1115. // 优惠活动列表
  1116. getHuoList() {
  1117. let data = {
  1118. orderId: this.dataList.orderId
  1119. }
  1120. this.$Request.get(`/app/activity/suit-activity/${this.dataList.orderId}`, data).then((res) => {
  1121. if (res.code == 0) {
  1122. this.huoList = res.data
  1123. if (this.huodong) {
  1124. // console.log(this.huodong,'有呢')
  1125. let activityExists = this.huoList.some((item) => item.activityId === this.huodong.activityId)
  1126. if (!activityExists) {
  1127. this.huodong = ''
  1128. if (this.orderType == 2) {
  1129. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
  1130. } else {
  1131. if (this.packType == 1) {
  1132. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2)
  1133. } else {
  1134. this.totalPrice1 = parseFloat(this.totalPrice).toFixed(2)
  1135. }
  1136. }
  1137. let totalMoney = 0
  1138. if (this.Vipmoney.canReduceFlag == '1') {
  1139. totalMoney = parseFloat(this.totalPrice1 - (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)).toFixed(2)
  1140. } else {
  1141. totalMoney = parseFloat(
  1142. this.totalPrice1 -
  1143. (this.coupon.money ? this.coupon.money : 0) -
  1144. (this.huodong.discountAmount ? this.huodong.discountAmount : 0) -
  1145. (this.Vipmoney.reduceAmount ? this.Vipmoney.reduceAmount : 0)
  1146. ).toFixed(2)
  1147. }
  1148. if (totalMoney <= 0) {
  1149. this.totalPrice12 = 0.01
  1150. } else {
  1151. this.totalPrice12 = totalMoney
  1152. }
  1153. uni.showModal({
  1154. title: '提示',
  1155. content: '当前选择的优惠活动已过期,请重新选择',
  1156. success: function (res) {
  1157. if (res.confirm) {
  1158. this.huodong = ''
  1159. } else if (res.cancel) {
  1160. this.huodong = ''
  1161. }
  1162. }
  1163. })
  1164. }
  1165. }
  1166. // 匹配出最优惠的活动
  1167. if (this.huoList.length) {
  1168. this.huodong = this.huoList.reduce((prev, current) => (prev.discountAmount > current.discountAmount ? prev : current))
  1169. this.selctHuo(this.huodong)
  1170. }
  1171. }
  1172. })
  1173. },
  1174. // 获取订单信息
  1175. getOrderList() {
  1176. this.paotuiMoney = 0
  1177. this.totalPrice1 = 0
  1178. this.totalPrice12 = 0
  1179. let data = {
  1180. orderId: this.orderId
  1181. }
  1182. this.$Request.get('/app/order/selectBuyGoods', data).then((res) => {
  1183. console.log(res, '6661')
  1184. uni.hideLoading()
  1185. if (res.code == 0) {
  1186. this.dataList = res.data
  1187. this.GoodsorderId = res.data.orderId
  1188. // this.getShopDet(res.data.shopId)
  1189. // this.dataList.orderGoodsList[0].goodsPicture = this.dataList.orderGoodsList[0].goodsPicture.split(',')
  1190. // console.log(this.dataList.orderGoodsList)
  1191. if (this.dataList) {
  1192. this.dabaoMoney = 0
  1193. this.dataList.orderGoodsList.forEach((res) => {
  1194. res.goodsPicture = res.goodsPicture.split(',')
  1195. this.dabaoMoney += res.goodsPack * res.goodsNum
  1196. this.goodsMoney += res.goodsPrice * res.goodsNum
  1197. this.goodsMoney = parseFloat(this.goodsMoney + this.dabaoMoney)
  1198. })
  1199. }
  1200. console.log(this.ifPaotui, 'this.ifPaotui')
  1201. if (this.ifPaotui == 1) {
  1202. this.paotuiMoney = this.dataList.errandMoney
  1203. } else if (this.ifPaotui == 0) {
  1204. // 判断商品金额是否大于最低减免配送费金额
  1205. if (Number(this.goodsMoney) >= Number(this.dataList.exemptMinMoney)) {
  1206. console.log('跑腿费')
  1207. this.paotuiMoney = 0
  1208. } else {
  1209. this.paotuiMoney = this.dataList.errandMoney
  1210. }
  1211. }
  1212. this.totalPrice = res.data.payMoney * 1
  1213. console.log(this.dabaoMoney, '打包')
  1214. console.log(this.paotuiMoney, '跑腿')
  1215. if (this.orderType == 2) {
  1216. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
  1217. } else {
  1218. if (this.packType == 1) {
  1219. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2)
  1220. } else {
  1221. this.totalPrice1 = parseFloat(this.totalPrice).toFixed(2)
  1222. }
  1223. }
  1224. this.getvipMoney()
  1225. // let totalMoney =0
  1226. // if(this.Vipmoney.canReduceFlag=='1'){
  1227. // totalMoney = parseFloat(this.totalPrice1 -(this.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount:0)).toFixed(2)
  1228. // }else{
  1229. // totalMoney = parseFloat(this.totalPrice1 - (this.coupon.money ? this.coupon.money : 0) - (this.huodong.discountAmount ? this.huodong.discountAmount : 0)-(this.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount:0)).toFixed(2)
  1230. // }
  1231. // if (totalMoney <= 0) {
  1232. // this.totalPrice12 = 0.01
  1233. // } else {
  1234. // this.totalPrice12 = totalMoney
  1235. // }
  1236. console.log(this.dataList)
  1237. // this.getvipMoney()
  1238. this.getCouponList()
  1239. this.getHuoList()
  1240. this.detCoupon()
  1241. this.getDistance()
  1242. }
  1243. })
  1244. },
  1245. selectWay: function (item) {
  1246. this.openWay = item.id
  1247. },
  1248. takeReark() {
  1249. let datas = {
  1250. orderId: this.GoodsorderId,
  1251. remark: this.remark
  1252. }
  1253. this.$Request.post('/app/order/updateOrdersRemark', datas).then((res) => {
  1254. // uni.hideLoading();
  1255. if (res.code == 0) {
  1256. } else {
  1257. uni.showToast({
  1258. title: res.msg,
  1259. icon: 'none'
  1260. })
  1261. }
  1262. })
  1263. },
  1264. // 立即结算
  1265. toSettlement() {
  1266. if (this.isThrottle == false) {
  1267. return
  1268. }
  1269. if (this.isTrue && this.orderType == 2) {
  1270. uni.showToast({
  1271. title: '超出配送范围',
  1272. icon: 'none'
  1273. })
  1274. reutrn
  1275. }
  1276. if (this.orderType == 2 && !this.address.addressId) {
  1277. uni.showToast({
  1278. title: '请选择收货地址',
  1279. icon: 'none'
  1280. })
  1281. return
  1282. }
  1283. if (this.remark) {
  1284. this.takeReark()
  1285. }
  1286. uni.showLoading({
  1287. title: '支付中...',
  1288. mask: true // 是否显示透明蒙层,防止触摸穿透
  1289. })
  1290. this.isThrottle = false
  1291. if (this.openWay == 1) {
  1292. let data = {
  1293. userId: uni.getStorageSync('userId'),
  1294. type: 1, //支付方式 1表示微信支付、4或5表示支付宝支付
  1295. activityId: this.huodong ? this.huodong.activityId : '',
  1296. reservationFlag: this.reservationFlag, //是否预约单 1是、0否
  1297. expectDeliveryTime: this.expectDeliveryTime, //期待送达时间 yyyy-MM-dd HH:mm:ss
  1298. parentId: this.dataList.parentId,
  1299. couponId: this.coupon ? this.coupon.id : '',
  1300. addressId: this.address.addressId ? this.address.addressId : '',
  1301. orderType: this.orderType
  1302. }
  1303. this.$Request.post('/app/wxPay/balanceOrder', data).then((res) => {
  1304. if (res.code == 0) {
  1305. uni.hideLoading()
  1306. this.$queue.showToast('支付成功')
  1307. setTimeout(() => {
  1308. this.isThrottle = true
  1309. uni.switchTab({
  1310. url: '/pages/order/index'
  1311. })
  1312. }, 1000)
  1313. } else {
  1314. this.isThrottle = true
  1315. this.$queue.showToast(res.msg)
  1316. }
  1317. })
  1318. } else if (this.openWay == 2) {
  1319. // #ifdef H5
  1320. let data = {
  1321. userId: uni.getStorageSync('userId'),
  1322. type: 1, //支付方式 1表示微信支付、4或5表示支付宝支付
  1323. activityId: this.huodong ? this.huodong.activityId : '',
  1324. reservationFlag: this.reservationFlag, //是否预约单 1是、0否
  1325. expectDeliveryTime: this.expectDeliveryTime, //期待送达时间 yyyy-MM-dd HH:mm:ss
  1326. parentId: this.dataList.parentId,
  1327. couponId: this.coupon ? this.coupon.id : '',
  1328. addressId: this.address.addressId ? this.address.addressId : '',
  1329. orderType: this.orderType,
  1330. type: 2
  1331. }
  1332. this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then((res) => {
  1333. if (res.code == 0) {
  1334. this.callPay(res.data)
  1335. } else {
  1336. this.isThrottle = true
  1337. uni.showToast({
  1338. title: res.msg,
  1339. icon: 'none'
  1340. })
  1341. }
  1342. })
  1343. // #endif
  1344. // #ifdef MP-WEIXIN
  1345. this.$Request.get('/app/new-pay/enable-new-pay').then((res) => {
  1346. console.log(res, '666')
  1347. if (res.code == 0) {
  1348. let data = {
  1349. userId: uni.getStorageSync('userId'),
  1350. // type: 4, //支付方式 1表示微信支付、4或5表示支付宝支付
  1351. activityId: this.huodong ? this.huodong.activityId : '',
  1352. reservationFlag: this.reservationFlag, //是否预约单 1是、0否
  1353. expectDeliveryTime: this.expectDeliveryTime, //期待送达时间 yyyy-MM-dd HH:mm:ss
  1354. parentId: this.dataList.parentId,
  1355. couponId: this.coupon ? this.coupon.id : '',
  1356. addressId: this.address.addressId ? this.address.addressId : '',
  1357. orderType: this.orderType,
  1358. type: res.enable ? 1 : 3,
  1359. idCard: this.idcard1,
  1360. packType: this.packType
  1361. }
  1362. console.log(data)
  1363. if (res.enable) {
  1364. console.log('xin')
  1365. this.newPay(data)
  1366. } else {
  1367. console.log('jiu')
  1368. this.oldPay(data)
  1369. }
  1370. }
  1371. })
  1372. // #endif
  1373. // #ifdef APP
  1374. let data = {
  1375. type: 1,
  1376. parentId: this.dataList.parentId,
  1377. couponId: this.coupon ? this.coupon.id : '',
  1378. addressId: this.address.addressId ? this.address.addressId : '',
  1379. orderType: this.orderType
  1380. }
  1381. this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then((res) => {
  1382. console.log(res)
  1383. this.showpay = false
  1384. if (res.code == 0) {
  1385. this.isCheckPay(res.code, 'wxpay', JSON.stringify(res.data))
  1386. } else {
  1387. this.isThrottle = true
  1388. }
  1389. })
  1390. // #endif
  1391. } else if (this.openWay == 3) {
  1392. // #ifdef H5
  1393. let data = {
  1394. type: 5,
  1395. parentId: this.dataList.parentId,
  1396. couponId: this.coupon ? this.coupon.id : '',
  1397. addressId: this.address.addressId ? this.address.addressId : '',
  1398. orderType: this.orderType
  1399. }
  1400. this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then((res) => {
  1401. this.showpay = false
  1402. this.isThrottle = true
  1403. const div = document.createElement('div')
  1404. div.innerHTML = res.data //此处form就是后台返回接收到的数据
  1405. document.body.appendChild(div)
  1406. document.forms[0].submit()
  1407. })
  1408. // #endif
  1409. // #ifdef APP-PLUS
  1410. let data = {
  1411. type: 4,
  1412. parentId: this.dataList.parentId,
  1413. couponId: this.coupon ? this.coupon.id : '',
  1414. addressId: this.address.addressId ? this.address.addressId : '',
  1415. orderType: this.orderType
  1416. }
  1417. this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then((res) => {
  1418. this.showpay = false
  1419. this.setPayment('alipay', res.data)
  1420. })
  1421. // #endif
  1422. }
  1423. },
  1424. newPay(data) {
  1425. this.$Request.get('/app/order/get-pay-param', data).then((res) => {
  1426. console.log(res, '新支付')
  1427. if (res.code == 0) {
  1428. uni.requestPayment({
  1429. provider: 'wxpay',
  1430. timeStamp: res.timeStamp,
  1431. nonceStr: res.nonceStr,
  1432. package: res.packageStr,
  1433. signType: res.signType,
  1434. paySign: res.paySign,
  1435. success: (suc) => {
  1436. uni.hideLoading()
  1437. this.$queue.showToast('支付成功')
  1438. setTimeout(() => {
  1439. this.isThrottle = true
  1440. uni.switchTab({
  1441. url: '/pages/order/index'
  1442. })
  1443. }, 1000)
  1444. },
  1445. fail: (err) => {
  1446. console.log('fail:' + JSON.stringify(err))
  1447. this.isThrottle = true
  1448. uni.setStorageSync('isClear', true)
  1449. uni.showToast({
  1450. title: '支付失败',
  1451. icon: 'none',
  1452. mask: true
  1453. })
  1454. setTimeout(() => {
  1455. uni.reLaunch({
  1456. url: '/pages/order/index'
  1457. })
  1458. }, 1500)
  1459. }
  1460. })
  1461. } else {
  1462. uni.showToast({
  1463. title: res.msg,
  1464. icon: 'none'
  1465. })
  1466. this.isThrottle = true
  1467. }
  1468. })
  1469. },
  1470. oldPay(data) {
  1471. this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then((res) => {
  1472. console.log(res, '旧支付')
  1473. // uni.hideLoading();
  1474. if (res.code == 0) {
  1475. uni.requestPayment({
  1476. provider: 'wxpay',
  1477. timeStamp: res.data.timestamp,
  1478. nonceStr: res.data.noncestr,
  1479. package: res.data.package,
  1480. signType: res.data.signType,
  1481. paySign: res.data.sign,
  1482. success: (suc) => {
  1483. uni.hideLoading()
  1484. this.$queue.showToast('支付成功')
  1485. setTimeout(() => {
  1486. this.isThrottle = true
  1487. uni.switchTab({
  1488. url: '/pages/order/index'
  1489. })
  1490. }, 1000)
  1491. },
  1492. fail: (err) => {
  1493. console.log('fail:' + JSON.stringify(err))
  1494. this.isThrottle = true
  1495. uni.setStorageSync('isClear', true)
  1496. uni.showToast({
  1497. title: '支付失败',
  1498. icon: 'none',
  1499. mask: true
  1500. })
  1501. setTimeout(() => {
  1502. uni.reLaunch({
  1503. url: '/pages/order/index'
  1504. })
  1505. }, 1500)
  1506. }
  1507. })
  1508. } else {
  1509. uni.showToast({
  1510. title: res.msg,
  1511. icon: 'none'
  1512. })
  1513. this.isThrottle = true
  1514. }
  1515. })
  1516. },
  1517. callPay: function (response) {
  1518. if (typeof WeixinJSBridge === 'undefined') {
  1519. if (document.addEventListener) {
  1520. document.addEventListener('WeixinJSBridgeReady', this.onBridgeReady(response), false)
  1521. } else if (document.attachEvent) {
  1522. document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady(response))
  1523. document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady(response))
  1524. }
  1525. } else {
  1526. this.onBridgeReady(response)
  1527. }
  1528. },
  1529. onBridgeReady: function (response) {
  1530. let that = this
  1531. if (!response.package) {
  1532. return
  1533. }
  1534. WeixinJSBridge.invoke(
  1535. 'getBrandWCPayRequest',
  1536. {
  1537. appId: response.appid, //公众号名称,由商户传入
  1538. timeStamp: response.timestamp, //时间戳,自1970年以来的秒数
  1539. nonceStr: response.noncestr, //随机串
  1540. package: response.package,
  1541. signType: response.signType, //微信签名方式:
  1542. paySign: response.sign //微信签名
  1543. },
  1544. function (res) {
  1545. if (res.err_msg === 'get_brand_wcpay_request:ok') {
  1546. // 使用以上方式判断前端返回,微信团队郑重提示:
  1547. //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
  1548. uni.hideLoading()
  1549. uni.showToast({
  1550. title: '支付成功',
  1551. icon: 'success'
  1552. })
  1553. setTimeout(function () {
  1554. that.isThrottle = true
  1555. uni.switchTab({
  1556. url: '/pages/order/index'
  1557. })
  1558. }, 1000)
  1559. } else {
  1560. that.isThrottle = true
  1561. uni.hideLoading()
  1562. }
  1563. WeixinJSBridge.log(response.err_msg)
  1564. }
  1565. )
  1566. },
  1567. isCheckPay(code, name, order) {
  1568. if (code == 0) {
  1569. console.log('999999999999')
  1570. this.setPayment(name, order)
  1571. } else {
  1572. uni.hideLoading()
  1573. uni.showToast({
  1574. title: '支付信息有误'
  1575. })
  1576. this.isThrottle = true
  1577. }
  1578. },
  1579. setPayment(name, order) {
  1580. console.log(777777777, name, order)
  1581. uni.requestPayment({
  1582. provider: name,
  1583. orderInfo: order, //微信、支付宝订单数据
  1584. success: (res) => {
  1585. uni.hideLoading()
  1586. uni.showLoading({
  1587. title: '支付成功',
  1588. icon: 'none'
  1589. })
  1590. setTimeout(() => {
  1591. this.isThrottle = true
  1592. uni.navigateBack()
  1593. }, 1000)
  1594. },
  1595. fail: (err) => {
  1596. this.isThrottle = true
  1597. uni.hideLoading()
  1598. },
  1599. complete: () => {
  1600. this.isThrottle = true
  1601. uni.hideLoading()
  1602. }
  1603. })
  1604. },
  1605. // 获取选择的地址
  1606. getAddressDet(e) {
  1607. let data = {
  1608. addressId: e
  1609. }
  1610. this.$Request.get('/app/address/selectAddressById', data).then((res) => {
  1611. console.log(res, 741258)
  1612. if (res.code == 0) {
  1613. this.address = res.data
  1614. if (this.address.insideAddressId) {
  1615. this.getInsideDeliveryFee(this.address.insideAddressId)
  1616. } else {
  1617. this.getInsideDeliveryFee(0)
  1618. }
  1619. if (JSON.stringify(this.address) != '{}') {
  1620. this.getDistance()
  1621. }
  1622. uni.removeStorageSync('addressId')
  1623. }
  1624. })
  1625. },
  1626. // 获取地址列表
  1627. getAddressList() {
  1628. let data = {
  1629. page: 1,
  1630. limit: 100
  1631. }
  1632. this.$Request.get('/app/address/selectAddressList', data).then((res) => {
  1633. if (res.code == 0 && res.data.list.length) {
  1634. this.address = res.data.list[0]
  1635. res.data.list.forEach((ret) => {
  1636. if (ret.addressDefault == 1) {
  1637. this.address = ret
  1638. }
  1639. })
  1640. if (this.address.insideAddressId) {
  1641. this.getInsideDeliveryFee(this.address.insideAddressId)
  1642. } else {
  1643. this.getInsideDeliveryFee(0)
  1644. }
  1645. // console.log(this.address, '我的地址列表460777')
  1646. if (JSON.stringify(this.address) != '{}') {
  1647. this.getDistance()
  1648. }
  1649. }
  1650. })
  1651. },
  1652. getInsideDeliveryFee(insideAddressId) {
  1653. this.$Request.get(`/app/inside-address/${insideAddressId}`).then((res) => {
  1654. // console.log(res, 987456)
  1655. if (res.code == 0) {
  1656. this.address.insideDeliveryFee = res.data.deliveryFee || 0
  1657. }
  1658. })
  1659. },
  1660. goAddress() {
  1661. uni.navigateTo({
  1662. url: '/my/address/index?add=1'
  1663. })
  1664. },
  1665. // 点击调起地图查看位置
  1666. goMap() {
  1667. let lati = parseFloat(this.dataList.shopLat)
  1668. let longi = parseFloat(this.dataList.shopLng)
  1669. uni.authorize({
  1670. scope: 'scope.userLocation',
  1671. success: (res) => {
  1672. uni.openLocation({
  1673. name: this.dataList.shopName,
  1674. latitude: lati,
  1675. longitude: longi,
  1676. success: () => {}
  1677. })
  1678. },
  1679. fail(err) {}
  1680. })
  1681. },
  1682. // 打电话
  1683. call() {
  1684. uni.makePhoneCall({
  1685. phoneNumber: this.dataList.shopPhone
  1686. })
  1687. }
  1688. }
  1689. }
  1690. </script>
  1691. <style scoped>
  1692. .hintPopul {
  1693. width: 100%;
  1694. height: 100vh;
  1695. position: fixed;
  1696. top: 0;
  1697. background: rgba(0, 0, 0, 0.4);
  1698. z-index: 999;
  1699. }
  1700. .content_ {
  1701. position: absolute;
  1702. left: 0;
  1703. right: 0;
  1704. top: 0;
  1705. bottom: 0;
  1706. margin: auto;
  1707. text-align: center;
  1708. width: 500rpx;
  1709. height: 400rpx;
  1710. border-radius: 20rpx;
  1711. background-color: #fff;
  1712. padding-top: 120rpx;
  1713. }
  1714. .content_ image {
  1715. position: absolute;
  1716. top: -50rpx;
  1717. left: 0;
  1718. right: 0;
  1719. margin: auto;
  1720. }
  1721. .hintText {
  1722. font-size: 30rpx;
  1723. }
  1724. .Btns {
  1725. width: 460rpx;
  1726. height: 60rpx;
  1727. line-height: 60rpx;
  1728. text-align: center;
  1729. background: #fcd202;
  1730. font-size: 28rpx;
  1731. border: 2rpx solid #fcd202;
  1732. color: #333333;
  1733. border-radius: 50rpx;
  1734. font-weight: 700;
  1735. margin: auto;
  1736. }
  1737. .goods_address {
  1738. width: 94%;
  1739. background: #ffffff;
  1740. height: 120rpx;
  1741. margin: 20rpx auto 0;
  1742. border-radius: 18rpx;
  1743. }
  1744. .address_box {
  1745. width: 90%;
  1746. margin: 0 auto;
  1747. height: 120rpx;
  1748. display: flex;
  1749. line-height: 120rpx;
  1750. }
  1751. .address_name {
  1752. flex: 1;
  1753. font-size: 30rpx;
  1754. }
  1755. .address_image {
  1756. /* flex: 1; */
  1757. display: flex;
  1758. justify-content: flex-end;
  1759. align-items: center;
  1760. }
  1761. .address_image image {
  1762. width: 15rpx;
  1763. height: 30rpx;
  1764. }
  1765. .songda_image image {
  1766. width: 20rpx;
  1767. height: 30rpx;
  1768. margin-left: 20rpx;
  1769. }
  1770. /* 地址 */
  1771. .address {
  1772. width: 88%;
  1773. margin: 3% auto;
  1774. padding: 3%;
  1775. display: flex;
  1776. background-color: #ffffff;
  1777. border-radius: 18rpx;
  1778. }
  1779. .adderss_le {
  1780. width: 90%;
  1781. line-height: 1.5;
  1782. }
  1783. .adderss_le_text {
  1784. font-size: 30rpx;
  1785. font-weight: bold;
  1786. color: #333333;
  1787. }
  1788. .adderss_le_text2 {
  1789. font-size: 24rpx;
  1790. font-weight: 500;
  1791. color: #999999;
  1792. display: flex;
  1793. }
  1794. .adderss_le_text2 view {
  1795. margin-left: 2%;
  1796. }
  1797. .adderss_le_text2 view:first-child {
  1798. margin-left: 0;
  1799. }
  1800. .adderss_ri {
  1801. width: 10%;
  1802. text-align: right;
  1803. line-height: 3;
  1804. }
  1805. .adderss_ri image {
  1806. width: 18rpx;
  1807. height: 30rpx;
  1808. }
  1809. /* 商品 */
  1810. .food {
  1811. width: 94%;
  1812. margin: 3% auto;
  1813. padding: 3%;
  1814. background-color: #ffffff;
  1815. border-radius: 18rpx;
  1816. }
  1817. .food_top {
  1818. display: flex;
  1819. justify-content: space-between;
  1820. align-items: center;
  1821. font-size: 32rpx;
  1822. font-weight: bold;
  1823. }
  1824. .food_bottom {
  1825. margin-top: 20rpx;
  1826. color: #666666;
  1827. font-size: 28rpx;
  1828. line-height: 45rpx;
  1829. }
  1830. .bottom_text {
  1831. color: #ea0018;
  1832. }
  1833. .tosend_header_food {
  1834. width: 100%;
  1835. display: flex;
  1836. margin-top: 3%;
  1837. }
  1838. .tosend_header_food_le {
  1839. width: 15%;
  1840. }
  1841. .tosend_header_food_le image {
  1842. width: 110rpx;
  1843. height: 110rpx;
  1844. }
  1845. .tosend_header_food_ce {
  1846. margin: 0 0 0 4%;
  1847. width: 57%;
  1848. }
  1849. .tosend_header_food_ri {
  1850. text-align: right;
  1851. width: 25%;
  1852. }
  1853. .tosend_header_food_text {
  1854. font-size: 34rpx;
  1855. font-weight: 500;
  1856. color: #333333;
  1857. line-height: 1.8;
  1858. }
  1859. .tosend_header_food_text text {
  1860. font-size: 25rpx;
  1861. }
  1862. .tosend_header_food_text2 {
  1863. font-size: 30rpx;
  1864. font-weight: 500;
  1865. color: #999999;
  1866. }
  1867. .do_top {
  1868. padding-top: 3%;
  1869. }
  1870. .do_bot {
  1871. padding-bottom: 3%;
  1872. border-bottom: 2rpx solid #e6e6e6;
  1873. }
  1874. .tosend_header_do {
  1875. width: 100%;
  1876. color: #333333;
  1877. font-size: 30rpx;
  1878. display: flex;
  1879. margin-top: 20rpx;
  1880. line-height: 1.5;
  1881. }
  1882. .tosend_header_do view {
  1883. /* flex: 1; */
  1884. }
  1885. .tosend_header_do_ri {
  1886. text-align: right;
  1887. }
  1888. .tosend_header_do_le2 {
  1889. font-family: PingFang SC;
  1890. font-weight: 500;
  1891. color: #999999;
  1892. padding-top: 1.5%;
  1893. }
  1894. .tosend_header_do_ri2 {
  1895. text-align: right;
  1896. color: #ea0000;
  1897. font-size: 40rpx;
  1898. }
  1899. .tosend_header_do_ri2 text {
  1900. font-size: 30rpx;
  1901. }
  1902. /* 支付 */
  1903. /* .payment_all{
  1904. width: 88%;margin: 3% auto;padding: 3%;background-color: #FFFFFF;
  1905. border-radius: 18rpx;
  1906. }
  1907. .payment{
  1908. width: 100%;display: flex;margin-top: 3%;
  1909. }
  1910. .payment_le{
  1911. width: 13%;
  1912. }
  1913. .payment_le image{
  1914. width: 60rpx;height: 60rpx;
  1915. }
  1916. .payment_ce{
  1917. width: 52%;
  1918. font-size: 30rpx;
  1919. font-weight: bold;
  1920. color: #333333;line-height: 60rpx;
  1921. }
  1922. .payment_ri{
  1923. width: 35%;text-align: right;line-height: 60rpx;
  1924. } */
  1925. /* 结算 */
  1926. .goorder {
  1927. width: 100%;
  1928. padding: 2% 3%;
  1929. position: fixed;
  1930. bottom: 0;
  1931. background-color: #ffffff;
  1932. }
  1933. .goorder_but {
  1934. width: 100%;
  1935. line-height: 3.5;
  1936. text-align: center;
  1937. background: #fcd202;
  1938. border-radius: 36rpx;
  1939. font-weight: 700;
  1940. }
  1941. .goorder_but_ {
  1942. opacity: 0.5;
  1943. }
  1944. .bg {
  1945. background-color: #ffffff;
  1946. }
  1947. .tabBtn {
  1948. /* background-color: #f6f6fa; */
  1949. height: 60rpx;
  1950. line-height: 60rpx;
  1951. color: #999999;
  1952. font-size: 38rpx;
  1953. }
  1954. .active {
  1955. /* width: 82rpx; */
  1956. height: 6rpx;
  1957. background: #fcd202;
  1958. /* position: relative;
  1959. top: -20rpx; */
  1960. z-index: 9;
  1961. }
  1962. </style>