confirmOrder.vue 60 KB

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