confirmOrder.vue 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545
  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"
  8. v-if="XCXIsSelect == '是'">
  9. <view class="title">外卖配送</view>
  10. <view :class="orderType == 2 ? 'active' : ''"></view>
  11. </view>
  12. <view @click="switchTab(1)" :class="orderType == 1 ? 'select' : ''" class="tabBtn">
  13. <view class="title">到店自取</view>
  14. <view :class="orderType == 1 ? 'active' : ''"></view>
  15. </view>
  16. </view>
  17. <view v-if="orderType == 1">
  18. <!-- <view class="text-black text-lg margin-top">商家地址</view> -->
  19. <view class="flex margin-top" style="">
  20. <u-icon name="map" size="50"></u-icon>
  21. <view class="flex-sub padding-tb-sm margin-left-sm">
  22. <view class="text-lg text-bold text-black">
  23. <text>{{ dataList.shopName }}</text>
  24. <text class="margin-left-sm" @click="call">{{ dataList.shopPhone }}</text>
  25. </view>
  26. <view class="text-df margin-top-xs" style="color: #999999;" @click="goMap">
  27. {{ dataList.detailedAddress }}
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="" v-if="orderType == 2">
  33. <view class="goods_address" v-if="JSON.stringify(address) == '{}'" @click="goAddress">
  34. <view class="address_box">
  35. <view class="address_name">请选择收货地址</view>
  36. <view class="address_image margin-left">
  37. <image src="../../../static/images/index/right.png"></image>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="flex margin-top" style="" v-else @click="goAddress">
  42. <u-icon name="map" size="50"></u-icon>
  43. <view class="flex-sub padding-tb-sm margin-left-sm">
  44. <view class="text-lg text-bold text-black">
  45. <text>{{ address.userName }}</text>
  46. <text class="margin-left-sm">{{ address.userPhone }}</text>
  47. </view>
  48. <view class="text-df margin-top-xs" style="color: #999999;">
  49. {{ address.province }}{{ address.city }}{{ address.district }}{{ address.addressDetail }}
  50. </view>
  51. </view>
  52. <view class="address_image margin-left">
  53. <image src="../../../static/images/index/right.png"></image>
  54. </view>
  55. </view>
  56. <!-- 预约送达时间 -->
  57. <view class="goods_address">
  58. <view class="address_box">
  59. <view class="address_name">送达时间</view>
  60. <picker class='time-picker' mode="multiSelector" @change="bindStartMultiPickerChange"
  61. @columnchange="bindMultiPickerColumnChange" :range="data.multiArray">
  62. {{data.startDate}}
  63. </picker>
  64. <view class="songda_image">
  65. <image src="../../../static/images/index/right.png"></image>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <!-- 商品 -->
  72. <view class="food">
  73. <view class="tosend_header_food" v-for="(item, index) in goodsList" :key="index">
  74. <view class="tosend_header_food_le">
  75. <image :src="item.goodsPicture[0]" style="border-radius: 10rpx;" mode=""></image>
  76. </view>
  77. <view class="flex-sub margin-left-sm">
  78. <view class="flex justify-between align-center">
  79. <view class="text-lg text-bold text-black">{{ item.goodsName }}</view>
  80. <view class="text-lg text-bold text-black">
  81. <text class="text-sm">¥</text>
  82. {{ item.goodsPrice }}
  83. </view>
  84. </view>
  85. <view class="flex justify-between align-center text-gray">
  86. <view v-if="item.skuMessage">{{ item.skuMessage }}</view>
  87. <view>x{{ item.goodsNum }}</view>
  88. </view>
  89. <view class="flex justify-between align-center text-gray margin-tb-sm">
  90. <view>打包费</view>
  91. <view class="">¥{{ item.goodsPack }} / 份</view>
  92. </view>
  93. </view>
  94. </view>
  95. <!-- <view class="tosend_header_do do_top" v-if="item.goodsPack>0" >
  96. <view>打包费</view>
  97. <view class="tosend_header_do_ri">¥{{item.goodsPack}}</view>
  98. </view> -->
  99. <view class="tosend_header_do justify-between" v-if="paotuiMoney > 0 && orderType == 2">
  100. <view>跑腿费</view>
  101. <view class="tosend_header_do_ri">¥{{ paotuiMoney }}</view>
  102. </view>
  103. <view class="tosend_header_do justify-between do_bot" @click="isShow">
  104. <view>优惠券</view>
  105. <view class="tosend_header_do_ri" v-if="coupon">- ¥{{ coupon.money }}</view>
  106. <view v-else>
  107. <image src="../../../static/images/order/right1.png" style="width: 14rpx;height: 24rpx;" mode="">
  108. </image>
  109. </view>
  110. </view>
  111. <view class="tosend_header_do justify-between do_bot" @click="huodongShow">
  112. <view>优惠活动</view>
  113. <view class="tosend_header_do_ri" v-if="huodong">- ¥{{ huodong.discountAmount }}</view>
  114. <view v-else>
  115. <image src="../../../static/images/order/right1.png" style="width: 14rpx;height: 24rpx;" mode="">
  116. </image>
  117. </view>
  118. </view>
  119. <view class="tosend_header_do justify-between">
  120. <view class="tosend_header_do_le2">合计</view>
  121. <view class="tosend_header_do_ri2">
  122. <text>¥</text>
  123. {{ totalPrice1 }}
  124. </view>
  125. </view>
  126. </view>
  127. <!-- 订单备注 -->
  128. <view class="food">
  129. <view class="padding-tb-sm text-lg text-bold text-bold text-black">订单备注</view>
  130. <view class="flex align-center justify-between padding-tb-sm padding-lr"
  131. style="background: #f5f5f5;width: 100%;">
  132. <u-input v-model="remark" type="textarea" placeholder="请输入订单备注" height="180" maxlength="200"
  133. style="width: 100%;"></u-input>
  134. </view>
  135. </view>
  136. <!-- 支付方式 -->
  137. <view class="food">
  138. <view class="padding-tb-sm text-lg text-bold text-bold text-black">支付方式</view>
  139. <view style="height: 100upx;" v-for="(item, index) in openLists" :key="index">
  140. <view class="flex align-center justify-between padding-tb" v-if="item.text != '零钱'">
  141. <image :src="item.image" style="width: 55rpx;height: 55rpx;border-radius: 50upx;"></image>
  142. <view class="flex-sub text-xl margin-left">{{ item.text }}</view>
  143. <radio-group name="openWay" style="margin-left: 20upx;" @change="selectWay(item)">
  144. <label class="tui-radio">
  145. <radio class="red" :checked="openWay === item.id ? true : false" />
  146. </label>
  147. </radio-group>
  148. </view>
  149. <view class="flex align-center justify-between padding-tb" v-if="item.text === '零钱'">
  150. <image :src="item.image" style="width: 55rpx;height: 55rpx;border-radius: 50upx;"></image>
  151. <view class="flex-sub text-xl margin-left">{{ item.text }} <text
  152. style="font-size: 30rpx;margin-left: 10rpx;"
  153. v-if="userMoney && userMoney > 0">(余额:{{userMoney}})</text>
  154. <!-- <text v-else
  155. style="font-size: 30rpx;margin-left: 10rpx;text-decoration:underline;color: #ea0000;"
  156. @tap="goCash()">去充值</text> -->
  157. </view>
  158. <radio-group name="openWay" style="margin-left: 20upx;" @change="selectWay(item)">
  159. <label class="tui-radio">
  160. <radio class="red" :checked="openWay === item.id ? true : false" />
  161. </label>
  162. </radio-group>
  163. </view>
  164. </view>
  165. </view>
  166. <view style="height: 120rpx;"></view>
  167. <!-- 结算 -->
  168. <view class="goorder">
  169. <!-- <view class="goorder_but" @click="toSettlement">立即结算</view> -->
  170. <view class="goorder_but" :class="isTrue && orderType == 2 ? 'goorder_but_' : ''" @click="toSettlement">立即结算
  171. </view>
  172. </view>
  173. <view class="hintPopul" v-if="shopDet && shopDet.putawayFlag == 1">
  174. <view class="content_">
  175. <image src="../../../static/images/index/shop.png" style="width: 200rpx;height: 180rpx;"></image>
  176. <view class="text-xl text-bold">店铺打烊啦</view>
  177. <view class="hintText margin-top-sm text-gray">现在店铺已经打烊了,营业时间</view>
  178. <view class="margin-top-xs text-gray margin-bottom">{{ shopDet.businessHours }}-{{ shopDet.lockHours }}
  179. </view>
  180. <view class="Btns" @click="goBack()">知道了</view>
  181. </view>
  182. </view>
  183. <u-popup v-model="show" mode="center" :closeable="true" close-icon-pos="top-right" close-icon="close-circle"
  184. close-icon-size="50" border-radius="20" width="80%" @close="close">
  185. <view class="padding bg-gray">
  186. <view class="text-center text-lg text-bold margin-bottom-sm">可用优惠券</view>
  187. <scroll-view scroll-y="true" style="height: 600rpx;" v-if="couponList.length > 0">
  188. <view class="flex justify-between align-center radius margin-tb-sm padding-sm bg-white"
  189. v-for="(item, index) in couponList" :key="index" @click="selCoupon(item)">
  190. <view>
  191. <view>{{ item.couponName }}</view>
  192. <view>有效期至{{ item.expirationTime }}</view>
  193. </view>
  194. <view class="text-sm text-bold">
  195. ¥
  196. <text class="text-lg">{{ item.money }}</text>
  197. </view>
  198. </view>
  199. </scroll-view>
  200. <view v-if="couponList.length == 0"
  201. style="height: 100rpx;line-height: 100rpx;text-align: center;font-weight: 700;">暂无可用优惠券</view>
  202. </view>
  203. </u-popup>
  204. <!-- 选择优惠活动 -->
  205. <u-popup v-model="youhui" mode="center" :closeable="true" close-icon-pos="top-right" close-icon="close-circle"
  206. close-icon-size="50" border-radius="20" width="80%" @close="closeYouhui()">
  207. <view class="padding bg-gray">
  208. <view class="text-center text-lg text-bold margin-bottom-sm">可用优惠活动</view>
  209. <scroll-view scroll-y="true" style="height: 600rpx;" v-if="huoList.length > 0">
  210. <view class="flex justify-between align-center radius margin-tb-sm padding-sm bg-white"
  211. v-for="(item, index) in huoList" :key="index" @click="selctHuo(item)">
  212. <view>
  213. <view>{{ item.activityTitle }}</view>
  214. <view>有效期至{{ item.activityEndTime }}</view>
  215. </view>
  216. <!-- <view class="text-sm text-bold">
  217. ¥
  218. <text class="text-lg" v-if="item.activityType=='2'">{{ item.money }}</text>
  219. <text class="text-lg" v-if="item.activityType=='2'">{{ item.money }}</text>
  220. <text class="text-lg" v-if="item.activityType=='4'">全场打{{ item.discountAmount }}折</text>
  221. </view> -->
  222. </view>
  223. </scroll-view>
  224. <view v-if="huoList.length == 0"
  225. style="height: 100rpx;line-height: 100rpx;text-align: center;font-weight: 700;">暂无可用优惠活动</view>
  226. </view>
  227. </u-popup>
  228. </view>
  229. </template>
  230. <script>
  231. /**
  232. * 获取任意时间
  233. */
  234. function getDate(date, AddDayCount = 0) {
  235. if (!date) {
  236. date = new Date()
  237. }
  238. if (typeof date !== 'object') {
  239. date = date.replace(/-/g, '/')
  240. }
  241. const dd = new Date(date)
  242. dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
  243. var a = new Array("日", "一", "二", "三", "四", "五", "六");
  244. var week = new Date().getDay();
  245. var week2 = new Date().getDay()+1;
  246. const y = dd.getFullYear()
  247. const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0
  248. const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0
  249. const h = dd.getHours() < 10 ? '0' + dd.getHours() : dd.getHours()
  250. const f = dd.getMinutes() < 10 ? '0' + dd.getMinutes() : dd.getMinutes()
  251. const s = dd.getSeconds() < 10 ? '0' + dd.getSeconds() : dd.getSeconds()
  252. return {
  253. fullDate: y + '-' + m + '-' + d,
  254. fullDate2: y + '-' + m + '-' + d+' '+h+':'+f+':'+s,
  255. fullTime: m + '月' + d + '日',
  256. year: y,
  257. month: m,
  258. date: d,
  259. day: dd.getDay(),
  260. sWeek:"周"+ a[week],
  261. eWeek:"周"+ a[week2]
  262. }
  263. }
  264. export default {
  265. data() {
  266. return {
  267. userMoney: 0,
  268. shopDet: '',
  269. isThrottle: true, //防抖,待支付结果返回后继续
  270. storeCommodityId: 0,
  271. openLists: [],
  272. openWay: 2,
  273. orderId: '',
  274. page: 1,
  275. limit: 100,
  276. dataList: [],
  277. packMoney: 0, //打包费
  278. totalPrice: 0,
  279. totalPrice1: 0,
  280. address: {}, //地址
  281. addressId: '',
  282. parentId: '',
  283. shopId: '',
  284. show: false,
  285. youhui: false, //优惠活动
  286. coupon: '', //选择的优惠券信息
  287. huodong: '', //选择的活动信息
  288. couponList: [],
  289. huoList: [], //可用活动
  290. orderType: 2,
  291. paotuiMoney: 0,
  292. dabaoMoney: 0,
  293. goodsMoney: null,
  294. distance: 0,
  295. isTrue: false,
  296. goodsList: [],
  297. XCXIsSelect: '是',
  298. remark: '',
  299. GoodsorderId: '',
  300. ifPaotui: 0, //是否满减
  301. lng: '',
  302. lat: '',
  303. data: {
  304. multiArray: [],
  305. warning: '',
  306. startDate: '请选择'
  307. },
  308. workStart:'',//骑手上班时间
  309. workEnd:'',//骑手下班时间
  310. yusongTime:'',//骑手预计送达时长
  311. reservationFlag:0,//是否预约单 1是、0否
  312. expectDeliveryTime:'',//预约送达时间
  313. };
  314. },
  315. onLoad(option) {
  316. // #ifdef APP
  317. this.openLists = [{
  318. image: '../../../static/images/my/weixin.png',
  319. text: '微信',
  320. id: 2
  321. },
  322. {
  323. image: '../../../static/images/my/zhifubao.png',
  324. text: '支付宝',
  325. id: 3
  326. },
  327. {
  328. image: '../../../static/images/my/jinbi.png',
  329. text: '零钱',
  330. id: 1
  331. }
  332. ];
  333. // #endif
  334. // #ifdef MP-WEIXIN
  335. this.XCXIsSelect = this.$queue.getData('XCXIsSelect') ? this.$queue.getData('XCXIsSelect') : '是';
  336. this.openLists = [{
  337. image: '../../../static/images/my/weixin.png',
  338. text: '微信',
  339. id: 2
  340. },
  341. {
  342. image: '../../../static/images/my/jinbi.png',
  343. text: '零钱',
  344. id: 1
  345. }
  346. ];
  347. // #endif
  348. // #ifdef H5
  349. this.openLists = [{
  350. image: '../../../static/images/my/weixin.png',
  351. text: '微信',
  352. id: 2
  353. },
  354. {
  355. image: '../../../static/images/my/zhifubao.png',
  356. text: '支付宝',
  357. id: 3
  358. },
  359. {
  360. image: '../../../static/images/my/jinbi.png',
  361. text: '零钱',
  362. id: 1
  363. }
  364. ];
  365. // #endif
  366. this.shopId = option.shopId;
  367. // #ifndef H5
  368. uni.getLocation({
  369. type: 'gcj02', //返回可以用于uni.openLocation的经纬度
  370. success: function(res) {
  371. this.lat = res.latitude;
  372. this.lng = res.longitude;
  373. }
  374. });
  375. this.getShopDet(this.shopId);
  376. // #endif
  377. // #ifdef H5
  378. uni.getLocation({
  379. type: 'gcj02', //返回可以用于uni.openLocation的经纬度
  380. success: function(res) {
  381. this.lat = res.latitude;
  382. this.lng = res.longitude;
  383. }
  384. });
  385. this.getShopDet(this.shopId);
  386. // #endif
  387. this.orderType = option.orderType;
  388. if (option.orderId) {
  389. this.orderId = option.orderId;
  390. }
  391. uni.showLoading({
  392. title: '加载中...'
  393. });
  394. // this.getOrderList();
  395. this.getAddressList();
  396. this.getQishou()
  397. },
  398. onShow() {
  399. this.getMsgData();
  400. console.log(uni.getStorageSync('addressId'), '地址id');
  401. this.addressId = this.addressId ? this.addressId : uni.getStorageSync('addressId');
  402. if (this.addressId) {
  403. console.log(this.addressId, '地址id');
  404. this.address = {};
  405. this.getAddressDet(this.addressId);
  406. }
  407. },
  408. methods: {
  409. //获取骑手上下班时间
  410. getQishou(){
  411. this.$Request.get('/app/tbindent/work-time').then(res => {
  412. if (res.code == 0 && res.data) {
  413. this.workStart=parseInt((res.data.workingHoursOfRider).substring(0,2))
  414. this.workEnd=parseInt((res.data.workingHoursOfRider).substring(6,8))
  415. this.yusongTime=res.data.timeOfRider
  416. var date = new Date();
  417. var currentHours = date.getHours();
  418. var currentMinute = date.getMinutes();
  419. var temp = [];
  420. // currentHours = 12;
  421. var temp_time = [];
  422. //如果当前时间大于20点
  423. var minite=parseInt(this.yusongTime-parseInt(this.yusongTime/60)*60)
  424. if(parseInt(this.yusongTime/60)==0){
  425. var h1=0
  426. var h2=parseInt(this.yusongTime-parseInt(this.yusongTime/60)*60)
  427. }else{
  428. var h1=parseInt(this.yusongTime/60)
  429. var h2=parseInt(this.yusongTime-parseInt(this.yusongTime/60)*60)
  430. }
  431. var acc=currentHours + h1
  432. var bcc=currentMinute + h2
  433. var teshu=this.workStart + h1
  434. if(bcc>=60){
  435. var b=bcc-60
  436. var a=acc+1
  437. }else{
  438. var b=bcc
  439. var a=acc
  440. }
  441. var a1=a + 1
  442. var s1=a.toString()
  443. var s2=a1.toString()
  444. var e1=b.toString()
  445. if (currentHours >= (this.workEnd-h1)) {
  446. // this.$queue.setData({
  447. // warning:'当前时间段不在服务范围,现在下单,最早将于明早8点上门安装',
  448. // startDate:'明早 | 8:00-10:00'
  449. // })
  450. var time2=teshu+1
  451. this.data.warning = '当前时间段无骑手配送,现在下单,最早将于明日'+teshu + ':00'+'送达'
  452. this.data.startDate = '明日 | '+teshu + ':00' + '-' + time2 + ':00'
  453. // this.data.startDate = '明早 | '+a + ':'+b + '-' + a1 + ':'+b
  454. temp[0] = ["明天", "后天"];
  455. temp[1] = [];
  456. for (let i = teshu; i < (this.workEnd-h1);) {
  457. var i1 = i + 1;
  458. var ss1=i.toString()
  459. var ss2=i1.toString()
  460. temp[1].push(i + ':00' + '-' + i1 + ':00')
  461. i += 1;
  462. }
  463. } else if (currentHours < this.workStart) {
  464. // this.$queue.setData({
  465. // warning:'当前时间段不在服务范围,现在下单,最早将于今早8点上门安装',
  466. // startDate:'明早 | 8:00-10:00'
  467. // })
  468. var time2=teshu+1
  469. this.data.warning = '当前时间段无骑手配送,现在下单,最早将于今日'+teshu + ':00'+'送达'
  470. this.data.startDate = '今日 | '+teshu + ':00' + '-' + time2 + ':00'
  471. temp[0] = ["今天", "明天"];
  472. temp[1] = [];
  473. for (let i = teshu; i < (this.workEnd-h1);) {
  474. var i1 = i + 1;
  475. var ss1=i.toString()
  476. var ss2=i1.toString()
  477. temp[1].push(i + ':00' + '-' + i1 + ':00')
  478. i += 1;
  479. }
  480. } else {
  481. // this.$queue.setData({
  482. // startDate:'尽快送达 | 两小时内'
  483. // })
  484. // this.data.startDate = '尽快送达 | 两小时内'
  485. // this.data.startDate = s1.padStart(2,0) + ':'+e1.padStart(2,0) + '-' + s2.padStart(2,0) + ':'+e1.padStart(2,0)
  486. temp[0] = ["今天", "明天"];
  487. temp[1] = [];
  488. for (let i = a; i < (this.workEnd-h1);) {
  489. var i1 = i + 1;
  490. var ss1=i.toString()
  491. var ss2=i1.toString()
  492. temp[1].push(ss1.padStart(2,0) + ':'+e1.padStart(2,0) + '-' + ss2.padStart(2,0) + ':'+e1.padStart(2,0))
  493. i += 1;
  494. }
  495. }
  496. // this.$queue.setData({
  497. // multiArray:temp,
  498. // })
  499. this.data.multiArray = temp
  500. if(this.data.warning!=''){
  501. wx.showToast({
  502. title: this.data.warning,
  503. icon: 'none',
  504. duration: 3000
  505. })
  506. }
  507. }
  508. });
  509. },
  510. bindMultiPickerColumnChange: function(e) {
  511. console.log(e)
  512. console.log('第几列发生变化', e.detail.column)
  513. console.log('选择第几个', e.detail.value)
  514. let c = e.detail.column;
  515. let v = e.detail.value;
  516. var time = [];
  517. var date = new Date();
  518. console.log(date)
  519. var date = new Date();
  520. var currentHours = date.getHours();
  521. var currentMinute = date.getMinutes();
  522. var minite=parseInt(this.yusongTime-parseInt(this.yusongTime/60)*60)
  523. if(parseInt(this.yusongTime/60)==0){
  524. var h2=parseInt(this.yusongTime-parseInt(this.yusongTime/60)*60)
  525. }else{
  526. var h1=parseInt(this.yusongTime/60)
  527. var h2=parseInt(this.yusongTime-parseInt(this.yusongTime/60)*60)
  528. }
  529. var acc=currentHours + h1
  530. var bcc=currentMinute + h2
  531. var teshu=this.workStart + h1
  532. if(bcc>=60){
  533. var b=bcc-60
  534. var a=acc+1
  535. }else{
  536. var b=bcc
  537. var a=acc
  538. }
  539. var a1=a + 1
  540. var s1=a.toString()
  541. var s2=a1.toString()
  542. var e1=b.toString()
  543. var temp = this.data.multiArray;
  544. // currentHours = 12;
  545. if (c == 0) {
  546. if (temp[c][v] == '今天') {
  547. temp[1] = [];
  548. for (let i = a; i < (this.workEnd-h1);) {
  549. var i1 = i + 1;
  550. var ss1=i.toString()
  551. var ss2=i1.toString()
  552. temp[1].push(ss1.padStart(2,0) + ':'+e1.padStart(2,0) + '-' + ss2.padStart(2,0) + ':'+e1.padStart(2,0))
  553. i += 1;
  554. }
  555. } else {
  556. temp[1] = [];
  557. for (let i = teshu; i < (this.workEnd-h1);) {
  558. var i1 = i + 1;
  559. var ss1=i.toString()
  560. var ss2=i1.toString()
  561. temp[1].push(i + ':00' + '-' + i1 + ':00')
  562. i += 1;
  563. }
  564. }
  565. // this.$queue.setData({
  566. // multiArray:temp
  567. // })
  568. this.data.multiArray = temp
  569. this.$forceUpdate();
  570. console.log(this.data.multiArray, 'l')
  571. }
  572. },
  573. bindStartMultiPickerChange: function(e) {
  574. let temp = this.data.multiArray;
  575. // this.$queue.setData({
  576. // startDate:temp[0][e.detail.value[0]]+' | '+temp[1][e.detail.value[1]]
  577. // })
  578. this.data.startDate = temp[0][e.detail.value[0]] + ' | ' + temp[1][e.detail.value[1]]
  579. console.log(temp[0][e.detail.value[0]],temp[1][e.detail.value[1]],getDate(new Date(),2).fullDate)
  580. if(this.data.startDate){
  581. this.reservationFlag=1
  582. if(temp[0][e.detail.value[0]]=="今天") {
  583. var date=getDate(new Date()).fullDate
  584. this.expectDeliveryTime=date+' '+temp[1][e.detail.value[1]].substring(6,11)+":00"
  585. }else if(temp[0][e.detail.value[0]]=="明天") {
  586. var date=getDate(new Date(),1).fullDate
  587. this.expectDeliveryTime=date+' '+temp[1][e.detail.value[1]].substring(6,11)+":00"
  588. }else if(temp[0][e.detail.value[0]]=="后天") {
  589. var date=getDate(new Date(),2).fullDate
  590. this.expectDeliveryTime=date+' '+temp[1][e.detail.value[1]].substring(6,11)+":00"
  591. }
  592. }
  593. },
  594. goCash() {
  595. uni.navigateTo({
  596. url: '/my/wallet/index'
  597. });
  598. },
  599. getMsgData() {
  600. this.$Request.get("/app/userintegral/findUserMessage").then(res => {
  601. if (res.code == 0 && res.data) {
  602. this.userMoney = res.data.userMoney ? res.data.userMoney : 0;
  603. }
  604. });
  605. },
  606. //获取店铺详情
  607. getShopDet(shopId) {
  608. let data = {
  609. shopId,
  610. lng: this.lng,
  611. lat: this.lat
  612. };
  613. this.$Request.get('/app/goods/selectGoodsList', data).then(res => {
  614. if (res.code == 0 && res.data) {
  615. this.shopDet = res.data.goodsShop;
  616. this.ifPaotui = res.data.goodsShop.enableFullReductionFlag
  617. this.getOrderList();
  618. }
  619. });
  620. },
  621. goBack() {
  622. uni.navigateBack({});
  623. },
  624. isShow() {
  625. this.show = true;
  626. },
  627. //选择优惠活动弹框
  628. huodongShow() {
  629. this.youhui = true
  630. },
  631. getDistance() {
  632. if (this.address.lng && this.dataList.shopLng) {
  633. let data = {
  634. ol: this.address.lng,
  635. od: this.address.lat,
  636. dl: this.dataList.shopLng,
  637. dd: this.dataList.shopLat
  638. };
  639. this.$Request.post('/app/tbindent/distance', data).then(res => {
  640. if (res.code == 0) {
  641. this.distance = res.data;
  642. if (this.distance > Number(this.dataList.distributionDistance)) {
  643. this.isTrue = true;
  644. } else {
  645. this.isTrue = false;
  646. }
  647. }
  648. });
  649. }
  650. },
  651. close() {
  652. this.show = false;
  653. },
  654. closeYouhui() {
  655. this.youhui = false;
  656. },
  657. switchTab(e) {
  658. this.orderType = e;
  659. this.coupon = '';
  660. this.huodong-''
  661. if (JSON.stringify(this.address) != '{}') {
  662. this.getDistance();
  663. }
  664. if (this.orderType == 2) {
  665. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.paotuiMoney) + parseFloat(
  666. this.dabaoMoney)).toFixed(2);
  667. } else {
  668. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this.dabaoMoney)).toFixed(2);
  669. }
  670. if (this.coupon) {
  671. let totalMoney = parseFloat(parseFloat(this.totalPrice1) - (parseFloat(this.coupon.money) ? parseFloat(
  672. this.coupon.money) : 0)).toFixed(2);
  673. if (totalMoney <= 0) {
  674. this.totalPrice1 = 0.01;
  675. } else {
  676. this.totalPrice1 = totalMoney;
  677. }
  678. }
  679. },
  680. // 删除优惠券
  681. detCoupon() {
  682. let data = {
  683. orderId: this.dataList.orderId
  684. };
  685. this.$Request.post('/app/order/deleteCouponByOrderId', data).then(res => {
  686. if (res.code == 0) {}
  687. });
  688. },
  689. // 选择优惠券
  690. selCoupon(item) {
  691. this.coupon = item;
  692. if (this.orderType == 2) {
  693. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney).toFixed(2);
  694. } else {
  695. this.totalPrice1 = parseFloat(this.totalPrice + this.dabaoMoney).toFixed(2);
  696. }
  697. let totalMoney = parseFloat(this.totalPrice1 - (this.coupon.money ? this.coupon.money : 0)).toFixed(2);
  698. if (totalMoney <= 0) {
  699. this.totalPrice1 = 0.01;
  700. } else {
  701. this.totalPrice1 = totalMoney;
  702. }
  703. let data = {
  704. parentId: this.dataList.parentId,
  705. couponId: this.coupon ? this.coupon.id : ''
  706. };
  707. this.$Request.post('/app/order/employCoupon', data).then(res => {
  708. if (res.code == 0) {
  709. this.show = false;
  710. }
  711. });
  712. },
  713. //选择活动activityId
  714. selctHuo(item) {
  715. this.huodong = item;
  716. if (this.orderType == 2) {
  717. this.totalPrice1 = parseFloat(this.totalPrice + this.paotuiMoney + this.dabaoMoney).toFixed(2);
  718. } else {
  719. this.totalPrice1 = parseFloat(this.totalPrice + this.dabaoMoney).toFixed(2);
  720. }
  721. let totalMoney = parseFloat(this.totalPrice1 - (this.huodong.discountAmount ? this.huodong.discountAmount : 0)).toFixed(2);
  722. if (totalMoney <= 0) {
  723. this.totalPrice1 = 0.01;
  724. } else {
  725. this.totalPrice1 = totalMoney;
  726. }
  727. this.youhui = false;
  728. // let data = {
  729. // parentId: this.dataList.parentId,
  730. // couponId: this.huodong ? this.huodong.id : ''
  731. // };
  732. // this.$Request.post('/app/order/employCoupon', data).then(res => {
  733. // if (res.code == 0) {
  734. // this.show = false;
  735. // }
  736. // });
  737. },
  738. // 优惠卷列表
  739. getCouponList() {
  740. // console.log(this.paotuiMoney)
  741. // console.log(this.dabaoMoney, '123123')
  742. let minMoney =
  743. this.orderType == 2 ?
  744. parseFloat(parseFloat(this.totalPrice) + parseFloat(this.paotuiMoney) + parseFloat(this.dabaoMoney))
  745. .toFixed(2) :
  746. parseFloat(this.totalPrice).toFixed(2);
  747. let data = {
  748. shopId: this.dataList.shopId,
  749. page: 1,
  750. limit: 10,
  751. minMoney: minMoney
  752. };
  753. this.$Request.get('/app/coupon/selectUserCouponList', data).then(res => {
  754. if (res.code == 0) {
  755. this.couponList = res.data.list;
  756. }
  757. });
  758. },
  759. // 优惠活动列表
  760. getHuoList() {
  761. let data = {
  762. orderId: this.dataList.orderId,
  763. };
  764. this.$Request.get(`/app/activity/suit-activity/${this.dataList.orderId}`, data).then(res => {
  765. if (res.code == 0) {
  766. this.huoList = res.data;
  767. }
  768. });
  769. },
  770. //拼单支付成功取消订单
  771. cancelPinDan() {
  772. let that = this;
  773. // if (that.orderId) {
  774. // let data = {
  775. // orderId: that.orderId
  776. // };
  777. // that.$Request.post('/app/order/deleteOrder', data).then(res => {
  778. // if (res.code == 0) {
  779. // uni.removeStorageSync('orderId');
  780. // }
  781. // });
  782. // }
  783. },
  784. // 商品列表
  785. getOrderList() {
  786. let data = {
  787. shopId: this.shopId,
  788. status: 1,
  789. page: 1,
  790. limit: 1000
  791. // orderType: this.orderType
  792. };
  793. this.$Request.get('/app/order/selectAllOrderList', data).then(res => {
  794. uni.hideLoading();
  795. if (res.code == 0 && res.data.pageUtils.list) {
  796. this.GoodsorderId = res.data.pageUtils.list[0].orderId;
  797. this.dataList = res.data.pageUtils.list[0];
  798. if (this.dataList && this.dataList.orderGoodsList && this.dataList.orderGoodsList[0]) {
  799. this.dataList.orderGoodsList[0].forEach(res => {
  800. res.goodsPicture = res.goodsPicture.split(',');
  801. this.dabaoMoney += res.goodsPack * res.goodsNum;
  802. this.goodsMoney += res.goodsPrice * res.goodsNum;
  803. this.goodsMoney = parseFloat(this.goodsMoney + this.dabaoMoney);
  804. });
  805. this.goodsList = this.dataList.orderGoodsList[0];
  806. }
  807. // this.paotuiMoney = this.dataList.errandMoney
  808. if (this.ifPaotui == 1) {
  809. this.paotuiMoney = this.dataList.errandMoney;
  810. } else if (this.ifPaotui == 0) {
  811. // 判断商品金额是否大于最低减免配送费金额
  812. console.log(this.goodsMoney, '商品总金额', res, this.dataList.exemptMinMoney)
  813. if (Number(this.goodsMoney) >= Number(this.dataList.exemptMinMoney)) {
  814. this.paotuiMoney = 0;
  815. } else {
  816. this.paotuiMoney = this.dataList.errandMoney;
  817. }
  818. }
  819. this.totalPrice = res.data.money;
  820. if (this.orderType == 2) {
  821. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this
  822. .paotuiMoney) + parseFloat(this.dabaoMoney)).toFixed(2);
  823. } else {
  824. this.totalPrice1 = parseFloat(parseFloat(this.totalPrice) + parseFloat(this
  825. .dabaoMoney)).toFixed(2);
  826. }
  827. // console.log(this.dataList)
  828. this.getCouponList();
  829. this.getHuoList();
  830. this.detCoupon();
  831. this.getDistance();
  832. }
  833. });
  834. },
  835. selectWay(item) {
  836. this.openWay = item.id;
  837. },
  838. takeReark() {
  839. let datas = {
  840. orderId: this.GoodsorderId,
  841. remark: this.remark
  842. };
  843. this.$Request.post('/app/order/updateOrdersRemark', datas).then(res => {
  844. if (res.code == 0) {} else {
  845. uni.showToast({
  846. title: res.msg,
  847. icon: 'none'
  848. });
  849. }
  850. });
  851. },
  852. // 立即结算
  853. toSettlement() {
  854. if (this.isThrottle == false) {
  855. return
  856. }
  857. let that = this;
  858. if (this.isTrue && this.orderType == 2) {
  859. uni.showToast({
  860. title: '超出配送范围',
  861. icon: 'none'
  862. });
  863. reutrn;
  864. }
  865. if (this.orderType == 2 && !this.address.addressId) {
  866. uni.showToast({
  867. title: '请选择收货地址',
  868. icon: 'none'
  869. });
  870. return;
  871. }
  872. if (this.remark) {
  873. this.takeReark();
  874. }
  875. uni.showLoading({
  876. title: '支付中...'
  877. });
  878. this.isThrottle = false
  879. if (this.openWay == 1) {
  880. //零钱支付
  881. let data = {
  882. userId:uni.getStorageSync('userId'),
  883. type:1,//支付方式 1表示微信支付、4或5表示支付宝支付
  884. activityId:this.huodong ? this.huodong.activityId : '',
  885. reservationFlag:this.reservationFlag,//是否预约单 1是、0否
  886. expectDeliveryTime:this.expectDeliveryTime,//期待送达时间 yyyy-MM-dd HH:mm:ss
  887. parentId: this.dataList.parentId,
  888. couponId: this.coupon ? this.coupon.id : '',
  889. addressId: this.address.addressId ? this.address.addressId : '',
  890. orderType: this.orderType
  891. };
  892. this.$Request.post('/app/wxPay/balanceOrder', data).then(res => {
  893. if (res.code == 0) {
  894. uni.hideLoading();
  895. that.$queue.showToast('支付成功');
  896. that.cancelPinDan();
  897. setTimeout(function() {
  898. that.isThrottle = true
  899. uni.switchTab({
  900. url: '/pages/order/index'
  901. });
  902. }, 1000);
  903. } else {
  904. that.$queue.showToast(res.msg);
  905. that.isThrottle = true
  906. }
  907. });
  908. } else if (this.openWay == 2) {
  909. //微信支付
  910. // #ifdef H5
  911. let data = {
  912. userId:uni.getStorageSync('userId'),
  913. type:1,//支付方式 1表示微信支付、4或5表示支付宝支付
  914. activityId:this.huodong ? this.huodong.activityId : '',
  915. reservationFlag:this.reservationFlag,//是否预约单 1是、0否
  916. expectDeliveryTime:this.expectDeliveryTime,//期待送达时间 yyyy-MM-dd HH:mm:ss
  917. parentId: this.dataList.parentId,
  918. couponId: this.coupon ? this.coupon.id : '',
  919. addressId: this.address.addressId ? this.address.addressId : '',
  920. orderType: this.orderType,
  921. type: 2
  922. };
  923. this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then(res => {
  924. uni.hideLoading();
  925. if (res.code == 0) {
  926. this.callPay(res.data);
  927. } else {
  928. uni.showToast({
  929. title: res.msg,
  930. icon: 'none'
  931. });
  932. this.isThrottle = true
  933. }
  934. });
  935. // #endif
  936. // #ifdef MP-WEIXIN
  937. let data = {
  938. userId:uni.getStorageSync('userId'),
  939. type:4,//支付方式 1表示微信支付、4或5表示支付宝支付
  940. activityId:this.huodong ? this.huodong.activityId : '',
  941. reservationFlag:this.reservationFlag,//是否预约单 1是、0否
  942. expectDeliveryTime:this.expectDeliveryTime,//期待送达时间 yyyy-MM-dd HH:mm:ss
  943. parentId: this.dataList.parentId,
  944. couponId: this.coupon ? this.coupon.id : '',
  945. addressId: this.address.addressId ? this.address.addressId : '',
  946. orderType: this.orderType,
  947. type: 3
  948. };
  949. this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then(res => {
  950. // uni.hideLoading();
  951. if (res.code == 0) {
  952. uni.requestPayment({
  953. provider: 'wxpay',
  954. timeStamp: res.data.timestamp,
  955. nonceStr: res.data.noncestr,
  956. package: res.data.package,
  957. signType: res.data.signType,
  958. paySign: res.data.sign,
  959. success: function(suc) {
  960. that.cancelPinDan();
  961. uni.hideLoading();
  962. that.$queue.showToast('支付成功');
  963. setTimeout(function() {
  964. that.isThrottle = true
  965. uni.switchTab({
  966. url: '/pages/order/index'
  967. });
  968. }, 1000);
  969. },
  970. fail: function(err) {
  971. console.log('fail:' + JSON.stringify(err));
  972. that.isThrottle = true
  973. uni.showToast({
  974. title: '支付失败',
  975. icon: 'none'
  976. });
  977. }
  978. });
  979. } else {
  980. uni.showToast({
  981. title: res.msg,
  982. icon: 'none'
  983. });
  984. that.isThrottle = true
  985. }
  986. });
  987. // #endif
  988. // #ifdef APP
  989. let data = {
  990. type: 1,
  991. parentId: this.dataList.parentId,
  992. couponId: this.coupon ? this.coupon.id : '',
  993. addressId: this.address.addressId ? this.address.addressId : '',
  994. orderType: this.orderType
  995. };
  996. this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then(res => {
  997. console.log(res);
  998. this.showpay = false;
  999. if (res.code == 0) {
  1000. this.isCheckPay(res.code, 'wxpay', JSON.stringify(res.data));
  1001. } else {
  1002. that.isThrottle = true
  1003. }
  1004. });
  1005. // #endif
  1006. } else if (this.openWay == 3) {
  1007. // #ifdef H5
  1008. let data = {
  1009. type: 5,
  1010. parentId: this.dataList.parentId,
  1011. couponId: this.coupon ? this.coupon.id : '',
  1012. addressId: this.address.addressId ? this.address.addressId : '',
  1013. orderType: this.orderType
  1014. };
  1015. this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then(res => {
  1016. this.showpay = false;
  1017. this.isThrottle = true
  1018. const div = document.createElement('div');
  1019. div.innerHTML = res.data; //此处form就是后台返回接收到的数据
  1020. document.body.appendChild(div);
  1021. document.forms[0].submit();
  1022. });
  1023. // #endif
  1024. // #ifdef APP
  1025. let data = {
  1026. type: 4,
  1027. parentId: this.dataList.parentId,
  1028. couponId: this.coupon ? this.coupon.id : '',
  1029. addressId: this.address.addressId ? this.address.addressId : '',
  1030. orderType: this.orderType
  1031. };
  1032. this.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then(res => {
  1033. this.showpay = false;
  1034. this.setPayment('alipay', res.data);
  1035. });
  1036. // #endif
  1037. }
  1038. },
  1039. callPay: function(response) {
  1040. if (typeof WeixinJSBridge === 'undefined') {
  1041. if (document.addEventListener) {
  1042. document.addEventListener('WeixinJSBridgeReady', this.onBridgeReady(response), false);
  1043. } else if (document.attachEvent) {
  1044. document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady(response));
  1045. document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady(response));
  1046. }
  1047. } else {
  1048. this.onBridgeReady(response);
  1049. }
  1050. },
  1051. onBridgeReady: function(response) {
  1052. let that = this;
  1053. if (!response.package) {
  1054. return;
  1055. }
  1056. WeixinJSBridge.invoke(
  1057. 'getBrandWCPayRequest', {
  1058. appId: response.appid, //公众号名称,由商户传入
  1059. timeStamp: response.timestamp, //时间戳,自1970年以来的秒数
  1060. nonceStr: response.noncestr, //随机串
  1061. package: response.package,
  1062. signType: response.signType, //微信签名方式:
  1063. paySign: response.sign //微信签名
  1064. },
  1065. function(res) {
  1066. if (res.err_msg === 'get_brand_wcpay_request:ok') {
  1067. // 使用以上方式判断前端返回,微信团队郑重提示:
  1068. //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
  1069. that.cancelPinDan();
  1070. that.$queue.showToast('支付成功');
  1071. setTimeout(function() {
  1072. uni.switchTab({
  1073. url: '/pages/order/index'
  1074. });
  1075. that.isThrottle = true
  1076. }, 1000);
  1077. } else {
  1078. uni.hideLoading();
  1079. that.isThrottle = true
  1080. }
  1081. WeixinJSBridge.log(response.err_msg);
  1082. }
  1083. );
  1084. },
  1085. isCheckPay(code, name, order) {
  1086. if (code == 0) {
  1087. console.log('999999999999');
  1088. this.setPayment(name, order);
  1089. } else {
  1090. uni.hideLoading();
  1091. uni.showToast({
  1092. title: '支付信息有误'
  1093. });
  1094. this.isThrottle = true
  1095. }
  1096. },
  1097. setPayment(name, order) {
  1098. let that = this;
  1099. console.log(777777777, name, order);
  1100. uni.requestPayment({
  1101. provider: name,
  1102. orderInfo: order, //微信、支付宝订单数据
  1103. success: function(res) {
  1104. uni.hideLoading();
  1105. that.cancelPinDan();
  1106. uni.showLoading({
  1107. title: '支付成功',
  1108. icon: 'none'
  1109. });
  1110. setTimeout(function() {
  1111. that.isThrottle = true
  1112. uni.navigateBack();
  1113. }, 1000);
  1114. },
  1115. fail: function(err) {
  1116. uni.hideLoading();
  1117. that.isThrottle = true
  1118. },
  1119. complete() {
  1120. that.isThrottle = true
  1121. uni.hideLoading();
  1122. }
  1123. });
  1124. },
  1125. // 获取选择的地址
  1126. getAddressDet(e) {
  1127. this.$Request.get('/app/address/selectAddressById?addressId=' + e).then(res => {
  1128. if (res.code == 0) {
  1129. this.address = res.data;
  1130. if (JSON.stringify(this.address) != '{}') {
  1131. this.getDistance();
  1132. }
  1133. uni.removeStorageSync('addressId');
  1134. }
  1135. });
  1136. },
  1137. // 获取地址列表
  1138. getAddressList() {
  1139. let that = this;
  1140. let data = {
  1141. page: 1,
  1142. limit: 100
  1143. };
  1144. that.$Request.get('/app/address/selectAddressList', data).then(res => {
  1145. if (res.code == 0) {
  1146. that.address = res.data.list[0] ? res.data.list[0] : {};
  1147. res.data.list.forEach(ret => {
  1148. if (ret.addressDefault == 1) {
  1149. that.address = ret;
  1150. }
  1151. });
  1152. if (JSON.stringify(this.address) != '{}') {
  1153. this.getDistance();
  1154. }
  1155. }
  1156. });
  1157. },
  1158. goAddress() {
  1159. uni.navigateTo({
  1160. url: '/my/address/index?add=1'
  1161. });
  1162. },
  1163. // 点击调起地图查看位置
  1164. goMap() {
  1165. // let that = this
  1166. // let plugin = requirePlugin('routePlan');
  1167. // let key = 'A3RBZ-23MHW-PTPR5-RLCER-UJTXQ-JIF2G'; //使用在腾讯位置服务申请的key
  1168. // let referer = that.dataList.shopName; //调用插件的app的名称
  1169. // let endPoint = JSON.stringify({ //终点
  1170. // 'name': that.dataList.shopName,
  1171. // 'latitude': that.dataList.shopLat,
  1172. // 'longitude': that.dataList.shopLng,
  1173. // });
  1174. // wx.navigateTo({
  1175. // url: 'plugin://routePlan/index?key=' + key + '&referer=' + referer + '&endPoint=' + endPoint
  1176. // });
  1177. let that = this;
  1178. let lati = parseFloat(that.dataList.shopLat);
  1179. let longi = parseFloat(that.dataList.shopLng);
  1180. uni.authorize({
  1181. scope: 'scope.userLocation',
  1182. success(res) {
  1183. uni.openLocation({
  1184. name: that.dataList.shopName,
  1185. latitude: lati,
  1186. longitude: longi,
  1187. success: function() {}
  1188. });
  1189. },
  1190. fail(err) {}
  1191. });
  1192. },
  1193. // 打电话
  1194. call() {
  1195. uni.makePhoneCall({
  1196. phoneNumber: this.dataList.shopPhone
  1197. });
  1198. }
  1199. }
  1200. };
  1201. </script>
  1202. <style scoped>
  1203. .hintPopul {
  1204. width: 100%;
  1205. height: 100vh;
  1206. position: fixed;
  1207. top: 0;
  1208. background: rgba(0, 0, 0, 0.4);
  1209. z-index: 999;
  1210. }
  1211. .content_ {
  1212. position: absolute;
  1213. left: 0;
  1214. right: 0;
  1215. top: 0;
  1216. bottom: 0;
  1217. margin: auto;
  1218. text-align: center;
  1219. width: 500rpx;
  1220. height: 400rpx;
  1221. border-radius: 20rpx;
  1222. background-color: #fff;
  1223. padding-top: 120rpx;
  1224. }
  1225. .content_ image {
  1226. position: absolute;
  1227. top: -50rpx;
  1228. left: 0;
  1229. right: 0;
  1230. margin: auto;
  1231. }
  1232. .hintText {
  1233. font-size: 30rpx;
  1234. }
  1235. .Btns {
  1236. width: 460rpx;
  1237. height: 60rpx;
  1238. line-height: 60rpx;
  1239. text-align: center;
  1240. background: #fcd202;
  1241. font-size: 28rpx;
  1242. border: 2rpx solid #fcd202;
  1243. color: #333333;
  1244. border-radius: 50rpx;
  1245. font-weight: 700;
  1246. margin: auto;
  1247. }
  1248. .goods_address {
  1249. width: 94%;
  1250. background: #ffffff;
  1251. height: 120rpx;
  1252. margin: 20rpx auto 0;
  1253. border-radius: 18rpx;
  1254. }
  1255. .address_box {
  1256. width: 90%;
  1257. margin: 0 auto;
  1258. height: 120rpx;
  1259. display: flex;
  1260. line-height: 120rpx;
  1261. }
  1262. .address_name {
  1263. flex: 1;
  1264. font-size: 30rpx;
  1265. }
  1266. .address_image {
  1267. /* flex: 1; */
  1268. display: flex;
  1269. justify-content: flex-end;
  1270. align-items: center;
  1271. }
  1272. .address_image image {
  1273. width: 25rpx;
  1274. height: 40rpx;
  1275. }
  1276. .songda_image image {
  1277. width: 20rpx;
  1278. height: 30rpx;
  1279. margin-left: 20rpx;
  1280. }
  1281. /* 地址 */
  1282. .address {
  1283. width: 88%;
  1284. margin: 3% auto;
  1285. padding: 3%;
  1286. display: flex;
  1287. background-color: #ffffff;
  1288. border-radius: 18rpx;
  1289. }
  1290. .adderss_le {
  1291. width: 90%;
  1292. line-height: 1.5;
  1293. }
  1294. .adderss_le_text {
  1295. font-size: 30rpx;
  1296. font-weight: bold;
  1297. color: #333333;
  1298. }
  1299. .adderss_le_text2 {
  1300. font-size: 24rpx;
  1301. font-weight: 500;
  1302. color: #999999;
  1303. display: flex;
  1304. }
  1305. .adderss_le_text2 view {
  1306. margin-left: 2%;
  1307. }
  1308. .adderss_le_text2 view:first-child {
  1309. margin-left: 0;
  1310. }
  1311. .adderss_ri {
  1312. width: 10%;
  1313. text-align: right;
  1314. line-height: 3;
  1315. }
  1316. .adderss_ri image {
  1317. width: 18rpx;
  1318. height: 30rpx;
  1319. }
  1320. /* 商品 */
  1321. .food {
  1322. width: 94%;
  1323. margin: 3% auto;
  1324. padding: 3%;
  1325. background-color: #ffffff;
  1326. border-radius: 18rpx;
  1327. }
  1328. .tosend_header_food {
  1329. width: 100%;
  1330. display: flex;
  1331. margin-top: 3%;
  1332. }
  1333. .tosend_header_food_le {
  1334. width: 15%;
  1335. }
  1336. .tosend_header_food_le image {
  1337. width: 110rpx;
  1338. height: 110rpx;
  1339. border-radius: 10rpx;
  1340. }
  1341. .tosend_header_food_ce {
  1342. margin: 0 0 0 4%;
  1343. width: 57%;
  1344. }
  1345. .tosend_header_food_ri {
  1346. text-align: right;
  1347. width: 25%;
  1348. }
  1349. .tosend_header_food_text {
  1350. font-size: 34rpx;
  1351. font-weight: 500;
  1352. color: #333333;
  1353. line-height: 1.8;
  1354. }
  1355. .tosend_header_food_text text {
  1356. font-size: 25rpx;
  1357. }
  1358. .tosend_header_food_text2 {
  1359. font-size: 28rpx;
  1360. font-weight: 500;
  1361. color: #999999;
  1362. }
  1363. .do_top {
  1364. padding-top: 3%;
  1365. }
  1366. .do_bot {
  1367. padding-bottom: 3%;
  1368. border-bottom: 2rpx solid #e6e6e6;
  1369. }
  1370. .tosend_header_do {
  1371. width: 100%;
  1372. color: #333333;
  1373. font-size: 30rpx;
  1374. display: flex;
  1375. margin-top: 20rpx;
  1376. line-height: 1.5;
  1377. }
  1378. .tosend_header_do view {
  1379. /* flex: 1; */
  1380. }
  1381. .tosend_header_do_ri {
  1382. text-align: right;
  1383. }
  1384. .tosend_header_do_le2 {
  1385. font-family: PingFang SC;
  1386. font-weight: 500;
  1387. color: #999999;
  1388. padding-top: 1.5%;
  1389. }
  1390. .tosend_header_do_ri2 {
  1391. text-align: right;
  1392. color: #ea0000;
  1393. font-size: 40rpx;
  1394. }
  1395. .tosend_header_do_ri2 text {
  1396. font-size: 30rpx;
  1397. }
  1398. /* 支付 */
  1399. /* .payment_all{
  1400. width: 88%;margin: 3% auto;padding: 3%;background-color: #FFFFFF;
  1401. border-radius: 18rpx;
  1402. }
  1403. .payment{
  1404. width: 100%;display: flex;margin-top: 3%;
  1405. }
  1406. .payment_le{
  1407. width: 13%;
  1408. }
  1409. .payment_le image{
  1410. width: 60rpx;height: 60rpx;
  1411. }
  1412. .payment_ce{
  1413. width: 52%;
  1414. font-size: 30rpx;
  1415. font-weight: bold;
  1416. color: #333333;line-height: 60rpx;
  1417. }
  1418. .payment_ri{
  1419. width: 35%;text-align: right;line-height: 60rpx;
  1420. } */
  1421. /* 结算 */
  1422. .goorder {
  1423. width: 100%;
  1424. padding: 2% 3%;
  1425. position: fixed;
  1426. bottom: 0;
  1427. background-color: #ffffff;
  1428. z-index: 999;
  1429. }
  1430. .goorder_but {
  1431. width: 100%;
  1432. line-height: 3.5;
  1433. text-align: center;
  1434. background: #fcd202;
  1435. border-radius: 36rpx;
  1436. font-weight: 700;
  1437. }
  1438. .goorder_but_ {
  1439. opacity: 0.5;
  1440. }
  1441. .bg {
  1442. background-color: #ffffff;
  1443. }
  1444. .tabBtn {
  1445. /* background-color: #f6f6fa; */
  1446. height: 60rpx;
  1447. line-height: 60rpx;
  1448. color: #999999;
  1449. font-size: 38rpx;
  1450. }
  1451. .active {
  1452. /* width: 82rpx; */
  1453. height: 6rpx;
  1454. background: #fcd202;
  1455. /* position: relative;
  1456. top: -20rpx; */
  1457. z-index: 9;
  1458. }
  1459. </style>