index.vue 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014
  1. <template>
  2. <view>
  3. <view class='order-submission'>
  4. <view class="allAddress" @click="onAddress">
  5. <view class='address acea-row row-between-wrapper' v-if='shippingType == 0 '>
  6. <view class='addressCon' v-if="addressInfo.real_name">
  7. <view class='name'>{{addressInfo.real_name}}
  8. <text class='phone'>{{addressInfo.phone}}</text>
  9. </view>
  10. <view>
  11. <text class='default font-color' v-if="addressInfo.is_default">[默认]</text>{{addressInfo.province}}{{addressInfo.city}}{{addressInfo.district}}{{addressInfo.detail}}</view>
  12. <!-- <view class='setaddress'>设置收货地址</view> -->
  13. </view>
  14. <view class='addressCon' v-else>
  15. <view class='setaddress'>设置收货地址</view>
  16. </view>
  17. <view class='iconfont icon-jiantou'></view>
  18. </view>
  19. <view class='line'>
  20. <image src='/static/images/line.jpg'></image>
  21. </view>
  22. </view>
  23. <!-- 商品信息 -->
  24. <view class="storeinfo-wrapper">
  25. <view class="store-item" v-for="(item,index) in cartInfo" :key="index">
  26. <view class="store-title">
  27. <text class="iconfont icon-shangjiadingdan"></text>
  28. <view class="txt" @click="goStore(item.mer_id)">{{item.mer_name}}</view>
  29. <text class="iconfont icon-xiangyou"></text>
  30. </view>
  31. <view v-for="(goods,j) in item.list" :key="j">
  32. <view v-if="goods.product_type == 2">
  33. <view class="product-item">
  34. <view class="img-box">
  35. <image :src="goods.productPresellAttr.image || goods.product.image"></image>
  36. </view>
  37. <view class="content event_content">
  38. <view class="name line1"><text class="event_name event_bg">预售</text>{{goods.productPresell.store_name}}</view>
  39. <view class="label" style="width: 70%;">{{goods.productAttr.sku}}</view>
  40. <view class="price">
  41. ¥{{goods.productPresellAttr.presell_price}}
  42. <text>X{{goods.cart_num}}</text>
  43. </view>
  44. <view class="event_ship event_color">发货时间:
  45. <!--全款预售-->
  46. <text v-if="goods.productPresell.presell_type === 1">{{goods.productPresell.delivery_type === 1 ? '支付后' : '预售结束后'}}{{ goods.productPresell.delivery_day }}天内</text>
  47. <!--定金预售-->
  48. <text v-if="goods.productPresell.presell_type === 2">{{ goods.productPresell.delivery_type === 1 ? '付尾款后' : '预售结束后' }}{{ goods.productPresell.delivery_day }}天内</text>
  49. </view>
  50. <view class="err-txt" v-if="goods.undelivered && addressInfo.real_name">
  51. <text class="iconfont icon-zhuyi-copy"></text>
  52. <view class="txt">此商品不支持该区域配送</view>
  53. </view>
  54. </view>
  55. </view>
  56. <view v-if="goods.productPresell.presell_type === 2" class="event_payTime">
  57. <view class="event_progress">
  58. <view class="progress_step">
  59. <text class="name color_red">定金</text>
  60. <text class="price color_red">¥{{ (goods.productPresellAttr.down_price * goods.cart_num).toFixed(2) }}</text>
  61. </view>
  62. <view class="progress_step">
  63. <text class="name">尾款</text>
  64. <text class="price">¥{{ (goods.productPresellAttr.final_price * goods.cart_num).toFixed(2) }}</text>
  65. </view>
  66. <view class="progress_pay">{{ goods.productPresell.final_start_time | filterDay}}开始支付尾款</view>
  67. </view>
  68. </view>
  69. </view>
  70. <view v-else>
  71. <view class="product-item">
  72. <view class="img-box">
  73. <image :src="goods.productAttr.image || goods.product.image"></image>
  74. </view>
  75. <view class="content">
  76. <view class="name line1">{{goods.product.store_name}}</view>
  77. <view class="label">{{goods.productAttr.sku}}</view>
  78. <view class="price">
  79. <block v-if="order_type == 3">
  80. ¥{{goods.productAssistAttr.assist_price}}
  81. </block>
  82. <block v-else-if="order_type == 4">
  83. ¥{{goods.activeSku.active_price}}
  84. </block>
  85. <block v-else>
  86. ¥{{goods.productAttr.price}}
  87. </block>
  88. <text>X{{goods.cart_num}}</text>
  89. </view>
  90. <view class="err-txt" v-if="goods.undelivered && addressInfo.real_name">
  91. <text class="iconfont icon-zhuyi-copy"></text>
  92. <view class="txt">此商品不支持该区域配送</view>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. <view class="wrapper">
  99. <view class="boxs" v-if="item.take.mer_take_status != 0">
  100. <view class='item acea-row row-between-wrapper' @tap='openShowBox(item,index)'>
  101. <view>配送方式</view>
  102. <view class='discount'>
  103. {{item.isTake==0?'快递配送':'到店自提'}}
  104. <text class='iconfont icon-jiantou'></text>
  105. </view>
  106. </view>
  107. <view class="store-address" v-if="item.isTake">
  108. <view class="name">{{item.take.mer_take_name}}</view>
  109. <view class="info">{{item.take.mer_take_address}}</view>
  110. <view class="map" @click="goMap(item)">
  111. <text class="iconfont icon-chakanditu"></text>
  112. <view class="map_text">查看地图</view>
  113. </view>
  114. </view>
  115. </view>
  116. <view class='item acea-row row-between-wrapper' v-if='shippingType==0 && item.isTake == 0'>
  117. <view>快递费用 <text v-if="item.list[0].productPresell && item.list[0].productPresell.presell_type == 2">(尾款阶段)</text>
  118. </view>
  119. <view class='discount' v-if='item.order.postage_price > 0'>+¥{{item.order.postage_price}}</view>
  120. <view class='discount' v-else>免运费</view>
  121. </view>
  122. <view class='item acea-row row-between-wrapper' v-if="!pinkId && !BargainId && !combinationId && !seckillId && order_type != 3 && order_type != 4">
  123. <view>优惠券</view>
  124. <block v-if="item.coupon.length>0">
  125. <view class='discount' @tap='couponTap(item,index)'>
  126. <text v-if="item.order.coupon_price>0">优惠¥{{item.order.coupon_price}}</text>
  127. <text v-else>暂未选择优惠券</text>
  128. <text class='iconfont icon-jiantou'></text>
  129. </view>
  130. </block>
  131. <block v-else>
  132. <view class='discount'>暂无优惠券</view>
  133. </block>
  134. </view>
  135. <view v-if="item.openReceipt == 1" class='item acea-row row-between-wrapper' @tap="goInvoice(item.mer_id)">
  136. <!-- <view v-if="item.openReceipt == 1" class='item acea-row row-between-wrapper' @tap="goInvoice(item.mer_id)"> -->
  137. <view>开具发票</view>
  138. <view class='discount discount_voice'>
  139. {{(item.invoiceData && item.invoiceData.receipt_title) ? item.invoiceData.receipt_title : '不开发票'}}
  140. <text class='iconfont icon-jiantou'></text>
  141. </view>
  142. </view>
  143. <view v-if="order_type === 2 && item.list[0].productPresell.presell_type ==2" class="item acea-row row-between-wrapper"
  144. style="border-top: 1px solid #f5f5f5; border-bottom: 1px solid #f5f5f5;">
  145. <checkbox-group class="checkgroup" @change='changeIsAgree'>
  146. <text class="iconfont icon-wenhao1"></text>
  147. <text @click="showProtocol = true">我已同意定金不退等预售协议</text>
  148. <checkbox class="checkbox" :checked="isAgree ? true : false" />
  149. </checkbox-group>
  150. </view>
  151. <view class='item acea-row row-between-wrapper' v-if="textareaStatus">
  152. <view>备注信息</view>
  153. <input v-if="coupon.status===false" placeholder-class='placeholder' @input='bindHideKeyboard' value="" name="mark"
  154. placeholder='选填备注信息' v-model="msgObj[item.mer_id]"></input>
  155. </view>
  156. <view class="total">
  157. 共{{item.order.total_num}}件 小计
  158. <view class="price" v-if="item.isTake == 0"><text>¥</text>{{ item.order.pay_price }}</view>
  159. <view class="price" v-if="item.isTake == 1"><text>¥</text>{{ item.order.org_price}}</view>
  160. </view>
  161. </view>
  162. </view>
  163. </view>
  164. <view class="settlementAgreement" v-if="showProtocol">
  165. <view class="setAgCount">
  166. <i class="icon iconfont icon-cha" @click="showProtocol = false"></i>
  167. <div class="title">预售协议</div>
  168. <view class="content">
  169. <jyf-parser :html="protocol" ref="article" :tag-style="tagStyle"></jyf-parser>
  170. <!-- <view v-html="protocol"></view> -->
  171. </view>
  172. </view>
  173. </view>
  174. <view class='wrapper'>
  175. <view class='item'>
  176. <view>支付方式</view>
  177. <view class='list'>
  178. <!-- #ifdef H5 -->
  179. <view class='payItem acea-row row-middle' :class='active==index ?"on":""' @tap='payItem(index)' v-for="(item,index) in cartArr"
  180. :key='index' v-if="item.payStatus==1">
  181. <view class='name acea-row row-center-wrapper'>
  182. <view class='iconfont animated' :class='(item.icon) + " " + (animated==true&&active==index ?"bounceIn":"")'></view>{{item.name}}
  183. </view>
  184. <view class='tip'>
  185. {{item.title}}
  186. <block v-if="item.value == 'balance'">
  187. {{userInfo.now_money}}
  188. </block>
  189. </view>
  190. </view>
  191. <!-- #endif -->
  192. <!-- #ifdef MP || APP-PLUS -->
  193. <view class='payItem acea-row row-middle' :class='active==index ?"on":""' @tap='payItem(index)' v-for="(item,index) in cartArr"
  194. :key='index' v-if="item.payStatus==1">
  195. <view class='name acea-row row-center-wrapper'>
  196. <view class='iconfont animated' :class='(item.icon) + " " + (animated==true&&active==index ?"bounceIn":"")'></view>{{item.name}}
  197. </view>
  198. <view class='tip'>
  199. {{item.title}}
  200. <block v-if="item.value == 'balance'">
  201. {{userInfo.now_money}}
  202. </block>
  203. </view>
  204. </view>
  205. <!-- #endif -->
  206. </view>
  207. </view>
  208. </view>
  209. <view class='moneyList'>
  210. <view class='item acea-row row-between-wrapper'>
  211. <view>商品总价:</view>
  212. <view class='money'>¥{{proPrice}}</view>
  213. </view>
  214. <view class='item acea-row row-between-wrapper' v-if="coupon_price > 0">
  215. <view>优惠券抵扣:</view>
  216. <view class='money'>-¥{{coupon_price}}</view>
  217. </view>
  218. <view class='item acea-row row-between-wrapper' v-if="integral_price > 0">
  219. <view>积分抵扣:</view>
  220. <view class='money'>-¥{{integral_price}}</view>
  221. </view>
  222. <view class='item acea-row row-between-wrapper' v-if="priceGroup.storePostage > 0">
  223. <view>运费:</view>
  224. <view class='money'>+¥{{priceGroup.storePostage}}</view>
  225. </view>
  226. </view>
  227. <view style='height:120rpx;'></view>
  228. <view class='footer acea-row row-between-wrapper'>
  229. <view>合计:
  230. <text class='font-color'>¥{{totalPrice || 0}}</text>
  231. </view>
  232. <view class='settlement' :class='addressInfo.real_name ? "" : "disabled"' style='z-index:100' @tap="SubOrder">{{addressInfo.real_name ? '立即结算':'选择地址'}}</view>
  233. </view>
  234. </view>
  235. <block v-if="coupon.status">
  236. <couponListWindow :coupon='coupon' @ChangCouponsClone="ChangCouponsClone" :openType='openType' :cartId='cartId'
  237. @ChangCoupons="ChangCoupons" :subCoupon='subCoupon'></couponListWindow>
  238. </block>
  239. <addressWindow ref="addressWindow" @changeTextareaStatus="changeTextareaStatus" :address='address' :pagesUrl="pagesUrl"
  240. @OnChangeAddress="OnChangeAddress" @changeClose="changeClose"></addressWindow>
  241. <addInvoicing ref="addInvoicing" @changeInvoiceClose="changeInvoiceClose" :invoice='invoice'></addInvoicing>
  242. <!-- #ifdef MP -->
  243. <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
  244. <!-- #endif -->
  245. <block v-if="isShowBox">
  246. <checkDelivery :isShowBox="isShowBox" :activeObj="activeObj" @close="boxClose" @confirmBtn="getData"></checkDelivery>
  247. </block>
  248. <web-view :src="ttUrl" v-if="ttUrl"></web-view>
  249. </view>
  250. </template>
  251. <script>
  252. let app = getApp();
  253. import {
  254. orderConfirm,
  255. getCouponsOrderPrice,
  256. orderCreate
  257. } from '@/api/order.js';
  258. import {
  259. getAddressDefault,
  260. getAddressDetail,
  261. getAddressList,
  262. getUserInfo
  263. } from '@/api/user.js';
  264. import {
  265. openPaySubscribe
  266. } from '@/utils/SubscribeMessage.js';
  267. import {
  268. presellAgreement
  269. } from '@/api/activity.js';
  270. import {
  271. storeListApi
  272. } from '@/api/store.js';
  273. import {
  274. CACHE_LONGITUDE,
  275. CACHE_LATITUDE
  276. } from '@/config/cache.js';
  277. import couponListWindow from '@/components/checkCoupon';
  278. import addressWindow from '@/components/addressWindow';
  279. import orderGoods from '@/components/orderGoods';
  280. import checkDelivery from '@/components/checkDelivery/index.vue'
  281. import addInvoicing from '@/components/addInvoicing';
  282. import parser from "@/components/jyf-parser/jyf-parser";
  283. import {
  284. toLogin
  285. } from '@/libs/login.js';
  286. import {
  287. mapGetters
  288. } from "vuex";
  289. // #ifdef MP
  290. import authorize from '@/components/Authorize';
  291. // #endif
  292. export default {
  293. components: {
  294. couponListWindow,
  295. addressWindow,
  296. orderGoods,
  297. checkDelivery,
  298. addInvoicing,
  299. "jyf-parser": parser,
  300. // #ifdef MP
  301. authorize
  302. // #endif
  303. },
  304. filters:{
  305. filterDay(val){
  306. if(val){
  307. var reg =/(\d{4})\-(\d{2})\-(\d{2})/;
  308. var date = val.replace(reg,"$2月$3日");
  309. return date
  310. }
  311. }
  312. },
  313. data() {
  314. return {
  315. // 备注
  316. msgObj: {
  317. },
  318. textareaStatus: true,
  319. //支付方式
  320. cartArr: [{
  321. "name": "微信支付",
  322. "icon": "icon-weixin2",
  323. value: 'weixin',
  324. title: '微信快捷支付',
  325. payStatus: 1,
  326. },
  327. {
  328. name: "支付宝支付",
  329. icon: "icon-zhifubao",
  330. // #ifdef H5
  331. value: 'alipay',
  332. // #endif
  333. // #ifdef MP
  334. value: 'alipayQr',
  335. // #endif
  336. title: '支付宝支付',
  337. payStatus: app.globalData.alipay_open
  338. },
  339. {
  340. "name": "余额支付",
  341. "icon": "icon-icon-test",
  342. value: 'balance',
  343. title: '可用余额:',
  344. payStatus: app.globalData.yue_pay_status,
  345. },
  346. {
  347. "name": "线下支付",
  348. "icon": "icon-yinhangqia",
  349. value: 'offline',
  350. title: '线下支付',
  351. payStatus: 2,
  352. },
  353. ],
  354. payType: 'weixin', //支付方式
  355. openType: 1, //优惠券打开方式 1=使用
  356. active: 0, //支付方式切换
  357. coupon: {
  358. status: false,
  359. list: [],
  360. statusTile: '立即使用'
  361. }, //优惠券组件
  362. address: {
  363. address: false
  364. }, //地址组件
  365. addressInfo: {}, //地址信息
  366. invoice: {
  367. invoice: false,
  368. mer_id: 0
  369. }, //发票组件
  370. invoiceData: {}, // 发票数据
  371. pinkId: 0, //拼团id
  372. addressId: 0, //地址id
  373. couponId: 0, //优惠券id
  374. cartId: '', //购物车id
  375. BargainId: 0,
  376. combinationId: 0,
  377. seckillId: 0,
  378. userInfo: {}, //用户信息
  379. mark: '', //备注信息
  380. couponTitle: '请选择', //优惠券
  381. coupon_price: 0, //优惠券抵扣金额
  382. useIntegral: false, //是否使用积分
  383. integral_price: 0, //积分抵扣金额
  384. integral: 0,
  385. ChangePrice: 0, //使用积分抵扣变动后的金额
  386. formIds: [], //收集formid
  387. status: 0,
  388. is_address: false,
  389. toPay: false, //修复进入支付时页面隐藏从新刷新页面
  390. shippingType: 0,
  391. system_store: {},
  392. storePostage: 0,
  393. contacts: '',
  394. contactsTel: '',
  395. mydata: {},
  396. storeList: [],
  397. store_self_mention: 0,
  398. cartInfo: [],
  399. priceGroup: {},
  400. animated: false,
  401. totalPrice: 0,
  402. integralRatio: "0",
  403. pagesUrl: "",
  404. orderKey: "",
  405. // usableCoupon: {},
  406. offlinePostage: "",
  407. isAuto: false, //没有授权的不会自动授权
  408. isShowAuth: false, //是否隐藏授权
  409. from: '',
  410. orderStatus: '', //是否有地址
  411. couponIndex: 0, //选择商铺优惠券索引
  412. subCoupon: {}, //提交订单使用的优惠券
  413. proPrice: 0, //商品总价
  414. isShowBox: false,
  415. activeObj: {}, //选中店铺信息
  416. activeIndex: '', // 选中店铺索引
  417. invoiceName: '不开发票',
  418. invoice_func: false,
  419. special_invoice: false,
  420. // order_type: 1, // 是否为预售
  421. isAgree: false,
  422. showProtocol: false,
  423. protocol: '',
  424. order_type: 0,
  425. hide_mer_status: 1,
  426. addInvoice: {},
  427. go_map: false,
  428. orderPay: false,
  429. ttUrl: ''
  430. };
  431. },
  432. computed: mapGetters(['isLogin']),
  433. onReady() {
  434. uni.$on('update',(data)=>{
  435. this.cartArr[1]['payStatus'] = data.alipay_open
  436. this.cartArr[2]['payStatus'] = data.alipay_open
  437. this.hide_mer_status = data.hide_mer_status
  438. })
  439. },
  440. mounted: function() {
  441. this.$nextTick(() => {
  442. const app = getApp();
  443. this.cartArr[1]['payStatus'] = app.globalData.alipay_open
  444. this.cartArr[2]['payStatus'] = app.globalData.yue_pay_status
  445. this.hide_mer_status = app.globalData.hide_mer_status
  446. });
  447. },
  448. onLoad: function(options) {
  449. this.seckillId = options.seckillId
  450. // #ifdef H5
  451. this.from = this.$wechat.isWeixin() ? 'weixin' : 'h5'
  452. // #endif
  453. // #ifdef MP
  454. this.from = 'routine'
  455. // #endif
  456. if (!options.cartId) return this.$util.Tips({
  457. title: '请选择要购买的商品'
  458. }, {
  459. tab: 3,
  460. url: 1
  461. });
  462. this.couponId = options.couponId || 0;
  463. this.pinkId = options.pinkid ? parseInt(options.pinkid) : 0;
  464. this.addressId = options.addressId || 0;
  465. this.cartId = options.cartId;
  466. this.is_address = options.is_address ? true : false;
  467. this.news = options.new ? 1 : 0;
  468. this.invoice_id = options.invoice_id || '';
  469. if (options.invoice_type == 1) {
  470. this.invoiceName = '增值税电子普通发票';
  471. } else if (options.invoice_type == 2) {
  472. this.invoiceName = '增值税专用发票';
  473. }
  474. if (this.isLogin) {
  475. // this.getaddressInfo();
  476. // //调用子页面方法授权后执行获取地址列表
  477. // this.$nextTick(function() {
  478. // this.$refs.addressWindow.getAddressList();
  479. // })
  480. } else {
  481. // #ifdef H5 || APP-PLUS
  482. toLogin();
  483. // #endif
  484. // #ifdef MP
  485. this.isAuto = true;
  486. this.$set(this, 'isShowAuth', true);
  487. // #endif
  488. }
  489. if (this.payType == 'weixin') {
  490. this.payType = this.from
  491. }
  492. let _this = this
  493. this.textareaStatus = true;
  494. if (this.isLogin && this.toPay == false && !this.orderPay) {
  495. this.getaddressInfo();
  496. this.$nextTick(function() {
  497. console.log('1')
  498. // this.$refs.addressWindow.getAddressList();
  499. console.log('2')
  500. this.getUserInfo()
  501. })
  502. }
  503. },
  504. /**
  505. * 生命周期函数--监听页面显示
  506. */
  507. onShow: function() {
  508. let that = this;
  509. uni.$on("handClick", res => {
  510. if (res) {
  511. _this.system_store = res.address
  512. }
  513. // 清除监听
  514. uni.$off('handClick');
  515. })
  516. uni.$on("updataAddress", () => {
  517. if(!that.go_map && !that.orderPay){
  518. that.getaddressInfo();
  519. }
  520. that.$nextTick(function() {
  521. // that.$refs.addressWindow.getAddressList();
  522. that.getUserInfo()
  523. })
  524. })
  525. that.invoice.invoice = false
  526. if(!that.go_map && !that.orderPay){
  527. that.getaddressInfo();
  528. }
  529. // this.getaddressInfo();
  530. // let pages = getCurrentPages();
  531. // let currPage = pages[pages.length - 1]; //当前页面
  532. // if (currPage.data.storeItem) {
  533. // let json = currPage.data.storeItem;
  534. // this.$set(this, 'system_store', json);
  535. // }
  536. },
  537. /**
  538. * 生命周期函数--监听页面隐藏
  539. */
  540. // onHide: function() {
  541. // console.log(999);
  542. // this.isClose = true
  543. // },
  544. methods: {
  545. /*预售协议*/
  546. getPresellAgree: function() {
  547. presellAgreement().then(res => {
  548. this.protocol = res.data.sys_product_presell_agree;
  549. })
  550. },
  551. changeIsAgree: function(e) {
  552. this.isAgree = !this.isAgree;
  553. },
  554. // 获取个人信息
  555. getUserInfo() {
  556. getUserInfo().then(res => {
  557. console.log(res,"+++++++++++++++userInfo")
  558. this.userInfo = res.data
  559. })
  560. },
  561. /**
  562. * 授权回调事件
  563. *
  564. */
  565. onLoadFun: function() {
  566. this.isShowAuth = false;
  567. this.getaddressInfo();
  568. this.getUserInfo();
  569. //调用子页面方法授权后执行获取地址列表
  570. // this.$scope.selectComponent('#address-window').getAddressList();
  571. },
  572. /**
  573. * 获取门店列表数据
  574. */
  575. getList: function() {
  576. let longitude = uni.getStorageSync("CACHE_LONGITUDE"); //经度
  577. let latitude = uni.getStorageSync("CACHE_LATITUDE"); //纬度
  578. let data = {
  579. latitude: latitude, //纬度
  580. longitude: longitude, //经度
  581. page: 1,
  582. limit: 10
  583. }
  584. storeListApi(data).then(res => {
  585. console.log(res)
  586. let list = res.data.list.list || [];
  587. this.$set(this, 'storeList', list);
  588. this.$set(this, 'system_store', list[0]);
  589. }).catch(err => {})
  590. },
  591. // 关闭地址弹窗;
  592. changeClose: function() {
  593. this.$set(this.address, 'address', false);
  594. },
  595. // 关闭发票弹窗
  596. changeInvoiceClose: function(data) {
  597. this.getInvoiceData(data);
  598. this.$set(this.invoice, 'invoice', false);
  599. },
  600. getInvoiceData(selectedData) {
  601. this.invoiceData = {}
  602. if (selectedData) {
  603. this.cartInfo.forEach((item, i) => {
  604. if (item.mer_id == selectedData.mer_id) {
  605. if (this.cartInfo[i]['invoiceData']) {
  606. this.cartInfo[i]['invoiceData'] = selectedData
  607. } else {
  608. this.$set(this.cartInfo[i], 'invoiceData', selectedData)
  609. }
  610. }
  611. let mer_id = selectedData.mer_id
  612. this.invoiceData[mer_id] = selectedData;
  613. });
  614. } else {
  615. this.cartInfo.forEach((item, i) => {
  616. this.$set(this.cartInfo[i], 'invoiceData', {})
  617. });
  618. }
  619. console.log(this.invoiceData)
  620. },
  621. getInvoiceDatas(selectedData) {
  622. this.invoiceData = {}
  623. if (selectedData.length) {
  624. this.cartInfo.forEach((item, i) => {
  625. selectedData.forEach((val, j) => {
  626. if (item.mer_id == val.mer_id) {
  627. if (this.cartInfo[i]['invoiceData']) {
  628. this.cartInfo[i]['invoiceData'] = val
  629. } else {
  630. this.$set(this.cartInfo[i], 'invoiceData', val)
  631. }
  632. }
  633. let mer_id = val.mer_id
  634. this.invoiceData[mer_id] = val;
  635. })
  636. });
  637. } else {
  638. this.cartInfo.forEach((item, i) => {
  639. this.$set(this.cartInfo[i], 'invoiceData', {})
  640. });
  641. }
  642. console.log(this.invoiceData)
  643. },
  644. /*
  645. * 跳转门店列表
  646. */
  647. showStoreList: function() {
  648. let _this = this
  649. if (this.storeList.length > 0) {
  650. uni.navigateTo({
  651. url: '/pages/users/goods_details_store/index'
  652. })
  653. }
  654. },
  655. // 进店
  656. goStore: function(id) {
  657. if (this.hide_mer_status != 1) {
  658. uni.navigateTo({
  659. url: `/pages/store/home/index?id=${id}`
  660. })
  661. }
  662. },
  663. computedPrice: function() {
  664. let shippingType = this.shippingType;
  665. /*postOrderComputed(this.orderKey, {
  666. addressId: this.addressId,
  667. useIntegral: this.useIntegral ? 1 : 0,
  668. couponId: this.couponId,
  669. shipping_type: parseInt(shippingType) + 1,
  670. payType: this.payType
  671. }).then(res => {
  672. let result = res.data.result;
  673. if (result) {
  674. this.totalPrice = result.pay_price;
  675. this.integral_price = result.deduction_price;
  676. this.coupon_price = result.coupon_price;
  677. this.integral = this.useIntegral ? result.SurplusIntegral : this.userInfo.integral;
  678. this.$set(this.priceGroup, 'storePostage', shippingType == 1 ? 0 : result.pay_postage);
  679. }
  680. })*/
  681. },
  682. addressType: function(e) {
  683. let index = e;
  684. this.shippingType = parseInt(index);
  685. this.computedPrice();
  686. if (index == 1) this.getList();
  687. },
  688. bindPickerChange: function(e) {
  689. let value = e.detail.value;
  690. this.shippingType = value;
  691. this.computedPrice();
  692. },
  693. ChangCouponsClone: function() {
  694. this.$set(this.coupon, 'status', false);
  695. },
  696. changeTextareaStatus: function() {
  697. for (let i = 0, len = this.coupon.list.length; i < len; i++) {
  698. this.coupon.list[i].use_title = '';
  699. this.coupon.list[i].is_use = 0;
  700. }
  701. this.textareaStatus = true;
  702. this.status = 0;
  703. this.$set(this.coupon, 'list', this.coupon.list);
  704. },
  705. /**
  706. * 处理点击优惠券后的事件
  707. *
  708. */
  709. ChangCoupons: function(data) {
  710. // this.coupon_price = data.order.coupon_price;
  711. // this.$set(this,'coupon_price',data.order.coupon_price);
  712. // let tempTotal = 0
  713. this.cartInfo.forEach((item, index) => {
  714. if (item.mer_id == data.mer_id) {
  715. this.$set(this.cartInfo, index, data)
  716. }
  717. console.log(item.order.pay_price, 'item.order.pay_price')
  718. })
  719. // this.subCoupon = data
  720. this.$set(this.coupon, 'status', false);
  721. this.couponNum()
  722. },
  723. // 计算优惠券抵扣
  724. couponNum() {
  725. let tempTotal = 0,
  726. tempCouponNum = 0
  727. this.cartInfo.forEach((item, index) => {
  728. tempCouponNum = this.$util.$h.Add(tempCouponNum, item.order.coupon_price)
  729. tempTotal = this.$util.$h.Add(tempTotal, item.order.pay_price)
  730. })
  731. this.coupon_price = tempCouponNum
  732. if (this.order_type == 2 && this.coupon.list[0].productPresell.presell_type == 2) {
  733. return
  734. }
  735. this.totalPrice = tempTotal
  736. },
  737. /**
  738. * 使用积分抵扣
  739. */
  740. ChangeIntegral: function() {
  741. this.useIntegral = !this.useIntegral;
  742. this.computedPrice();
  743. },
  744. /**
  745. * 选择地址后改变事件
  746. * @param object e
  747. */
  748. OnChangeAddress: function(e) {
  749. console.log(e, 'zouni')
  750. this.textareaStatus = true;
  751. this.addressId = e;
  752. this.address.address = false;
  753. this.getaddressInfo();
  754. this.computedPrice();
  755. },
  756. bindHideKeyboard: function(e) {
  757. this.mark = e.detail.value;
  758. },
  759. /**
  760. * 获取当前订单详细信息
  761. *
  762. */
  763. getConfirm: function(address_id) {
  764. console.log(address_id, 'address_id')
  765. let that = this;
  766. let tempObj = {}
  767. orderConfirm({
  768. cart_id: that.cartId.split(","),
  769. address_id: address_id
  770. }).then(res => {
  771. let conponNum = 0
  772. // 默认选中
  773. res.data.order.forEach(el => {
  774. el.isTake = 0
  775. tempObj = that.subCoupon[el.mer_id] = {}
  776. tempObj.product = []
  777. tempObj.store = ''
  778. tempObj.product = el.order.use_coupon_product
  779. conponNum = that.$util.$h.Add(conponNum, el.order.coupon_price);
  780. el.coupon.forEach(coupon => {
  781. if (coupon.coupon.type == 0 && coupon.checked) {
  782. tempObj.store = coupon.coupon_user_id
  783. }
  784. })
  785. })
  786. that.$set(that, 'cartInfo', res.data.order);
  787. that.$set(that, 'order_type', res.data.order_type);
  788. that.totalPrice = res.data.order_price
  789. that.orderStatus = res.data.status
  790. that.proPrice = res.data.total_price
  791. that.coupon_price = conponNum
  792. if (res.data.order_type === 2) {
  793. this.getPresellAgree()
  794. }
  795. that.coupon_price = conponNum
  796. that.order_type = res.data.order_type
  797. uni.getStorage({
  798. key:"invoice_Data",
  799. success: function (res) {
  800. that.addInvoice = res.data;
  801. if(res.data){
  802. that.getInvoiceDatas(res.data)
  803. }
  804. }
  805. })
  806. }).catch(err => {
  807. return this.$util.Tips({
  808. title: err
  809. }, {
  810. tab: 3,
  811. url: 1
  812. });
  813. });
  814. },
  815. /*
  816. * 提取砍价和拼团id
  817. */
  818. getBargainId: function() {
  819. let that = this;
  820. let cartINfo = that.cartInfo;
  821. let BargainId = 0;
  822. let combinationId = 0;
  823. cartINfo.forEach(function(value, index, cartINfo) {
  824. BargainId = cartINfo[index].bargain_id,
  825. combinationId = cartINfo[index].combination_id
  826. })
  827. that.$set(that, 'BargainId', parseInt(BargainId));
  828. that.$set(that, 'combinationId', parseInt(combinationId));
  829. if (that.cartArr.length == 3 && (BargainId || combinationId || that.seckillId)) {
  830. that.cartArr[2].payStatus = 0;
  831. that.$set(that, 'cartArr', that.cartArr);
  832. }
  833. },
  834. /**
  835. * 获取当前金额可用优惠券
  836. *
  837. */
  838. getCouponList: function() {
  839. let that = this;
  840. let data = {
  841. cartId: this.cartId
  842. }
  843. getCouponsOrderPrice(this.totalPrice, data).then(res => {
  844. that.$set(that.coupon, 'list', res.data);
  845. that.openType = 1;
  846. });
  847. },
  848. /*
  849. * 获取默认收货地址或者获取某条地址信息
  850. */
  851. getaddressInfo: function() {
  852. let that = this;
  853. if (that.addressId) {
  854. getAddressDetail(that.addressId).then(res => {
  855. res.data.is_default = parseInt(res.data.is_default);
  856. that.addressInfo = res.data || {};
  857. that.addressId = res.data.address_id || 0;
  858. that.address.addressId = res.data.address_id || 0;
  859. this.getConfirm(that.addressId);
  860. })
  861. } else {
  862. getAddressList().then(res => {
  863. that.addressInfo = res.data.list.length > 0 ? res.data.list[0] : {};
  864. that.addressId = res.data.list.length > 0 ? res.data.list[0].address_id : 0;
  865. that.address.addressId = res.data.list.length > 0 ? res.data.list[0].address_id : 0;
  866. this.getConfirm(that.addressId);
  867. })
  868. }
  869. },
  870. payItem: function(e) {
  871. let that = this;
  872. let active = e;
  873. that.active = active;
  874. that.animated = true;
  875. that.payType = that.cartArr[active].value;
  876. if (that.payType == 'weixin') {
  877. that.payType = that.from
  878. }
  879. // that.computedPrice();
  880. // setTimeout(function() {
  881. // that.car();
  882. // }, 500);
  883. },
  884. couponTap: function(item, index) {
  885. this.coupon = item
  886. this.$set(this.coupon, 'status', true)
  887. this.couponIndex = index
  888. // this.coupon.status = true;
  889. },
  890. car: function() {
  891. let that = this;
  892. that.animated = false;
  893. },
  894. onAddress: function() {
  895. console.log("555555555555")
  896. let that = this;
  897. that.textareaStatus = false;
  898. that.address.address = true;
  899. that.pagesUrl = '/pages/users/user_address_list/index?cartId=' + this.cartId + '&pinkId=' + this.pinkId +
  900. '&couponId=' + this.couponId;
  901. },
  902. /**
  903. * 开发票
  904. */
  905. goInvoice: function(id) {
  906. let that = this;
  907. that.invoice.invoice = true;
  908. that.invoice.mer_id = id;
  909. this.$refs.addInvoicing.getInvoiceDefault();
  910. this.$refs.addInvoicing.getInvoiceList();
  911. },
  912. realName: function(e) {
  913. this.contacts = e.detail.value;
  914. },
  915. phone: function(e) {
  916. this.contactsTel = e.detail.value;
  917. },
  918. payment: function(data) {
  919. console.log('到达+++++++++++payment++++++++++++++')
  920. console.log(data, 'data')
  921. let that = this;
  922. orderCreate(data).then(res => {
  923. console.log(res,'++++++++++++++++++++++')
  924. let status = res.data.status,
  925. orderId = res.data.result.order_id,
  926. callback_key = res.data.result.pay_key,
  927. jsConfig = res.data.result.config,
  928. goPages = '/pages/order_pay_status/index?order_id=' + orderId + '&msg=' + res.message;
  929. console.log(jsConfig,'jsConfig+++++++++')
  930. that.orderPay = true;
  931. console.log(status,'status++++++++++++++++')
  932. switch (status) {
  933. case 'ORDER_EXIST':
  934. case 'EXTEND_ORDER':
  935. case 'PAY_ERROR':
  936. case 'error':
  937. uni.hideLoading();
  938. return that.$util.Tips({
  939. title: res.msg
  940. }, {
  941. tab: 5,
  942. url: goPages
  943. });
  944. break;
  945. case 'success':
  946. uni.hideLoading();
  947. if (that.BargainId || that.combinationId || that.pinkId || that.seckillId)
  948. return that.$util.Tips({
  949. title: res.msg,
  950. icon: 'success'
  951. }, {
  952. tab: 4,
  953. url: goPages
  954. });
  955. return that.$util.Tips({
  956. title: res.msg,
  957. icon: 'success'
  958. }, {
  959. tab: 5,
  960. url: goPages
  961. });
  962. break;
  963. case 'alipay':
  964. case "alipayQr":
  965. uni.hideLoading();
  966. this.$emit('onChangeFun', {
  967. action: 'payClose'
  968. });
  969. uni.navigateTo({
  970. url: '/pages/order_pay_back/index?keyCode='+callback_key+'&url='+jsConfig
  971. })
  972. return;
  973. break;
  974. // #ifndef MP
  975. case "wechat":
  976. case "weixin":
  977. jsConfig.timeStamp = jsConfig.timestamp;
  978. this.$wechat.pay(jsConfig).then(res => {
  979. console.log('测试支付数据无效的success:' + res.data)
  980. return that.$util.Tips({
  981. title: res.message,
  982. icon: 'success'
  983. }, {
  984. tab: 4,
  985. url: goPages
  986. });
  987. }).catch(res => {
  988. console.log('测试支付数据无效的catch:' + res.data)
  989. if (res.errMsg == 'chooseWXPay:cancel') return that.$util.Tips({
  990. title: '取消支付'
  991. }, {
  992. tab: 5,
  993. url: goPages + '&status=0'
  994. });
  995. })
  996. break;
  997. // #endif
  998. // #ifdef MP
  999. case "routine":
  1000. console.log(jsConfig)
  1001. jsConfig.timeStamp = jsConfig.timestamp;
  1002. that.toPay = true;
  1003. uni.requestPayment({
  1004. ...jsConfig,
  1005. success: function(res) {
  1006. uni.hideLoading();
  1007. if (that.BargainId || that.combinationId || that.pinkId || that.seckillId)
  1008. return that.$util.Tips({
  1009. title: '支付成功',
  1010. icon: 'success'
  1011. }, {
  1012. tab: 4,
  1013. url: goPages
  1014. });
  1015. return that.$util.Tips({
  1016. title: '支付成功',
  1017. icon: 'success'
  1018. }, {
  1019. tab: 5,
  1020. url: goPages
  1021. });
  1022. },
  1023. fail: function(e) {
  1024. uni.hideLoading();
  1025. let pages = '/pages/order_pay_status/index?order_id=' + orderId+'&msg=取消支付'
  1026. return that.$util.Tips({
  1027. title: '取消支付'
  1028. }, {
  1029. tab: 5,
  1030. url: pages + '&status=0'
  1031. });
  1032. },
  1033. })
  1034. break;
  1035. // #endif
  1036. case "balance":
  1037. uni.hideLoading();
  1038. //余额不足
  1039. return that.$util.Tips({
  1040. title: res.msg
  1041. }, {
  1042. tab: 5,
  1043. url: goPages + '&status=1'
  1044. });
  1045. break;
  1046. // #ifdef H5
  1047. case 'h5':
  1048. console.log('come H5+++++++')
  1049. let host = window.location.protocol + "//" + window.location.host;
  1050. let url = `${host}/pages/order_pay_status/index?order_id=${orderId}`
  1051. console.log(url,'url++++++++++')
  1052. let eUrl = encodeURIComponent(url)
  1053. console.log(eUrl,'eUrl++++++++++')
  1054. let locations = `${jsConfig.mweb_url}&redirect_url=${eUrl}`
  1055. console.log(locations,'locations++++++++++++++++++')
  1056. setTimeout(() => {
  1057. location.href = locations;
  1058. }, 100);
  1059. break;
  1060. // #endif
  1061. // #ifdef MP-TOUTIAO
  1062. case 'toutiao':
  1063. console.log('头条支付')
  1064. // that.toPay = true;
  1065. console.log(jsConfig.data.order_id)
  1066. console.log()
  1067. tt.pay({
  1068. orderInfo: {
  1069. order_id: jsConfig.data.order_id,
  1070. order_token:jsConfig.data.order_token,
  1071. },
  1072. service: 5,
  1073. success(res) {
  1074. console.log(res,'支付回调')
  1075. if (res.code == 0) {
  1076. // 支付成功处理逻辑,只有res.code=0时,才表示支付成功
  1077. // 但是最终状态要以商户后端结果为准
  1078. // uni.hideLoading();
  1079. if (that.BargainId || that.combinationId || that.pinkId || that.seckillId)
  1080. return that.$util.Tips({
  1081. title: '支付成功',
  1082. icon: 'success'
  1083. }, {
  1084. tab: 4,
  1085. url: goPages
  1086. });
  1087. return that.$util.Tips({
  1088. title: '支付成功',
  1089. icon: 'success'
  1090. }, {
  1091. tab: 5,
  1092. url: goPages
  1093. });
  1094. }
  1095. },
  1096. fail(res) {
  1097. console.log(res,'支付失败');
  1098. // 调起收银台失败处理逻辑
  1099. uni.hideLoading();
  1100. let pages = '/pages/order_pay_status/index?order_id=' + orderId+'&msg=取消支付'
  1101. return that.$util.Tips({
  1102. title: '取消支付'
  1103. }, {
  1104. tab: 5,
  1105. url: pages + '&status=0'
  1106. });
  1107. },
  1108. });
  1109. break;
  1110. // #endif
  1111. }
  1112. }).catch(err => {
  1113. uni.hideLoading();
  1114. return that.$util.Tips({
  1115. title: err
  1116. });
  1117. });
  1118. },
  1119. isEmojiCharacter: function(substring) {
  1120. if (substring) {
  1121. // var reg = new RegExp("[~#^$@%&!?%*]", 'g');
  1122. // if (substring.match(reg)) {
  1123. // return true;
  1124. // }
  1125. for (var i = 0; i < substring.length; i++) {
  1126. var hs = substring.charCodeAt(i);
  1127. if (0xd800 <= hs && hs <= 0xdbff) {
  1128. if (substring.length > 1) {
  1129. var ls = substring.charCodeAt(i + 1);
  1130. var uc = ((hs - 0xd800) * 0x400) + (ls - 0xdc00) + 0x10000;
  1131. if (0x1d000 <= uc && uc <= 0x1f77f) {
  1132. return true;
  1133. }
  1134. }
  1135. } else if (substring.length > 1) {
  1136. var ls = substring.charCodeAt(i + 1);
  1137. if (ls == 0x20e3) {
  1138. return true;
  1139. }
  1140. } else {
  1141. if (0x2100 <= hs && hs <= 0x27ff) {
  1142. return true;
  1143. } else if (0x2B05 <= hs && hs <= 0x2b07) {
  1144. return true;
  1145. } else if (0x2934 <= hs && hs <= 0x2935) {
  1146. return true;
  1147. } else if (0x3297 <= hs && hs <= 0x3299) {
  1148. return true;
  1149. } else if (hs == 0xa9 || hs == 0xae || hs == 0x303d || hs == 0x3030 ||
  1150. hs == 0x2b55 || hs == 0x2b1c || hs == 0x2b1b ||
  1151. hs == 0x2b50) {
  1152. return true;
  1153. }
  1154. }
  1155. }
  1156. }
  1157. },
  1158. SubOrder: function(e) {
  1159. let that = this,
  1160. data = {};
  1161. if (!that.payType) return that.$util.Tips({
  1162. title: '请选择支付方式'
  1163. });
  1164. // #ifdef MP-TOUTIAO
  1165. if(this.payType !== 'balance'){
  1166. this.payType="toutiao"
  1167. }
  1168. // #endif
  1169. if (!that.addressId && !that.shippingType) return that.$util.Tips({
  1170. title: '请选择收货地址'
  1171. });
  1172. if (that.orderStatus != 'finish') {
  1173. return that.$util.Tips({
  1174. title: '收货地址不在配送区域'
  1175. });
  1176. }
  1177. if (that.orderStatus == 'noDeliver') {
  1178. return that.$util.Tips({
  1179. title: '暂不发货'
  1180. });
  1181. }
  1182. if (that.order_type == 2 && !that.isAgree && that.cartInfo[0].list[0].productPresell.presell_type == 2) {
  1183. return that.$util.Tips({
  1184. title: '请阅读并勾选协议,否则无法进行操作'
  1185. });
  1186. }
  1187. let tempObj = {}
  1188. let conponNum = 0
  1189. // 默认选中
  1190. that.cartInfo.forEach(el => {
  1191. // el.isTake = 0
  1192. tempObj = that.subCoupon[el.mer_id] = {}
  1193. tempObj.product = []
  1194. tempObj.store = ''
  1195. tempObj.product = el.order.use_coupon_product
  1196. conponNum = that.$util.$h.Add(conponNum, el.order.coupon_price);
  1197. el.coupon.forEach(coupon => {
  1198. if (coupon.coupon.type == 0 && coupon.checked) {
  1199. tempObj.store = coupon.coupon_user_id
  1200. }
  1201. })
  1202. })
  1203. data = {
  1204. cart_id: this.cartId.split(","),
  1205. address_id: this.addressId,
  1206. coupon: this.subCoupon,
  1207. pay_type: this.payType,
  1208. mark: this.msgObj,
  1209. order_type: this.order_type,
  1210. take: [],
  1211. receipt_data: this.invoiceData,
  1212. // #ifdef H5
  1213. return_url: 'http://' + window.location.host + '/pages/users/order_list/index',
  1214. // #endif
  1215. };
  1216. if (data.mark && this.isEmojiCharacter(data.mark[Object.keys(data.mark)[0]])) {
  1217. that.$util.Tips({
  1218. title: '备注不允许输入表情!'
  1219. });
  1220. return;
  1221. }
  1222. this.cartInfo.map(el => {
  1223. if (el.isTake == 1) {
  1224. data.take.push(el.mer_id)
  1225. }
  1226. })
  1227. console.log(data, 'data')
  1228. if (data.payType == 'balance' && parseFloat(that.userInfo.now_money) < parseFloat(that.totalPrice)) return that.$util
  1229. .Tips({
  1230. title: '余额不足!'
  1231. });
  1232. // #ifndef MP-TOUTIAO
  1233. uni.showLoading({
  1234. title: '订单支付中',
  1235. mask: true
  1236. });
  1237. // #endif
  1238. // // #ifdef MP
  1239. // openPaySubscribe().then(() => {
  1240. // console.log('去支付+++++++++++++++++++')
  1241. // that.payment(data);
  1242. // });
  1243. // // #endif
  1244. // #ifdef MP-WEIXIN
  1245. openPaySubscribe().then(() => {
  1246. console.log('去支付+++++++++++++++++++')
  1247. that.payment(data);
  1248. });
  1249. // #endif
  1250. // #ifdef MP-TOUTIAO
  1251. that.payment(data);
  1252. // #endif
  1253. // #ifndef MP
  1254. that.payment(data);
  1255. // #endif
  1256. },
  1257. // 打开配送方式弹窗
  1258. openShowBox(item, index) {
  1259. this.activeObj = item
  1260. this.activeIndex = index
  1261. this.isShowBox = true
  1262. },
  1263. boxClose() {
  1264. this.isShowBox = false
  1265. },
  1266. getData(data) {
  1267. let self = this
  1268. let freePostage = 0 //没有邮费总价
  1269. let Postage = 0 //有邮费总价
  1270. this.cartInfo[this.activeIndex] = data
  1271. this.cartInfo.map(el => {
  1272. if (el.isTake == 1) {
  1273. freePostage = self.$util.$h.Add(freePostage, el.order.org_price)
  1274. } else {
  1275. Postage = self.$util.$h.Add(Postage, el.order.pay_price)
  1276. }
  1277. })
  1278. this.totalPrice = self.$util.$h.Add(freePostage, Postage)
  1279. this.isShowBox = false
  1280. },
  1281. //查看内置地图
  1282. goMap(item) {
  1283. let that = this;
  1284. uni.openLocation({
  1285. latitude: Number(item.take.mer_take_location[0]),
  1286. longitude: Number(item.take.mer_take_location[1]),
  1287. success: function() {
  1288. that.go_map = true
  1289. }
  1290. });
  1291. }
  1292. }
  1293. }
  1294. </script>
  1295. <style lang="scss" scoped>
  1296. .order-submission .line {
  1297. position: absolute;
  1298. left: 0;
  1299. top: 0;
  1300. width: 100%;
  1301. height: 3rpx;
  1302. }
  1303. .order-submission .line image {
  1304. width: 100%;
  1305. height: 100%;
  1306. display: block;
  1307. }
  1308. .order-submission .address {
  1309. padding: 28rpx 30rpx;
  1310. background-color: #fff;
  1311. box-sizing: border-box;
  1312. }
  1313. .order-submission .address .addressCon {
  1314. width: 610rpx;
  1315. font-size: 26rpx;
  1316. color: #666;
  1317. }
  1318. .order-submission .address .addressCon .name {
  1319. font-size: 30rpx;
  1320. color: #282828;
  1321. font-weight: bold;
  1322. margin-bottom: 10rpx;
  1323. }
  1324. .order-submission .address .addressCon .name .phone {
  1325. margin-left: 50rpx;
  1326. }
  1327. .order-submission .address .addressCon .default {
  1328. margin-right: 12rpx;
  1329. }
  1330. .order-submission .address .addressCon .setaddress {
  1331. color: #333;
  1332. font-size: 28rpx;
  1333. }
  1334. .order-submission .address .iconfont {
  1335. font-size: 35rpx;
  1336. color: #707070;
  1337. }
  1338. .order-submission .allAddress {
  1339. width: 100%;
  1340. }
  1341. .order-submission .allAddress .nav {
  1342. width: 710rpx;
  1343. margin: 0 auto;
  1344. }
  1345. .order-submission .allAddress .nav .item {
  1346. width: 355rpx;
  1347. }
  1348. .order-submission .allAddress .nav .item.on {
  1349. position: relative;
  1350. width: 250rpx;
  1351. }
  1352. .order-submission .allAddress .nav .item.on::before {
  1353. position: absolute;
  1354. bottom: 0;
  1355. content: "快递配送";
  1356. font-size: 28rpx;
  1357. display: block;
  1358. height: 0;
  1359. width: 336rpx;
  1360. border-width: 0 20rpx 80rpx 0;
  1361. border-style: none solid solid;
  1362. border-color: transparent transparent #fff;
  1363. z-index: 2;
  1364. border-radius: 7rpx 30rpx 0 0;
  1365. text-align: center;
  1366. line-height: 80rpx;
  1367. }
  1368. .order-submission .allAddress .nav .item:nth-of-type(2).on::before {
  1369. content: "到店自提";
  1370. border-width: 0 0 80rpx 20rpx;
  1371. border-radius: 30rpx 7rpx 0 0;
  1372. }
  1373. .order-submission .allAddress .nav .item.on2 {
  1374. position: relative;
  1375. }
  1376. .order-submission .allAddress .nav .item.on2::before {
  1377. position: absolute;
  1378. bottom: 0;
  1379. content: "到店自提";
  1380. font-size: 28rpx;
  1381. display: block;
  1382. height: 0;
  1383. width: 400rpx;
  1384. border-width: 0 0 60rpx 60rpx;
  1385. border-style: none solid solid;
  1386. border-color: transparent transparent #f7c1bd;
  1387. border-radius: 40rpx 6rpx 0 0;
  1388. text-align: center;
  1389. line-height: 60rpx;
  1390. }
  1391. .order-submission .allAddress .nav .item:nth-of-type(1).on2::before {
  1392. content: "快递配送";
  1393. border-width: 0 60rpx 60rpx 0;
  1394. border-radius: 6rpx 40rpx 0 0;
  1395. }
  1396. .order-submission .allAddress .address {
  1397. height: 150rpx;
  1398. margin: 0 auto;
  1399. }
  1400. .order-submission .allAddress .line {
  1401. margin: 0 auto;
  1402. }
  1403. .order-submission .wrapper .item .discount .placeholder {
  1404. color: #ccc;
  1405. }
  1406. .order-submission .wrapper {
  1407. margin-bottom: 12rpx;
  1408. background-color: #fff;
  1409. }
  1410. .order-submission .wrapper .item {
  1411. padding: 27rpx 30rpx;
  1412. font-size: 30rpx;
  1413. color: #282828;
  1414. }
  1415. .order-submission .wrapper .item .discount {
  1416. font-size: 30rpx;
  1417. color: #999;
  1418. &.discount_voice {
  1419. overflow: hidden;
  1420. text-overflow: ellipsis;
  1421. white-space: nowrap;
  1422. width: 500rpx;
  1423. text-align: right;
  1424. }
  1425. }
  1426. .order-submission .wrapper .item .discount .iconfont {
  1427. color: #515151;
  1428. font-size: 30rpx;
  1429. margin-left: 15rpx;
  1430. }
  1431. .order-submission .wrapper .item .discount .num {
  1432. font-size: 32rpx;
  1433. margin-right: 20rpx;
  1434. }
  1435. .order-submission .wrapper .item .shipping {
  1436. font-size: 30rpx;
  1437. color: #999;
  1438. position: relative;
  1439. padding-right: 58rpx;
  1440. }
  1441. .order-submission .wrapper .item .shipping .iconfont {
  1442. font-size: 35rpx;
  1443. color: #707070;
  1444. position: absolute;
  1445. right: 0;
  1446. top: 50%;
  1447. transform: translateY(-50%);
  1448. margin-left: 30rpx;
  1449. }
  1450. .order-submission .wrapper .item input {
  1451. display: flex;
  1452. flex: 1;
  1453. height: 100%;
  1454. margin-left: 20rpx;
  1455. }
  1456. .order-submission .wrapper .item .placeholder {
  1457. color: #ccc;
  1458. }
  1459. .order-submission .wrapper .item .list {
  1460. margin-top: 35rpx;
  1461. }
  1462. .order-submission .wrapper .item .list .payItem {
  1463. border: 1px solid #eee;
  1464. border-radius: 6rpx;
  1465. height: 86rpx;
  1466. width: 100%;
  1467. box-sizing: border-box;
  1468. margin-top: 20rpx;
  1469. font-size: 28rpx;
  1470. color: #282828;
  1471. }
  1472. .order-submission .wrapper .item .list .payItem.on {
  1473. border-color: #fc5445;
  1474. color: #e93323;
  1475. }
  1476. .order-submission .wrapper .item .list .payItem .name {
  1477. width: 50%;
  1478. text-align: center;
  1479. border-right: 1px solid #eee;
  1480. justify-content: left;
  1481. padding-left: 80rpx;
  1482. }
  1483. .order-submission .wrapper .item .list .payItem .name .iconfont {
  1484. width: 44rpx;
  1485. height: 44rpx;
  1486. border-radius: 50%;
  1487. text-align: center;
  1488. line-height: 44rpx;
  1489. background-color: #fe960f;
  1490. color: #fff;
  1491. font-size: 30rpx;
  1492. margin-right: 15rpx;
  1493. }
  1494. .order-submission .wrapper .item .list .payItem .name .iconfont.icon-weixin2 {
  1495. background-color: #41b035;
  1496. }
  1497. .order-submission .wrapper .item .list .payItem .name .iconfont.icon-zhifubao {
  1498. background-color: #4295D5;
  1499. }
  1500. .order-submission .wrapper .item .list .payItem .tip {
  1501. width: 49%;
  1502. text-align: center;
  1503. font-size: 26rpx;
  1504. color: #aaa;
  1505. }
  1506. .order-submission .moneyList {
  1507. margin-top: 12rpx;
  1508. background-color: #fff;
  1509. padding: 30rpx;
  1510. }
  1511. .order-submission .moneyList .item {
  1512. font-size: 28rpx;
  1513. color: #282828;
  1514. }
  1515. .order-submission .moneyList .item~.item {
  1516. margin-top: 20rpx;
  1517. }
  1518. .order-submission .moneyList .item .money {
  1519. color: #868686;
  1520. }
  1521. .order-submission .footer {
  1522. width: 100%;
  1523. height: 100rpx;
  1524. background-color: #fff;
  1525. padding: 0 30rpx;
  1526. font-size: 28rpx;
  1527. color: #333;
  1528. box-sizing: border-box;
  1529. position: fixed;
  1530. bottom: 0;
  1531. left: 0;
  1532. }
  1533. .order-submission .footer .settlement {
  1534. font-size: 30rpx;
  1535. color: #fff;
  1536. width: 240rpx;
  1537. height: 70rpx;
  1538. background-color: #e93323;
  1539. border-radius: 50rpx;
  1540. text-align: center;
  1541. line-height: 70rpx;
  1542. &.disabled {
  1543. background-color: #cccccc;
  1544. }
  1545. }
  1546. .footer .transparent {
  1547. opacity: 0
  1548. }
  1549. .event_bg {
  1550. background: #FF7F00;
  1551. }
  1552. .event_color {
  1553. color: #FF7F00;
  1554. }
  1555. .color_red {
  1556. color: #E93323;
  1557. }
  1558. .storeinfo-wrapper {
  1559. .store-item {
  1560. margin-top: 12rpx;
  1561. background-color: #fff;
  1562. .store-title {
  1563. display: flex;
  1564. align-items: center;
  1565. padding: 28rpx 30rpx;
  1566. .icon-shangjiadingdan {
  1567. font-size: 32rpx;
  1568. }
  1569. .icon-xiangyou {
  1570. font-size: 26rpx;
  1571. color: #999;
  1572. }
  1573. .txt {
  1574. margin: 0 8rpx;
  1575. }
  1576. }
  1577. .product-item {
  1578. display: flex;
  1579. padding: 25rpx 30rpx;
  1580. border-top: 1px solid #F0F0F0;
  1581. .img-box {
  1582. width: 130rpx;
  1583. height: 130rpx;
  1584. image {
  1585. width: 130rpx;
  1586. height: 130rpx;
  1587. border-radius: 16rpx;
  1588. }
  1589. }
  1590. .content {
  1591. position: relative;
  1592. width: 550rpx;
  1593. margin-left: 30rpx;
  1594. font-size: 28rpx;
  1595. color: #282828;
  1596. &.event_content {
  1597. .line1 {
  1598. width: 360rpx;
  1599. }
  1600. .price {
  1601. position: absolute;
  1602. top: 0;
  1603. right: 0;
  1604. margin-top: 0;
  1605. text {
  1606. display: block;
  1607. text-align: right;
  1608. }
  1609. }
  1610. }
  1611. .event_name {
  1612. display: inline-block;
  1613. margin-right: 9rpx;
  1614. color: #fff;
  1615. font-size: 20rpx;
  1616. padding: 0 8rpx;
  1617. line-height: 30rpx;
  1618. text-align: center;
  1619. border-radius: 6rpx;
  1620. }
  1621. .event_ship {
  1622. font-size: 20rpx;
  1623. margin-top: 10rpx;
  1624. }
  1625. .label {
  1626. margin-top: 10rpx;
  1627. color: #868686;
  1628. font-size: 20rpx;
  1629. }
  1630. .price {
  1631. margin-top: 20rpx;
  1632. color: $theme-color;
  1633. text {
  1634. margin-left: 10rpx;
  1635. color: #999;
  1636. }
  1637. }
  1638. .err-txt {
  1639. display: flex;
  1640. align-items: center;
  1641. margin-top: 18rpx;
  1642. color: $theme-color;
  1643. .iconfont {
  1644. margin-right: 10rpx;
  1645. }
  1646. }
  1647. .step {
  1648. position: absolute;
  1649. right: 0;
  1650. top: 100rpx;
  1651. display: flex;
  1652. align-items: center;
  1653. .min {
  1654. width: 50rpx;
  1655. height: 40rpx;
  1656. background-image: url('~@/static/images/min.png');
  1657. background-size: 17rpx 17rpx;
  1658. background-position: center;
  1659. background-repeat: no-repeat;
  1660. }
  1661. .num-box {
  1662. width: 68rpx;
  1663. height: 40rpx;
  1664. line-height: 40rpx;
  1665. text-align: center;
  1666. background: #F2F2F2;
  1667. font-size: 23rpx;
  1668. }
  1669. .add {
  1670. width: 50rpx;
  1671. height: 40rpx;
  1672. background-image: url('~@/static/images/add.png');
  1673. background-size: 17rpx 17rpx;
  1674. background-position: center;
  1675. background-repeat: no-repeat;
  1676. }
  1677. }
  1678. }
  1679. }
  1680. }
  1681. .event_payTime {
  1682. padding: 0 30rpx 24rpx;
  1683. .event_progress {
  1684. margin-top: 50rpx;
  1685. position: relative;
  1686. }
  1687. .progress_step {
  1688. height: 80rpx;
  1689. position: relative;
  1690. padding-left: 60rpx;
  1691. &::before {
  1692. content: '';
  1693. display: block;
  1694. width: 2rpx;
  1695. height: 40rpx;
  1696. background: #E93323;
  1697. position: absolute;
  1698. left: 35rpx;
  1699. top: 18rpx;
  1700. }
  1701. &:nth-child(2) {
  1702. &::before {
  1703. bottom: 64rpx;
  1704. top: auto;
  1705. background: #EFEFEF;
  1706. }
  1707. &::after {
  1708. background: #EFEFEF;
  1709. }
  1710. }
  1711. &::after {
  1712. content: '';
  1713. display: block;
  1714. width: 14rpx;
  1715. height: 14rpx;
  1716. background: #E93323;
  1717. border-radius: 50%;
  1718. position: absolute;
  1719. top: 10rpx;
  1720. left: 29rpx;
  1721. }
  1722. .name {
  1723. float: left;
  1724. color: #282828;
  1725. &.color_red {
  1726. color: #E93323;
  1727. }
  1728. }
  1729. .price {
  1730. float: right;
  1731. color: #282828;
  1732. &.color_red {
  1733. color: #E93323;
  1734. }
  1735. }
  1736. }
  1737. .progress_pay {
  1738. padding-left: 60rpx;
  1739. font-size: 24rpx;
  1740. color: #868686;
  1741. margin-top: -34rpx;
  1742. }
  1743. }
  1744. }
  1745. uni-checkbox-group,
  1746. .checkgroup {
  1747. width: 100%;
  1748. .checkbox {
  1749. float: right;
  1750. }
  1751. }
  1752. .icon-wenhao1 {
  1753. color: #868686;
  1754. margin-right: 6rpx;
  1755. }
  1756. .total {
  1757. display: flex;
  1758. justify-content: flex-end;
  1759. padding-right: 30rpx;
  1760. padding-bottom: 30rpx;
  1761. font-size: 26rpx;
  1762. color: #282828;
  1763. .price {
  1764. margin-left: 10rpx;
  1765. color: $theme-color;
  1766. font-size: 28rpx;
  1767. font-weight: bold;
  1768. text {
  1769. font-size: 20rpx;
  1770. }
  1771. }
  1772. }
  1773. .store-address {
  1774. padding: 30rpx 23rpx;
  1775. margin: 0 30rpx;
  1776. background: #F6F6F6;
  1777. border-radius: 8rpx;
  1778. font-size: 24rpx;
  1779. display: -webkit-box;
  1780. display: -moz-box;
  1781. display: -ms-flexbox;
  1782. display: -webkit-flex;
  1783. display: flex;
  1784. /*垂直居中*/
  1785. -webkit-box-align: center;/*旧版本*/
  1786. -moz-box-align: center;/*旧版本*/
  1787. -ms-flex-align: center;/*混合版本*/
  1788. -webkit-align-items: center;/*新版本*/
  1789. align-items: center;/*新版本*/
  1790. .name {
  1791. width: 148rpx;
  1792. margin-right: 20rpx;
  1793. }
  1794. .info {
  1795. flex: 1;
  1796. }
  1797. .map{
  1798. text-align: center;
  1799. padding-left: 40rpx;
  1800. position: relative;
  1801. &::before{
  1802. content: '';
  1803. display: inline-block;
  1804. width: 2rpx;
  1805. height: 42rpx;
  1806. background-color: #DDDDDD;
  1807. position: absolute;
  1808. left: 0;
  1809. top: 18rpx;
  1810. }
  1811. .iconfont{
  1812. color: #E93323;
  1813. }
  1814. .map_text{
  1815. color: #E93323;
  1816. }
  1817. }
  1818. }
  1819. .settlementAgreement {
  1820. width: 100%;
  1821. height: 100%;
  1822. position: fixed;
  1823. top: 0;
  1824. left: 0;
  1825. background: rgba(0, 0, 0, .5);
  1826. z-index: 10;
  1827. }
  1828. .settlementAgreement .setAgCount {
  1829. background: #fff;
  1830. width: 656rpx;
  1831. height: 458px;
  1832. position: absolute;
  1833. top: 50%;
  1834. left: 50%;
  1835. border-radius: 12rpx;
  1836. -webkit-border-radius: 12rpx;
  1837. padding: 52rpx;
  1838. -webkit-transform: translate(-50%, -50%);
  1839. -moz-transform: translate(-50%, -50%);
  1840. transform: translate(-50%, -50%);
  1841. overflow: hidden;
  1842. .content {
  1843. height: 900rpx;
  1844. overflow-y: scroll;
  1845. /deep/ p {
  1846. font-size: 13px;
  1847. line-height: 22px;
  1848. }
  1849. /deep/ img {
  1850. max-width: 100%;
  1851. }
  1852. }
  1853. }
  1854. .settlementAgreement .setAgCount .icon {
  1855. font-size: 42rpx;
  1856. color: #b4b1b4;
  1857. position: absolute;
  1858. top: 15rpx;
  1859. right: 15rpx;
  1860. }
  1861. .settlementAgreement .setAgCount .title {
  1862. color: #333;
  1863. font-size: 32rpx;
  1864. text-align: center;
  1865. font-weight: bold;
  1866. }
  1867. .settlementAgreement .setAgCount .content {
  1868. margin-top: 32rpx;
  1869. color: #333;
  1870. font-size: 26rpx;
  1871. line-height: 22px;
  1872. text-align: justify;
  1873. text-justify: distribute-all-lines;
  1874. height: 756rpx;
  1875. overflow-y: scroll;
  1876. }
  1877. </style>