payOrder.vue 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013
  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(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)
  504. }
  505. if (totalMoney <= 0) {
  506. this.totalPrice12 = 0.01
  507. } else {
  508. this.totalPrice12 = totalMoney
  509. }
  510. },
  511. //获取会员立减金额
  512. getvipMoney() {
  513. let data = {
  514. // shopId: this.shopId,
  515. userId: uni.getStorageSync('userId'),
  516. // originalPrice:this.totalPrice1
  517. }
  518. this.$Request.get(`/app/vip/get-can-reduce/${this.dataList.orderId}`,data).then((res) => {
  519. console.log(res, '会员立减')
  520. if (res.code == 0 && res.data) {
  521. this.Vipmoney=res.data
  522. let totalMoney =0
  523. if(this.Vipmoney.canReduceFlag=='1'){
  524. totalMoney = parseFloat(this.totalPrice1 -(this.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount:0)).toFixed(2)
  525. }else{
  526. 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)
  527. }
  528. if (totalMoney <= 0) {
  529. this.totalPrice12 = 0.01
  530. } else {
  531. this.totalPrice12 = totalMoney
  532. }
  533. this.getCouponList()
  534. }
  535. })
  536. },
  537. getIntegralRules() {
  538. let data = {
  539. money: this.totalPrice12
  540. }
  541. this.$Request.get('/app/userintegral/getIntegralByMoney', data).then((res) => {
  542. console.log(res, '999')
  543. if (res.code == 0) {
  544. this.intergral = res.data.intergral
  545. this.maxIntegral = res.data.maxIntegral
  546. this.ruleAmount1 = res.data.ruleAmount1
  547. this.ruleAmount2 = res.data.ruleAmount2
  548. this.ruleMaxAmount = res.data.ruleMaxAmount
  549. this.ruleValue1 = res.data.ruleValue1
  550. this.ruleValue2 = res.data.ruleValue2
  551. if (res.data.flag == 1) {
  552. this.isIntegral = true
  553. } else {
  554. this.isIntegral = false
  555. }
  556. }
  557. })
  558. },
  559. //获取骑手上下班时间
  560. getQishou() {
  561. this.$Request.get('/app/tbindent/work-time').then((res) => {
  562. if (res.code == 0 && res.data) {
  563. if (this.orderType == 2) {
  564. if (this.autoSendOrder == 0) {
  565. //0是平台配
  566. this.workStart = parseInt(res.data.workingHoursOfRider.substring(0, 2))
  567. this.workStartMin = parseInt(res.data.workingHoursOfRider.substring(3, 5))
  568. this.workEnd = parseInt(res.data.workingHoursOfRider.substring(6, 8))
  569. } else if (this.autoSendOrder == 1) {
  570. this.workStart = parseInt(this.shopDet.businessHours.substring(0, 2))
  571. this.workStartMin = parseInt(this.shopDet.businessHours.substring(3, 5))
  572. this.workEnd = parseInt(this.shopDet.lockHours.substring(0, 2))
  573. }
  574. } else if (this.orderType == 1) {
  575. this.workStart = parseInt(this.shopDet.businessHours.substring(0, 2))
  576. this.workStartMin = parseInt(this.shopDet.businessHours.substring(3, 5))
  577. this.workEnd = parseInt(this.shopDet.lockHours.substring(0, 2))
  578. }
  579. this.yusongTime = res.data.timeOfRider
  580. var date = new Date()
  581. var currentHours = date.getHours()
  582. var currentMinute = date.getMinutes()
  583. var temp = []
  584. // currentHours = 12;
  585. var temp_time = []
  586. //如果当前时间大于20点
  587. var minite = parseInt(this.yusongTime - parseInt(this.yusongTime / 60) * 60)
  588. if (parseInt(this.yusongTime / 60) == 0) {
  589. var h1 = 0
  590. var h2 = parseInt(this.yusongTime - parseInt(this.yusongTime / 60) * 60)
  591. } else {
  592. var h1 = parseInt(this.yusongTime / 60)
  593. var h2 = parseInt(this.yusongTime - parseInt(this.yusongTime / 60) * 60)
  594. }
  595. var acc = currentHours + h1
  596. var bcc = currentMinute + h2
  597. var teshu = this.workStart + h1
  598. if (bcc >= 60) {
  599. var b = bcc - 60
  600. var a = acc + 1
  601. } else {
  602. var b = bcc
  603. var a = acc
  604. }
  605. var a1 = a + 1
  606. var s1 = a.toString()
  607. var s2 = a1.toString()
  608. var e1 = b.toString()
  609. var cc = (this.workStartMin + h2).toString()
  610. if (currentHours >= this.workEnd - h1) {
  611. // this.$queue.setData({
  612. // warning:'当前时间段不在服务范围,现在下单,最早将于明早8点上门安装',
  613. // startDate:'明早 | 8:00-10:00'
  614. // })
  615. var time2 = teshu + 1
  616. uni.showModal({
  617. title: '提示',
  618. content: '当前时间段无骑手配送,现在下单,最早将于明日' + teshu + ':00' + '送达',
  619. success: function (res) {
  620. if (res.confirm) {
  621. } else if (res.cancel) {
  622. }
  623. }
  624. })
  625. // this.data.startDate = '明早 | '+a + ':'+b + '-' + a1 + ':'+b
  626. temp[0] = ['明天']
  627. temp[1] = []
  628. for (let i = teshu; i < this.workEnd - h1; ) {
  629. var i1 = i + 1
  630. var ss1 = i.toString()
  631. var ss2 = i1.toString()
  632. temp[1].push(ss1.padStart(2, 0) + ':' + cc.padStart(2, 0) + '-' + ss2.padStart(2, 0) + ':' + cc.padStart(2, 0))
  633. i += 1
  634. }
  635. } else if (currentHours < this.workStart) {
  636. // this.$queue.setData({
  637. // warning:'当前时间段不在服务范围,现在下单,最早将于今早8点上门安装',
  638. // startDate:'明早 | 8:00-10:00'
  639. // })
  640. var time2 = teshu + 1
  641. uni.showModal({
  642. title: '提示',
  643. content: '当前时间段无骑手配送,现在下单,最早将于今日' + teshu + ':00' + '送达',
  644. success: function (res) {
  645. if (res.confirm) {
  646. } else if (res.cancel) {
  647. }
  648. }
  649. })
  650. temp[0] = ['今天', '明天']
  651. temp[1] = []
  652. for (let i = teshu; i < this.workEnd - h1; ) {
  653. var i1 = i + 1
  654. var ss1 = i.toString()
  655. var ss2 = i1.toString()
  656. temp[1].push(ss1.padStart(2, 0) + ':' + cc.padStart(2, 0) + '-' + ss2.padStart(2, 0) + ':' + cc.padStart(2, 0))
  657. i += 1
  658. }
  659. } else {
  660. // this.$queue.setData({
  661. // startDate:'尽快送达 | 两小时内'
  662. // })
  663. // this.data.startDate = '尽快送达 | 两小时内'
  664. // this.data.startDate = s1.padStart(2,0) + ':'+e1.padStart(2,0) + '-' + s2.padStart(2,0) + ':'+e1.padStart(2,0)
  665. temp[0] = ['今天', '明天']
  666. temp[1] = []
  667. for (let i = a; i < this.workEnd - h1; ) {
  668. var i1 = i + 1
  669. var ss1 = i.toString()
  670. var ss2 = i1.toString()
  671. temp[1].push(ss1.padStart(2, 0) + ':' + e1.padStart(2, 0) + '-' + ss2.padStart(2, 0) + ':' + e1.padStart(2, 0))
  672. i += 1
  673. }
  674. }
  675. // this.$queue.setData({
  676. // multiArray:temp,
  677. // })
  678. this.data.multiArray = temp
  679. if (this.data.warning != '') {
  680. wx.showToast({
  681. title: this.data.warning,
  682. icon: 'none',
  683. duration: 3000
  684. })
  685. }
  686. }
  687. })
  688. },
  689. bindMultiPickerColumnChange: function (e) {
  690. let c = e.detail.column
  691. let v = e.detail.value
  692. var time = []
  693. var date = new Date()
  694. console.log(date)
  695. var date = new Date()
  696. var currentHours = date.getHours()
  697. var currentMinute = date.getMinutes()
  698. var minite = parseInt(this.yusongTime - parseInt(this.yusongTime / 60) * 60)
  699. if (parseInt(this.yusongTime / 60) == 0) {
  700. var h2 = parseInt(this.yusongTime - parseInt(this.yusongTime / 60) * 60)
  701. } else {
  702. var h1 = parseInt(this.yusongTime / 60)
  703. var h2 = parseInt(this.yusongTime - parseInt(this.yusongTime / 60) * 60)
  704. }
  705. var acc = currentHours + h1
  706. var bcc = currentMinute + h2
  707. var teshu = this.workStart + h1
  708. if (bcc >= 60) {
  709. var b = bcc - 60
  710. var a = acc + 1
  711. } else {
  712. var b = bcc
  713. var a = acc
  714. }
  715. var a1 = a + 1
  716. var s1 = a.toString()
  717. var s2 = a1.toString()
  718. var e1 = b.toString()
  719. var cc = (this.workStartMin + h2).toString()
  720. // console.log(this.workStartMin,h2,'kkk')
  721. var temp = this.data.multiArray
  722. // currentHours = 12;
  723. if (c == 0) {
  724. if (temp[c][v] == '今天') {
  725. temp[1] = []
  726. for (let i = a; i < this.workEnd - h1; ) {
  727. var i1 = i + 1
  728. var ss1 = i.toString()
  729. var ss2 = i1.toString()
  730. temp[1].push(ss1.padStart(2, 0) + ':' + e1.padStart(2, 0) + '-' + ss2.padStart(2, 0) + ':' + e1.padStart(2, 0))
  731. i += 1
  732. }
  733. } else {
  734. temp[1] = []
  735. for (let i = teshu; i < this.workEnd - h1; ) {
  736. var i1 = i + 1
  737. var ss1 = i.toString()
  738. var ss2 = i1.toString()
  739. temp[1].push(ss1.padStart(2, 0) + ':' + cc.padStart(2, 0) + '-' + ss2.padStart(2, 0) + ':' + cc.padStart(2, 0))
  740. i += 1
  741. }
  742. }
  743. // this.$queue.setData({
  744. // multiArray:temp
  745. // })
  746. this.data.multiArray = temp
  747. this.$forceUpdate()
  748. }
  749. },
  750. bindStartMultiPickerChange: function (e) {
  751. let temp = this.data.multiArray
  752. // this.$queue.setData({
  753. // startDate:temp[0][e.detail.value[0]]+' | '+temp[1][e.detail.value[1]]
  754. // })
  755. this.data.startDate = temp[0][e.detail.value[0]] + ' | ' + temp[1][e.detail.value[1]]
  756. if (this.data.startDate) {
  757. this.reservationFlag = 1
  758. if (temp[0][e.detail.value[0]] == '今天') {
  759. var date = getDate(new Date()).fullDate
  760. this.expectDeliveryTime = date + ' ' + temp[1][e.detail.value[1]].substring(0, 5) + ':00'
  761. } else if (temp[0][e.detail.value[0]] == '明天') {
  762. var date = getDate(new Date(), 1).fullDate
  763. this.expectDeliveryTime = date + ' ' + temp[1][e.detail.value[1]].substring(0, 5) + ':00'
  764. } else if (temp[0][e.detail.value[0]] == '后天') {
  765. var date = getDate(new Date(), 2).fullDate
  766. this.expectDeliveryTime = date + ' ' + temp[1][e.detail.value[1]].substring(0, 5) + ':00'
  767. }
  768. }
  769. },
  770. goCash() {
  771. uni.navigateTo({
  772. url: '/my/wallet/index'
  773. })
  774. },
  775. getMsgData() {
  776. this.$Request.get('/app/userintegral/findUserMessage').then((res) => {
  777. if (res.code == 0 && res.data) {
  778. this.userMoney = res.data.userMoney ? res.data.userMoney : 0
  779. }
  780. })
  781. },
  782. //获取店铺详情
  783. getShopDet(shopId) {
  784. let data = {
  785. shopId,
  786. lng: this.lng,
  787. lat: this.lat
  788. }
  789. this.$Request.get('/app/goods/selectGoodsList', data).then((res) => {
  790. console.log(res, 'data')
  791. if (res.code == 0 && res.data) {
  792. this.reservationOpenFlag = res.data.goodsShop.reservationOpenFlag
  793. this.autoSendOrder = res.data.goodsShop.autoSendOrder
  794. this.shopDet = res.data.goodsShop
  795. this.ifPaotui = res.data.goodsShop.enableFullReductionFlag
  796. this.getOrderList()
  797. // this.getQishou()
  798. }
  799. })
  800. },
  801. goBack() {
  802. uni.navigateBack({})
  803. },
  804. isShow() {
  805. this.show = true
  806. },
  807. //选择优惠活动弹框
  808. huodongShow() {
  809. this.youhui = true
  810. },
  811. getDistance() {
  812. if (this.address.lng && this.dataList.shopLng) {
  813. let data = {
  814. ol: this.address.lng,
  815. od: this.address.lat,
  816. dl: this.dataList.shopLng,
  817. dd: this.dataList.shopLat
  818. }
  819. this.$Request.post('/app/tbindent/distance', data).then((res) => {
  820. // console.log(res, '963')
  821. if (res.code == 0) {
  822. this.distance = res.data
  823. if (this.distance > Number(this.dataList.distributionDistance)) {
  824. this.isTrue = true
  825. } else {
  826. this.isTrue = false
  827. }
  828. }
  829. })
  830. }
  831. },
  832. close() {
  833. this.show = false
  834. },
  835. closeYouhui() {
  836. this.youhui = false
  837. },
  838. switchTab(e) {
  839. // this.page = 1
  840. // this.status = ''
  841. this.coupon = ''
  842. this.huodong = ''
  843. this.orderType = e
  844. // this.current = 0;
  845. console.log(e)
  846. if (JSON.stringify(this.address) != '{}') {
  847. this.getDistance()
  848. }
  849. if (this.orderType == 2) {
  850. this.packType=1
  851. this.ispackType =false
  852. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
  853. this.getvipMoney()
  854. } else {
  855. this.packType=1
  856. this.ispackType =false
  857. if(this.packType==1){
  858. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2)
  859. }else{
  860. this.totalPrice1 = parseFloat(this.totalPrice).toFixed(2)
  861. }
  862. this.getvipMoney()
  863. }
  864. let totalMoney =0
  865. if(this.Vipmoney.canReduceFlag=='1'){
  866. totalMoney = parseFloat(this.totalPrice1 -(this.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount:0)).toFixed(2)
  867. }else{
  868. 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)
  869. }
  870. if (totalMoney <= 0) {
  871. this.totalPrice12 = 0.01
  872. } else {
  873. this.totalPrice12 = totalMoney
  874. }
  875. if (this.coupon) {
  876. if (this.orderType == 2) {
  877. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
  878. } else {
  879. if(this.packType==1){
  880. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2)
  881. }else{
  882. this.totalPrice1 = parseFloat(this.totalPrice).toFixed(2)
  883. }
  884. }
  885. let totalMoney =0
  886. if(this.Vipmoney.canReduceFlag=='1'){
  887. totalMoney = parseFloat(this.totalPrice1 -(this.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount:0)).toFixed(2)
  888. }else{
  889. 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)
  890. }
  891. if (totalMoney <= 0) {
  892. this.totalPrice12 = 0.01
  893. } else {
  894. this.totalPrice12 = totalMoney
  895. }
  896. }
  897. if (this.huodong) {
  898. if (this.orderType == 2) {
  899. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
  900. } else {
  901. if(this.packType==1){
  902. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2)
  903. }else{
  904. this.totalPrice1 = parseFloat(this.totalPrice).toFixed(2)
  905. }
  906. }
  907. let totalMoney =0
  908. if(this.Vipmoney.canReduceFlag=='1'){
  909. totalMoney = parseFloat(this.totalPrice1 -(this.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount:0)).toFixed(2)
  910. }else{
  911. 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)
  912. }
  913. if (totalMoney <= 0) {
  914. this.totalPrice12 = 0.01
  915. } else {
  916. this.totalPrice12 = totalMoney
  917. }
  918. }if (this.Vipmoney.canReduceFlag=='1') {
  919. if (this.orderType == 2) {
  920. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
  921. } else {
  922. if(this.packType==1){
  923. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2)
  924. }else{
  925. this.totalPrice1 = parseFloat(this.totalPrice).toFixed(2)
  926. }
  927. }
  928. let totalMoney =0
  929. if(this.Vipmoney.canReduceFlag=='1'){
  930. totalMoney = parseFloat(this.totalPrice1 -(this.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount:0)).toFixed(2)
  931. }else{
  932. 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)
  933. }
  934. if (totalMoney <= 0) {
  935. this.totalPrice12 = 0.01
  936. } else {
  937. this.totalPrice12 = totalMoney
  938. }
  939. }
  940. },
  941. // 删除优惠券
  942. detCoupon() {
  943. let data = {
  944. orderId: this.dataList.orderId
  945. }
  946. this.$Request.post('/app/order/deleteCouponByOrderId', data).then((res) => {
  947. if (res.code == 0) {
  948. }
  949. })
  950. },
  951. // 选择优惠券
  952. selCoupon(item) {
  953. this.coupon = item
  954. if (this.orderType == 2) {
  955. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
  956. } else {
  957. if(this.packType==1){
  958. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2)
  959. }else{
  960. this.totalPrice1 = parseFloat(this.totalPrice).toFixed(2)
  961. }
  962. }
  963. let totalMoney =0
  964. if(this.Vipmoney.canReduceFlag=='1'){
  965. totalMoney = parseFloat(this.totalPrice1 -(this.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount:0)).toFixed(2)
  966. }else{
  967. 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)
  968. }
  969. if (totalMoney <= 0) {
  970. this.totalPrice12 = 0.01
  971. } else {
  972. this.totalPrice12 = totalMoney
  973. }
  974. let data = {
  975. parentId: this.dataList.parentId,
  976. couponId: this.coupon ? this.coupon.id : ''
  977. }
  978. this.$Request.post('/app/order/employCoupon', data).then((res) => {
  979. if (res.code == 0) {
  980. this.show = false
  981. } else {
  982. this.$queue.showToast(res.msg)
  983. }
  984. })
  985. },
  986. //选择活动activityId
  987. selctHuo(item) {
  988. this.huodong = item
  989. if (this.orderType == 2) {
  990. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
  991. } else {
  992. if(this.packType==1){
  993. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2)
  994. }else{
  995. this.totalPrice1 = parseFloat(this.totalPrice).toFixed(2)
  996. }
  997. }
  998. let totalMoney =0
  999. if(this.Vipmoney.canReduceFlag=='1'){
  1000. totalMoney = parseFloat(this.totalPrice1 -(this.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount:0)).toFixed(2)
  1001. }else{
  1002. 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)
  1003. }
  1004. if (totalMoney <= 0) {
  1005. this.totalPrice12 = 0.01
  1006. } else {
  1007. this.totalPrice12 = totalMoney
  1008. }
  1009. this.youhui = false
  1010. },
  1011. // 获取优惠券列表
  1012. getCouponList() {
  1013. console.log(this.totalPrice)
  1014. console.log(this.dataList.shopId)
  1015. let minMoney =
  1016. this.orderType == 2
  1017. ? parseFloat(parseFloat(this.totalPrice) + parseFloat(this.paotuiMoney) + parseFloat(this.dabaoMoney)).toFixed(2)
  1018. : parseFloat(this.totalPrice).toFixed(2)
  1019. let data = {
  1020. shopId: this.dataList.shopId,
  1021. page: 1,
  1022. limit: 20,
  1023. minMoney:minMoney
  1024. }
  1025. this.$Request.get('/app/coupon/selectUserCouponList', data).then((res) => {
  1026. console.log(res,'优惠券')
  1027. if (res.code == 0) {
  1028. this.couponList = res.data.list
  1029. if (this.coupon) {
  1030. let activityExists = this.couponList.some((item) => item.couponId === this.coupon.couponId)
  1031. if (!activityExists) {
  1032. this.coupon = ''
  1033. if (this.orderType == 2) {
  1034. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
  1035. } else {
  1036. if(this.packType==1){
  1037. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2)
  1038. }else{
  1039. this.totalPrice1 = parseFloat(this.totalPrice).toFixed(2)
  1040. }
  1041. }
  1042. let totalMoney =0
  1043. if(this.Vipmoney.canReduceFlag=='1'){
  1044. totalMoney = parseFloat(this.totalPrice1 -(this.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount:0)).toFixed(2)
  1045. }else{
  1046. 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)
  1047. }
  1048. if (totalMoney <= 0) {
  1049. this.totalPrice12 = 0.01
  1050. } else {
  1051. this.totalPrice12 = totalMoney
  1052. }
  1053. uni.showModal({
  1054. title: '提示',
  1055. content: '当前选择的优惠券已过期,请重新选择',
  1056. success: function (res) {
  1057. if (res.confirm) {
  1058. this.coupon = ''
  1059. } else if (res.cancel) {
  1060. this.coupon = ''
  1061. }
  1062. }
  1063. })
  1064. }
  1065. }
  1066. }
  1067. })
  1068. },
  1069. // 优惠活动列表
  1070. getHuoList() {
  1071. let data = {
  1072. orderId: this.dataList.orderId
  1073. }
  1074. this.$Request.get(`/app/activity/suit-activity/${this.dataList.orderId}`, data).then((res) => {
  1075. if (res.code == 0) {
  1076. this.huoList = res.data
  1077. if (this.huodong) {
  1078. // console.log(this.huodong,'有呢')
  1079. let activityExists = this.huoList.some((item) => item.activityId === this.huodong.activityId)
  1080. if (!activityExists) {
  1081. this.huodong = ''
  1082. if (this.orderType == 2) {
  1083. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
  1084. } else {
  1085. if(this.packType==1){
  1086. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2)
  1087. }else{
  1088. this.totalPrice1 = parseFloat(this.totalPrice).toFixed(2)
  1089. }
  1090. }
  1091. let totalMoney =0
  1092. if(this.Vipmoney.canReduceFlag=='1'){
  1093. totalMoney = parseFloat(this.totalPrice1 -(this.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount:0)).toFixed(2)
  1094. }else{
  1095. 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)
  1096. }
  1097. if (totalMoney <= 0) {
  1098. this.totalPrice12 = 0.01
  1099. } else {
  1100. this.totalPrice12 = totalMoney
  1101. }
  1102. uni.showModal({
  1103. title: '提示',
  1104. content: '当前选择的优惠活动已过期,请重新选择',
  1105. success: function (res) {
  1106. if (res.confirm) {
  1107. this.huodong = ''
  1108. } else if (res.cancel) {
  1109. this.huodong = ''
  1110. }
  1111. }
  1112. })
  1113. }
  1114. }
  1115. // 匹配出最优惠的活动
  1116. if (this.huoList.length) {
  1117. this.huodong = this.huoList.reduce((prev, current) => (prev.discountAmount > current.discountAmount ? prev : current))
  1118. this.selctHuo(this.huodong)
  1119. }
  1120. }
  1121. })
  1122. },
  1123. // 获取订单信息
  1124. getOrderList() {
  1125. this.paotuiMoney = 0
  1126. this.totalPrice1 = 0
  1127. this.totalPrice12=0
  1128. let data = {
  1129. orderId: this.orderId
  1130. }
  1131. this.$Request.get('/app/order/selectBuyGoods', data).then((res) => {
  1132. console.log(res, '666')
  1133. uni.hideLoading()
  1134. if (res.code == 0) {
  1135. this.dataList = res.data
  1136. this.GoodsorderId = res.data.orderId
  1137. // this.getShopDet(res.data.shopId)
  1138. // this.dataList.orderGoodsList[0].goodsPicture = this.dataList.orderGoodsList[0].goodsPicture.split(',')
  1139. // console.log(this.dataList.orderGoodsList)
  1140. if (this.dataList) {
  1141. this.dabaoMoney = 0
  1142. this.dataList.orderGoodsList.forEach((res) => {
  1143. res.goodsPicture = res.goodsPicture.split(',')
  1144. this.dabaoMoney += res.goodsPack * res.goodsNum
  1145. this.goodsMoney += res.goodsPrice * res.goodsNum
  1146. this.goodsMoney = parseFloat(this.goodsMoney + this.dabaoMoney)
  1147. })
  1148. }
  1149. console.log(this.ifPaotui, 'this.ifPaotui')
  1150. if (this.ifPaotui == 1) {
  1151. this.paotuiMoney = this.dataList.errandMoney
  1152. } else if (this.ifPaotui == 0) {
  1153. // 判断商品金额是否大于最低减免配送费金额
  1154. if (Number(this.goodsMoney) >= Number(this.dataList.exemptMinMoney)) {
  1155. console.log('跑腿费')
  1156. this.paotuiMoney = 0
  1157. } else {
  1158. this.paotuiMoney = this.dataList.errandMoney
  1159. }
  1160. }
  1161. this.totalPrice = res.data.payMoney * 1
  1162. console.log(this.dabaoMoney, '打包')
  1163. console.log(this.paotuiMoney, '跑腿')
  1164. if (this.orderType == 2) {
  1165. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney + this.address.insideDeliveryFee).toFixed(2)
  1166. } else {
  1167. if(this.packType==1){
  1168. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2)
  1169. }else{
  1170. this.totalPrice1 = parseFloat(this.totalPrice).toFixed(2)
  1171. }
  1172. }
  1173. this.getvipMoney()
  1174. // let totalMoney =0
  1175. // if(this.Vipmoney.canReduceFlag=='1'){
  1176. // totalMoney = parseFloat(this.totalPrice1 -(this.Vipmoney.reduceAmount?this.Vipmoney.reduceAmount:0)).toFixed(2)
  1177. // }else{
  1178. // 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)
  1179. // }
  1180. // if (totalMoney <= 0) {
  1181. // this.totalPrice12 = 0.01
  1182. // } else {
  1183. // this.totalPrice12 = totalMoney
  1184. // }
  1185. console.log(this.dataList)
  1186. // this.getvipMoney()
  1187. this.getCouponList()
  1188. this.getHuoList()
  1189. this.detCoupon()
  1190. this.getDistance()
  1191. }
  1192. })
  1193. },
  1194. selectWay: function (item) {
  1195. this.openWay = item.id
  1196. },
  1197. takeReark() {
  1198. let datas = {
  1199. orderId: this.GoodsorderId,
  1200. remark: this.remark
  1201. }
  1202. this.$Request.post('/app/order/updateOrdersRemark', datas).then((res) => {
  1203. // uni.hideLoading();
  1204. if (res.code == 0) {
  1205. } else {
  1206. uni.showToast({
  1207. title: res.msg,
  1208. icon: 'none'
  1209. })
  1210. }
  1211. })
  1212. },
  1213. // 立即结算
  1214. toSettlement() {
  1215. if (this.isThrottle == false) {
  1216. return
  1217. }
  1218. if (this.isTrue && this.orderType == 2) {
  1219. uni.showToast({
  1220. title: '超出配送范围',
  1221. icon: 'none'
  1222. })
  1223. reutrn
  1224. }
  1225. if (this.orderType == 2 && !this.address.addressId) {
  1226. uni.showToast({
  1227. title: '请选择收货地址',
  1228. icon: 'none'
  1229. })
  1230. return
  1231. }
  1232. if (this.remark) {
  1233. this.takeReark()
  1234. }
  1235. uni.showLoading({
  1236. title: '支付中...',
  1237. mask: true // 是否显示透明蒙层,防止触摸穿透
  1238. })
  1239. this.isThrottle = false
  1240. if (this.openWay == 1) {
  1241. let data = {
  1242. userId: uni.getStorageSync('userId'),
  1243. type: 1, //支付方式 1表示微信支付、4或5表示支付宝支付
  1244. activityId: this.huodong ? this.huodong.activityId : '',
  1245. reservationFlag: this.reservationFlag, //是否预约单 1是、0否
  1246. expectDeliveryTime: this.expectDeliveryTime, //期待送达时间 yyyy-MM-dd HH:mm:ss
  1247. parentId: this.dataList.parentId,
  1248. couponId: this.coupon ? this.coupon.id : '',
  1249. addressId: this.address.addressId ? this.address.addressId : '',
  1250. orderType: this.orderType
  1251. }
  1252. this.$Request.post('/app/wxPay/balanceOrder', data).then((res) => {
  1253. if (res.code == 0) {
  1254. uni.hideLoading()
  1255. this.$queue.showToast('支付成功')
  1256. setTimeout(() => {
  1257. this.isThrottle = true
  1258. uni.switchTab({
  1259. url: '/pages/order/index'
  1260. })
  1261. }, 1000)
  1262. } else {
  1263. this.isThrottle = true
  1264. this.$queue.showToast(res.msg)
  1265. }
  1266. })
  1267. } else if (this.openWay == 2) {
  1268. // #ifdef H5
  1269. let data = {
  1270. userId: uni.getStorageSync('userId'),
  1271. type: 1, //支付方式 1表示微信支付、4或5表示支付宝支付
  1272. activityId: this.huodong ? this.huodong.activityId : '',
  1273. reservationFlag: this.reservationFlag, //是否预约单 1是、0否
  1274. expectDeliveryTime: this.expectDeliveryTime, //期待送达时间 yyyy-MM-dd HH:mm:ss
  1275. parentId: this.dataList.parentId,
  1276. couponId: this.coupon ? this.coupon.id : '',
  1277. addressId: this.address.addressId ? this.address.addressId : '',
  1278. orderType: this.orderType,
  1279. type: 2
  1280. }
  1281. this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then((res) => {
  1282. if (res.code == 0) {
  1283. this.callPay(res.data)
  1284. } else {
  1285. this.isThrottle = true
  1286. uni.showToast({
  1287. title: res.msg,
  1288. icon: 'none'
  1289. })
  1290. }
  1291. })
  1292. // #endif
  1293. // #ifdef MP-WEIXIN
  1294. this.$Request.get('/app/new-pay/enable-new-pay').then((res) => {
  1295. console.log(res, '666')
  1296. if (res.code == 0) {
  1297. let data = {
  1298. userId: uni.getStorageSync('userId'),
  1299. // type: 4, //支付方式 1表示微信支付、4或5表示支付宝支付
  1300. activityId: this.huodong ? this.huodong.activityId : '',
  1301. reservationFlag: this.reservationFlag, //是否预约单 1是、0否
  1302. expectDeliveryTime: this.expectDeliveryTime, //期待送达时间 yyyy-MM-dd HH:mm:ss
  1303. parentId: this.dataList.parentId,
  1304. couponId: this.coupon ? this.coupon.id : '',
  1305. addressId: this.address.addressId ? this.address.addressId : '',
  1306. orderType: this.orderType,
  1307. type: res.enable ? 1 : 3,
  1308. idCard: this.idcard1,
  1309. packType:this.packType
  1310. }
  1311. console.log(data)
  1312. if (res.enable) {
  1313. console.log('xin')
  1314. this.newPay(data)
  1315. } else {
  1316. console.log('jiu')
  1317. this.oldPay(data)
  1318. }
  1319. }
  1320. })
  1321. // #endif
  1322. // #ifdef APP
  1323. let data = {
  1324. type: 1,
  1325. parentId: this.dataList.parentId,
  1326. couponId: this.coupon ? this.coupon.id : '',
  1327. addressId: this.address.addressId ? this.address.addressId : '',
  1328. orderType: this.orderType
  1329. }
  1330. this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then((res) => {
  1331. console.log(res)
  1332. this.showpay = false
  1333. if (res.code == 0) {
  1334. this.isCheckPay(res.code, 'wxpay', JSON.stringify(res.data))
  1335. } else {
  1336. this.isThrottle = true
  1337. }
  1338. })
  1339. // #endif
  1340. } else if (this.openWay == 3) {
  1341. // #ifdef H5
  1342. let data = {
  1343. type: 5,
  1344. parentId: this.dataList.parentId,
  1345. couponId: this.coupon ? this.coupon.id : '',
  1346. addressId: this.address.addressId ? this.address.addressId : '',
  1347. orderType: this.orderType
  1348. }
  1349. this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then((res) => {
  1350. this.showpay = false
  1351. this.isThrottle = true
  1352. const div = document.createElement('div')
  1353. div.innerHTML = res.data //此处form就是后台返回接收到的数据
  1354. document.body.appendChild(div)
  1355. document.forms[0].submit()
  1356. })
  1357. // #endif
  1358. // #ifdef APP-PLUS
  1359. let data = {
  1360. type: 4,
  1361. parentId: this.dataList.parentId,
  1362. couponId: this.coupon ? this.coupon.id : '',
  1363. addressId: this.address.addressId ? this.address.addressId : '',
  1364. orderType: this.orderType
  1365. }
  1366. this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then((res) => {
  1367. this.showpay = false
  1368. this.setPayment('alipay', res.data)
  1369. })
  1370. // #endif
  1371. }
  1372. },
  1373. newPay(data) {
  1374. this.$Request.get('/app/order/get-pay-param', data).then((res) => {
  1375. console.log(res, '新支付')
  1376. if (res.code == 0) {
  1377. uni.requestPayment({
  1378. provider: 'wxpay',
  1379. timeStamp: res.timeStamp,
  1380. nonceStr: res.nonceStr,
  1381. package: res.packageStr,
  1382. signType: res.signType,
  1383. paySign: res.paySign,
  1384. success: (suc) => {
  1385. uni.hideLoading()
  1386. this.$queue.showToast('支付成功')
  1387. setTimeout(() => {
  1388. this.isThrottle = true
  1389. uni.switchTab({
  1390. url: '/pages/order/index'
  1391. })
  1392. }, 1000)
  1393. },
  1394. fail: (err) => {
  1395. console.log('fail:' + JSON.stringify(err))
  1396. this.isThrottle = true
  1397. uni.setStorageSync('isClear', true)
  1398. uni.showToast({
  1399. title: '支付失败',
  1400. icon: 'none',
  1401. mask: true
  1402. })
  1403. setTimeout(() => {
  1404. uni.reLaunch({
  1405. url: '/pages/order/index'
  1406. })
  1407. }, 1500)
  1408. }
  1409. })
  1410. } else {
  1411. uni.showToast({
  1412. title: res.msg,
  1413. icon: 'none'
  1414. })
  1415. this.isThrottle = true
  1416. }
  1417. })
  1418. },
  1419. oldPay(data) {
  1420. this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then((res) => {
  1421. console.log(res, '旧支付')
  1422. // uni.hideLoading();
  1423. if (res.code == 0) {
  1424. uni.requestPayment({
  1425. provider: 'wxpay',
  1426. timeStamp: res.data.timestamp,
  1427. nonceStr: res.data.noncestr,
  1428. package: res.data.package,
  1429. signType: res.data.signType,
  1430. paySign: res.data.sign,
  1431. success: (suc) => {
  1432. uni.hideLoading()
  1433. this.$queue.showToast('支付成功')
  1434. setTimeout(() => {
  1435. this.isThrottle = true
  1436. uni.switchTab({
  1437. url: '/pages/order/index'
  1438. })
  1439. }, 1000)
  1440. },
  1441. fail: (err) => {
  1442. console.log('fail:' + JSON.stringify(err))
  1443. this.isThrottle = true
  1444. uni.setStorageSync('isClear', true)
  1445. uni.showToast({
  1446. title: '支付失败',
  1447. icon: 'none',
  1448. mask: true
  1449. })
  1450. setTimeout(() => {
  1451. uni.reLaunch({
  1452. url: '/pages/order/index'
  1453. })
  1454. }, 1500)
  1455. }
  1456. })
  1457. } else {
  1458. uni.showToast({
  1459. title: res.msg,
  1460. icon: 'none'
  1461. })
  1462. this.isThrottle = true
  1463. }
  1464. })
  1465. },
  1466. callPay: function (response) {
  1467. if (typeof WeixinJSBridge === 'undefined') {
  1468. if (document.addEventListener) {
  1469. document.addEventListener('WeixinJSBridgeReady', this.onBridgeReady(response), false)
  1470. } else if (document.attachEvent) {
  1471. document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady(response))
  1472. document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady(response))
  1473. }
  1474. } else {
  1475. this.onBridgeReady(response)
  1476. }
  1477. },
  1478. onBridgeReady: function (response) {
  1479. let that = this
  1480. if (!response.package) {
  1481. return
  1482. }
  1483. WeixinJSBridge.invoke(
  1484. 'getBrandWCPayRequest',
  1485. {
  1486. appId: response.appid, //公众号名称,由商户传入
  1487. timeStamp: response.timestamp, //时间戳,自1970年以来的秒数
  1488. nonceStr: response.noncestr, //随机串
  1489. package: response.package,
  1490. signType: response.signType, //微信签名方式:
  1491. paySign: response.sign //微信签名
  1492. },
  1493. function (res) {
  1494. if (res.err_msg === 'get_brand_wcpay_request:ok') {
  1495. // 使用以上方式判断前端返回,微信团队郑重提示:
  1496. //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
  1497. uni.hideLoading()
  1498. uni.showToast({
  1499. title: '支付成功',
  1500. icon: 'success'
  1501. })
  1502. setTimeout(function () {
  1503. that.isThrottle = true
  1504. uni.switchTab({
  1505. url: '/pages/order/index'
  1506. })
  1507. }, 1000)
  1508. } else {
  1509. that.isThrottle = true
  1510. uni.hideLoading()
  1511. }
  1512. WeixinJSBridge.log(response.err_msg)
  1513. }
  1514. )
  1515. },
  1516. isCheckPay(code, name, order) {
  1517. if (code == 0) {
  1518. console.log('999999999999')
  1519. this.setPayment(name, order)
  1520. } else {
  1521. uni.hideLoading()
  1522. uni.showToast({
  1523. title: '支付信息有误'
  1524. })
  1525. this.isThrottle = true
  1526. }
  1527. },
  1528. setPayment(name, order) {
  1529. console.log(777777777, name, order)
  1530. uni.requestPayment({
  1531. provider: name,
  1532. orderInfo: order, //微信、支付宝订单数据
  1533. success: (res) => {
  1534. uni.hideLoading()
  1535. uni.showLoading({
  1536. title: '支付成功',
  1537. icon: 'none'
  1538. })
  1539. setTimeout(() => {
  1540. this.isThrottle = true
  1541. uni.navigateBack()
  1542. }, 1000)
  1543. },
  1544. fail: (err) => {
  1545. this.isThrottle = true
  1546. uni.hideLoading()
  1547. },
  1548. complete: () => {
  1549. this.isThrottle = true
  1550. uni.hideLoading()
  1551. }
  1552. })
  1553. },
  1554. // 获取选择的地址
  1555. getAddressDet(e) {
  1556. let data = {
  1557. addressId: e
  1558. }
  1559. this.$Request.get('/app/address/selectAddressById', data).then((res) => {
  1560. console.log(res, 741258)
  1561. if (res.code == 0) {
  1562. this.address = res.data
  1563. if (this.address.insideAddressId) {
  1564. this.getInsideDeliveryFee(this.address.insideAddressId)
  1565. } else {
  1566. this.getInsideDeliveryFee(0)
  1567. }
  1568. if (JSON.stringify(this.address) != '{}') {
  1569. this.getDistance()
  1570. }
  1571. uni.removeStorageSync('addressId')
  1572. }
  1573. })
  1574. },
  1575. // 获取地址列表
  1576. getAddressList() {
  1577. let data = {
  1578. page: 1,
  1579. limit: 100
  1580. }
  1581. this.$Request.get('/app/address/selectAddressList', data).then((res) => {
  1582. if (res.code == 0 && res.data.list.length) {
  1583. this.address = res.data.list[0]
  1584. res.data.list.forEach((ret) => {
  1585. if (ret.addressDefault == 1) {
  1586. this.address = ret
  1587. }
  1588. })
  1589. if (this.address.insideAddressId) {
  1590. this.getInsideDeliveryFee(this.address.insideAddressId)
  1591. } else {
  1592. this.getInsideDeliveryFee(0)
  1593. }
  1594. // console.log(this.address, '我的地址列表460777')
  1595. if (JSON.stringify(this.address) != '{}') {
  1596. this.getDistance()
  1597. }
  1598. }
  1599. })
  1600. },
  1601. getInsideDeliveryFee(insideAddressId) {
  1602. this.$Request.get(`/app/inside-address/${insideAddressId}`).then((res) => {
  1603. // console.log(res, 987456)
  1604. if (res.code == 0) {
  1605. this.address.insideDeliveryFee = res.data.deliveryFee || 0
  1606. }
  1607. })
  1608. },
  1609. goAddress() {
  1610. uni.navigateTo({
  1611. url: '/my/address/index?add=1'
  1612. })
  1613. },
  1614. // 点击调起地图查看位置
  1615. goMap() {
  1616. let lati = parseFloat(this.dataList.shopLat)
  1617. let longi = parseFloat(this.dataList.shopLng)
  1618. uni.authorize({
  1619. scope: 'scope.userLocation',
  1620. success: (res) => {
  1621. uni.openLocation({
  1622. name: this.dataList.shopName,
  1623. latitude: lati,
  1624. longitude: longi,
  1625. success: () => {}
  1626. })
  1627. },
  1628. fail(err) {}
  1629. })
  1630. },
  1631. // 打电话
  1632. call() {
  1633. uni.makePhoneCall({
  1634. phoneNumber: this.dataList.shopPhone
  1635. })
  1636. }
  1637. }
  1638. }
  1639. </script>
  1640. <style scoped>
  1641. .hintPopul {
  1642. width: 100%;
  1643. height: 100vh;
  1644. position: fixed;
  1645. top: 0;
  1646. background: rgba(0, 0, 0, 0.4);
  1647. z-index: 999;
  1648. }
  1649. .content_ {
  1650. position: absolute;
  1651. left: 0;
  1652. right: 0;
  1653. top: 0;
  1654. bottom: 0;
  1655. margin: auto;
  1656. text-align: center;
  1657. width: 500rpx;
  1658. height: 400rpx;
  1659. border-radius: 20rpx;
  1660. background-color: #fff;
  1661. padding-top: 120rpx;
  1662. }
  1663. .content_ image {
  1664. position: absolute;
  1665. top: -50rpx;
  1666. left: 0;
  1667. right: 0;
  1668. margin: auto;
  1669. }
  1670. .hintText {
  1671. font-size: 30rpx;
  1672. }
  1673. .Btns {
  1674. width: 460rpx;
  1675. height: 60rpx;
  1676. line-height: 60rpx;
  1677. text-align: center;
  1678. background: #fcd202;
  1679. font-size: 28rpx;
  1680. border: 2rpx solid #fcd202;
  1681. color: #333333;
  1682. border-radius: 50rpx;
  1683. font-weight: 700;
  1684. margin: auto;
  1685. }
  1686. .goods_address {
  1687. width: 94%;
  1688. background: #ffffff;
  1689. height: 120rpx;
  1690. margin: 20rpx auto 0;
  1691. border-radius: 18rpx;
  1692. }
  1693. .address_box {
  1694. width: 90%;
  1695. margin: 0 auto;
  1696. height: 120rpx;
  1697. display: flex;
  1698. line-height: 120rpx;
  1699. }
  1700. .address_name {
  1701. flex: 1;
  1702. font-size: 30rpx;
  1703. }
  1704. .address_image {
  1705. /* flex: 1; */
  1706. display: flex;
  1707. justify-content: flex-end;
  1708. align-items: center;
  1709. }
  1710. .address_image image {
  1711. width: 15rpx;
  1712. height: 30rpx;
  1713. }
  1714. .songda_image image {
  1715. width: 20rpx;
  1716. height: 30rpx;
  1717. margin-left: 20rpx;
  1718. }
  1719. /* 地址 */
  1720. .address {
  1721. width: 88%;
  1722. margin: 3% auto;
  1723. padding: 3%;
  1724. display: flex;
  1725. background-color: #ffffff;
  1726. border-radius: 18rpx;
  1727. }
  1728. .adderss_le {
  1729. width: 90%;
  1730. line-height: 1.5;
  1731. }
  1732. .adderss_le_text {
  1733. font-size: 30rpx;
  1734. font-weight: bold;
  1735. color: #333333;
  1736. }
  1737. .adderss_le_text2 {
  1738. font-size: 24rpx;
  1739. font-weight: 500;
  1740. color: #999999;
  1741. display: flex;
  1742. }
  1743. .adderss_le_text2 view {
  1744. margin-left: 2%;
  1745. }
  1746. .adderss_le_text2 view:first-child {
  1747. margin-left: 0;
  1748. }
  1749. .adderss_ri {
  1750. width: 10%;
  1751. text-align: right;
  1752. line-height: 3;
  1753. }
  1754. .adderss_ri image {
  1755. width: 18rpx;
  1756. height: 30rpx;
  1757. }
  1758. /* 商品 */
  1759. .food {
  1760. width: 94%;
  1761. margin: 3% auto;
  1762. padding: 3%;
  1763. background-color: #ffffff;
  1764. border-radius: 18rpx;
  1765. }
  1766. .food_top {
  1767. display: flex;
  1768. justify-content: space-between;
  1769. align-items: center;
  1770. font-size: 32rpx;
  1771. font-weight: bold;
  1772. }
  1773. .food_bottom {
  1774. margin-top: 20rpx;
  1775. color: #666666;
  1776. font-size: 28rpx;
  1777. line-height: 45rpx;
  1778. }
  1779. .bottom_text {
  1780. color: #ea0018;
  1781. }
  1782. .tosend_header_food {
  1783. width: 100%;
  1784. display: flex;
  1785. margin-top: 3%;
  1786. }
  1787. .tosend_header_food_le {
  1788. width: 15%;
  1789. }
  1790. .tosend_header_food_le image {
  1791. width: 110rpx;
  1792. height: 110rpx;
  1793. }
  1794. .tosend_header_food_ce {
  1795. margin: 0 0 0 4%;
  1796. width: 57%;
  1797. }
  1798. .tosend_header_food_ri {
  1799. text-align: right;
  1800. width: 25%;
  1801. }
  1802. .tosend_header_food_text {
  1803. font-size: 34rpx;
  1804. font-weight: 500;
  1805. color: #333333;
  1806. line-height: 1.8;
  1807. }
  1808. .tosend_header_food_text text {
  1809. font-size: 25rpx;
  1810. }
  1811. .tosend_header_food_text2 {
  1812. font-size: 30rpx;
  1813. font-weight: 500;
  1814. color: #999999;
  1815. }
  1816. .do_top {
  1817. padding-top: 3%;
  1818. }
  1819. .do_bot {
  1820. padding-bottom: 3%;
  1821. border-bottom: 2rpx solid #e6e6e6;
  1822. }
  1823. .tosend_header_do {
  1824. width: 100%;
  1825. color: #333333;
  1826. font-size: 30rpx;
  1827. display: flex;
  1828. margin-top: 20rpx;
  1829. line-height: 1.5;
  1830. }
  1831. .tosend_header_do view {
  1832. /* flex: 1; */
  1833. }
  1834. .tosend_header_do_ri {
  1835. text-align: right;
  1836. }
  1837. .tosend_header_do_le2 {
  1838. font-family: PingFang SC;
  1839. font-weight: 500;
  1840. color: #999999;
  1841. padding-top: 1.5%;
  1842. }
  1843. .tosend_header_do_ri2 {
  1844. text-align: right;
  1845. color: #ea0000;
  1846. font-size: 40rpx;
  1847. }
  1848. .tosend_header_do_ri2 text {
  1849. font-size: 30rpx;
  1850. }
  1851. /* 支付 */
  1852. /* .payment_all{
  1853. width: 88%;margin: 3% auto;padding: 3%;background-color: #FFFFFF;
  1854. border-radius: 18rpx;
  1855. }
  1856. .payment{
  1857. width: 100%;display: flex;margin-top: 3%;
  1858. }
  1859. .payment_le{
  1860. width: 13%;
  1861. }
  1862. .payment_le image{
  1863. width: 60rpx;height: 60rpx;
  1864. }
  1865. .payment_ce{
  1866. width: 52%;
  1867. font-size: 30rpx;
  1868. font-weight: bold;
  1869. color: #333333;line-height: 60rpx;
  1870. }
  1871. .payment_ri{
  1872. width: 35%;text-align: right;line-height: 60rpx;
  1873. } */
  1874. /* 结算 */
  1875. .goorder {
  1876. width: 100%;
  1877. padding: 2% 3%;
  1878. position: fixed;
  1879. bottom: 0;
  1880. background-color: #ffffff;
  1881. }
  1882. .goorder_but {
  1883. width: 100%;
  1884. line-height: 3.5;
  1885. text-align: center;
  1886. background: #fcd202;
  1887. border-radius: 36rpx;
  1888. font-weight: 700;
  1889. }
  1890. .goorder_but_ {
  1891. opacity: 0.5;
  1892. }
  1893. .bg {
  1894. background-color: #ffffff;
  1895. }
  1896. .tabBtn {
  1897. /* background-color: #f6f6fa; */
  1898. height: 60rpx;
  1899. line-height: 60rpx;
  1900. color: #999999;
  1901. font-size: 38rpx;
  1902. }
  1903. .active {
  1904. /* width: 82rpx; */
  1905. height: 6rpx;
  1906. background: #fcd202;
  1907. /* position: relative;
  1908. top: -20rpx; */
  1909. z-index: 9;
  1910. }
  1911. </style>