index.vue 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851
  1. <template>
  2. <view :style="colorStyle">
  3. <view class='order-submission'>
  4. <view class="allAddress" :style="store_self_mention && is_shipping ? '':'padding-top:10rpx'"
  5. v-if="!virtual_type && (!is_gift || is_gift == 2)">
  6. <view class="nav acea-row">
  7. <view class="item font-num" :class="shippingType == 0 ? 'on' : 'on2'" @tap="addressType(0)"
  8. v-if='store_self_mention && is_shipping'>
  9. <view class="before">
  10. {{$t(`快递配送`)}}
  11. </view>
  12. </view>
  13. <view class="item font-num" :class="shippingType == 1 ? 'on' : 'on2'" @tap="addressType(1)"
  14. v-if='store_self_mention && is_shipping'>
  15. <view class="before">
  16. {{$t(`到店自提`)}}
  17. </view>
  18. </view>
  19. </view>
  20. <view class="add-title acea-row row-between-wrapper" v-if="!store_self_mention || !is_shipping"
  21. @click.prevent="openList">
  22. <view class="acea-row row-middle">
  23. <view class="icon" :class="shippingType==1?'orange':'red'">
  24. {{shippingType==0?'商城配送':'门店自提'}}
  25. </view>
  26. <view class="text add-text line1" v-if="shippingType==0">{{$t(`由平台为您提供配送服务`)}}</view>
  27. <view class="text add-text line1" v-if="shippingType==1">{{$t(`线上下单,到店自提`)}}</view>
  28. </view>
  29. <view class="text">{{shippingType == 0 ? $t('切换地址') : $t('切换门店')}} <text class='iconfont icon-jiantou'></text>
  30. </view>
  31. </view>
  32. <view class='address acea-row row-between-wrapper' @tap='onAddress' v-if='shippingType == 0'>
  33. <view class='addressCon' v-if="addressInfo.real_name || ''">
  34. <view class='name'>{{addressInfo.real_name || ''}}
  35. <text class='phone'>{{addressInfo.phone || ''}}</text>
  36. </view>
  37. <view class="line1">
  38. <text class='default font-num'
  39. v-if="addressInfo.is_default">[{{$t(`默认`)}}]</text>{{addressInfo.province}}{{addressInfo.city}}{{addressInfo.district}}{{addressInfo.detail}}
  40. </view>
  41. <!-- <view class='setaddress'>设置收货地址</view> -->
  42. </view>
  43. <view class='addressCon' v-else>
  44. <view class='setaddress'>{{$t(`设置收货地址`)}}</view>
  45. </view>
  46. <view v-if="store_self_mention && is_shipping" class='iconfont icon-jiantou'></view>
  47. </view>
  48. <view class='address acea-row row-between-wrapper' v-else @tap="showStoreList">
  49. <block v-if="storeList.length>0">
  50. <view class='addressCon'>
  51. <view class='name'>{{system_store.name || ''}}
  52. <text class='phone'>{{system_store.phone || ''}}</text>
  53. </view>
  54. <view class="line1"> {{system_store.address}}{{", " + system_store.detailed_address}}</view>
  55. </view>
  56. <!-- <view class='iconfont icon-jiantou'></view> -->
  57. </block>
  58. <block v-else>
  59. <view>{{$t(`暂无门店信息`)}}</view>
  60. </block>
  61. <view class="icon acea-row row-middle" v-if="storeList.length>0">
  62. <view class="iconfont icon-dianhua" @click.stop="call(system_store.phone)"></view>
  63. <view class="iconfont icon-dingwei2" @click.stop="showMaoLocation(system_store)"></view>
  64. </view>
  65. </view>
  66. <view class='line'>
  67. <image src='/static/images/line.jpg'></image>
  68. </view>
  69. </view>
  70. <view v-if="giftData" class="gift-box">
  71. <view class="acea-row row-middle user-msg">
  72. <image class="avatar mr-12" :src="giftData.avatar" mode=""></image>
  73. <text class="nickname">{{ giftData.nickname}} 赠您一份礼物,请查收!</text>
  74. </view>
  75. <view class="line"></view>
  76. <view class="gift-mark" v-if="giftData.gift_mark">
  77. {{giftData.gift_mark}}
  78. </view>
  79. </view>
  80. <orderGoods :cartInfo="cartInfo" :is_confirm='true' :is_gift='is_gift' :shipping_type="shippingType"></orderGoods>
  81. <view v-if="is_gift == 1" class="gift-msg acea-row row-between-wrapper">
  82. <view>{{$t(`好友留言`)}}</view>
  83. <view class="discount">
  84. <input style="text-align: right;" v-model="gift_mark" type="text" :placeholder="$t(`填写好友留言,最多40字`)"
  85. placeholder-class="placeholder"></input>
  86. </view>
  87. </view>
  88. <view class='wrapper' v-if="(!is_gift && is_gift == 2) && shippingType == 1">
  89. <view class="item acea-row row-between-wrapper">
  90. <view>{{$t(`用户姓名`)}}</view>
  91. <view class="discount">
  92. <input style="text-align: right;" v-model="contacts" type="text" :placeholder="$t(`请输入姓名`)"
  93. placeholder-class="placeholder"></input>
  94. </view>
  95. </view>
  96. <view class="item acea-row row-between-wrapper">
  97. <view>{{$t(`联系电话`)}}</view>
  98. <view class="discount">
  99. <input style="text-align: right;" v-model="contactsTel" type="text" :placeholder="$t(`请输入手机号`)"
  100. placeholder-class="placeholder"></input>
  101. </view>
  102. </view>
  103. </view>
  104. <view v-if="is_gift == 2" class="receive-btn" @click="receiveGift">
  105. 立即领取
  106. </view>
  107. <view class='wrapper' v-if="!is_gift || is_gift == 1">
  108. <view class='item acea-row row-between-wrapper' @tap='couponTap'
  109. v-if="!pinkId && !BargainId && !combinationId && !seckillId&& !noCoupon && !discountId && !advanceId">
  110. <view>{{$t(`优惠券`)}}</view>
  111. <view class='discount'>
  112. {{couponTitle}}
  113. <text class='iconfont icon-jiantou'></text>
  114. </view>
  115. </view>
  116. <view class='item acea-row row-between-wrapper'
  117. v-if="!pinkId && !BargainId && !combinationId && !seckillId && !advanceId && integral_open && !is_pack">
  118. <view>{{$t(`积分抵扣`)}}</view>
  119. <view class='discount acea-row row-middle'>
  120. <view> {{useIntegral ? $t(`剩余积分`):$t(`当前积分`)}}
  121. <text class='num font-color'>{{integral || 0}}</text>
  122. </view>
  123. <checkbox-group @change="ChangeIntegral">
  124. <checkbox :disabled="integral<=0 && !useIntegral" :checked='useIntegral ? true : false' />
  125. </checkbox-group>
  126. </view>
  127. </view>
  128. <view v-if="invoice_func || special_invoice" class='item acea-row row-between-wrapper' @tap="goInvoice">
  129. <view>{{$t(`开具发票`)}}</view>
  130. <view class='discount'>
  131. {{invTitle}}
  132. <text class='iconfont icon-jiantou'></text>
  133. </view>
  134. </view>
  135. <view v-if="shippingType == 1">
  136. <view class="item acea-row row-between-wrapper">
  137. <view>{{$t(`用户姓名`)}}</view>
  138. <view class="discount">
  139. <input style="text-align: right;" v-model="contacts" type="text" :placeholder="$t(`请输入姓名`)"
  140. placeholder-class="placeholder"></input>
  141. </view>
  142. </view>
  143. <view class="item acea-row row-between-wrapper">
  144. <view>{{$t(`联系电话`)}}</view>
  145. <view class="discount">
  146. <input style="text-align: right;" v-model="contactsTel" type="text" :placeholder="$t(`请输入手机号`)"
  147. placeholder-class="placeholder"></input>
  148. </view>
  149. </view>
  150. </view>
  151. <view class='item' v-if="textareaStatus">
  152. <view>{{$t(`备注说明`)}}</view>
  153. <view class="mark" v-if="!coupon.coupon && !inputTrip" @click="inputTripClick">
  154. <view :class="{'mark-msg': mark}" v-text="mark || $t(`填写备注信息,100字以内`)"></view>
  155. </view>
  156. <textarea placeholder-class='placeholder' :placeholder="$t(`填写备注信息,100字以内`)"
  157. v-if="!coupon.coupon && inputTrip" @input='bindHideKeyboard' :focus="focus" @blur="inputTrip = false"
  158. :value="mark" :maxlength="150" name="mark">
  159. </textarea>
  160. </view>
  161. </view>
  162. <view class='wrapper' v-if="confirm.length && (!is_gift || is_gift == 1)">
  163. <view class='item acea-row row-between-wrapper' v-for="(item,index) in confirm" :key="index">
  164. <view>
  165. <span v-if="item.status" style="color: red;">*</span>
  166. <span v-else style="marginLeft: 8px;"></span>
  167. {{ item.title }}
  168. </view>
  169. <!-- text -->
  170. <view v-if="item.label=='text'" class="confirm">
  171. <input type="text" :placeholder="$t(`请填写${item.title}`)" v-model="item.value" />
  172. </view>
  173. <!-- number -->
  174. <view v-if="item.label=='number'" class="confirm">
  175. <input type="number" :placeholder="$t(`请填写${item.title}`)" v-model="item.value" />
  176. </view>
  177. <!-- email -->
  178. <view v-if="item.label=='email'" class="confirm">
  179. <input type="text" :placeholder="$t(`请填写${item.title}`)" v-model="item.value" />
  180. </view>
  181. <!-- data -->
  182. <view v-if="item.label=='data'" class="uni-list">
  183. <view class="uni-list-cell">
  184. <view class="uni-list-cell-db">
  185. <picker mode="date" :value="item.value" @change="bindDateChange($event,index)">
  186. <view v-if="item.value == ''" class="fontC">{{date+item.title}}<text
  187. class='iconfont icon-jiantou'></text></view>
  188. <view v-else class="uni-input">{{item.value}}</view>
  189. </picker>
  190. </view>
  191. </view>
  192. </view>
  193. <!-- time -->
  194. <view v-if="item.label=='time'">
  195. <view>
  196. <view>
  197. <picker mode="time" :value="item.value" start="00:00" end="23:59"
  198. @change="bindTimeChange($event,index)">
  199. <view v-if="item.value == ''" class="fontC">{{time+item.title}}<text
  200. class='iconfont icon-jiantou'></text></view>
  201. <view>{{item.value}}</view>
  202. </picker>
  203. </view>
  204. </view>
  205. </view>
  206. <!-- id -->
  207. <view v-if="item.label=='id'" class="confirm">
  208. <input type="idcard" :placeholder="$t(`请填写`)+item.title" v-model="item.value" />
  209. </view>
  210. <!-- phone -->
  211. <view v-if="item.label=='phone'" class="confirm">
  212. <input type="tel" :placeholder="$t(`请填写`)+item.title" v-model="item.value" />
  213. </view>
  214. <!-- img -->
  215. <view v-if="item.label=='img'" class="confirmImg">
  216. <view class='list acea-row row-middle'>
  217. <view class='pictrue' v-for="(items,indexs) in item.value" :key="indexs">
  218. <image :src='items' class="img"></image>
  219. <text class='iconfont icon-guanbi1 font-num del' @click='DelPic(index,indexs)'></text>
  220. </view>
  221. <view class='pictrue acea-row row-center-wrapper row-column bor' @click='uploadpic(index,item)'
  222. v-if="item.value.length < 8">
  223. <text class='iconfont icon-icon25201'></text>
  224. <view>{{$t(`上传图片`)}}</view>
  225. </view>
  226. </view>
  227. </view>
  228. </view>
  229. </view>
  230. <view class='moneyList' v-if="!is_gift || is_gift == 1">
  231. <view class='item acea-row row-between-wrapper'>
  232. <view>{{$t(`商品总价`)}}:</view>
  233. <view class='money'>
  234. {{$t(`¥`)}}{{allPrice || 0}}
  235. </view>
  236. </view>
  237. <view v-if="is_gift && priceGroup.giftPrice > 0" class='item acea-row row-between-wrapper'>
  238. <view>{{$t(`礼品附加费`)}}:</view>
  239. <view class='money'>
  240. {{$t(`¥`)}}{{parseFloat(priceGroup.giftPrice)}}
  241. </view>
  242. </view>
  243. <view class='item acea-row row-between-wrapper'
  244. v-if="priceGroup.storePostage > 0 || priceGroup.storePostageDiscount > 0">
  245. <view>{{$t(`配送运费`)}}:</view>
  246. <view class='money'>
  247. {{$t(`¥`)}}{{(parseFloat(priceGroup.storePostage)+parseFloat(priceGroup.storePostageDiscount)).toFixed(2)}}
  248. </view>
  249. </view>
  250. <view class='item acea-row row-between-wrapper'
  251. v-if="priceGroup.levelPrice > 0 && userInfo.vip && !pinkId && !BargainId && !combinationId && !seckillId && !discountId">
  252. <view>{{$t(`用户等级优惠`)}}:</view>
  253. <view class='money'>-{{$t(`¥`)}}{{parseFloat(priceGroup.levelPrice).toFixed(2)}}</view>
  254. </view>
  255. <view class='item acea-row row-between-wrapper'
  256. v-if="priceGroup.memberPrice > 0 && userInfo.vip && !pinkId && !BargainId && !combinationId && !seckillId && !discountId">
  257. <view>{{$t(`付费会员优惠`)}}:</view>
  258. <view class='money'>-{{$t(`¥`)}}{{parseFloat(priceGroup.memberPrice).toFixed(2)}}</view>
  259. </view>
  260. <view class='item acea-row row-between-wrapper' v-if="priceGroup.storePostageDiscount > 0">
  261. <view>{{$t(`会员运费优惠`)}}:</view>
  262. <view class='money'>-{{$t(`¥`)}}{{parseFloat(priceGroup.storePostageDiscount).toFixed(2)}}</view>
  263. </view>
  264. <view class='item acea-row row-between-wrapper' v-if="coupon_price > 0">
  265. <view>{{$t(`优惠券抵扣`)}}:</view>
  266. <view class='money'>-{{$t(`¥`)}}{{parseFloat(coupon_price).toFixed(2)}}</view>
  267. </view>
  268. <view class='item acea-row row-between-wrapper' v-if="integral_price > 0">
  269. <view>{{$t(`积分抵扣`)}}:</view>
  270. <view class='money'>-{{$t(`¥`)}}{{parseFloat(integral_price).toFixed(2)}}</view>
  271. </view>
  272. </view>
  273. <view style='height:120rpx;'></view>
  274. <view class='footer acea-row row-between-wrapper' v-if="!is_gift || is_gift == 1">
  275. <view>{{$t(`合计`)}}:
  276. <text class='font-color'>{{$t(`¥`)}}{{totalPrice || 0}}</text>
  277. </view>
  278. <view class='settlement' style='z-index:100' @tap.stop="Debounce(SubOrder())"
  279. v-if="(valid_count>0&&!discount_id) || (valid_count==cartInfo.length&&discount_id)">{{$t(`提交订单`)}}
  280. </view>
  281. <view class='settlement bg-color-hui' style='z-index:100' v-else>{{$t(`提交订单`)}}</view>
  282. </view>
  283. </view>
  284. <view class="alipaysubmit" v-html="formContent"></view>
  285. <couponListWindow :coupon='coupon' @ChangCouponsClone="ChangCouponsClone" :openType='openType' :cartId='cartId'
  286. @ChangCoupons="ChangCoupons"></couponListWindow>
  287. <addressWindow ref="addressWindow" @changeTextareaStatus="changeTextareaStatus" :news='news' :address='address'
  288. :pagesUrl="pagesUrl" @OnChangeAddress="OnChangeAddress" @changeClose="changeClose"
  289. @onHaveAddressList="onHaveAddressList"></addressWindow>
  290. <!-- #ifdef MP -->
  291. <!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
  292. <!-- #endif -->
  293. <home v-show="!invShow"></home>
  294. <invoice-picker :inv-show="invShow" :inv-list="invList" :inv-checked="invChecked" :is-special="special_invoice"
  295. :url-query="urlQuery" @inv-close="invClose" @inv-change="invChange" @inv-cancel="invCancel">
  296. </invoice-picker>
  297. <canvas canvas-id="canvas" v-if="canvasStatus"
  298. :style="{width: canvasWidth + 'px', height: canvasHeight + 'px',position: 'absolute',left:'-100000px',top:'-100000px'}"></canvas>
  299. </view>
  300. </template>
  301. <script>
  302. import {
  303. orderConfirm,
  304. getCouponsOrderPrice,
  305. orderCreate,
  306. postOrderComputed,
  307. checkShipping,
  308. getGiftOrderDetail,
  309. orderReceiveGift
  310. } from '@/api/order.js';
  311. import {
  312. getAddressDefault,
  313. getAddressDetail,
  314. invoiceList,
  315. invoiceOrder
  316. } from '@/api/user.js';
  317. import {
  318. openPaySubscribe
  319. } from '@/utils/SubscribeMessage.js';
  320. import {
  321. storeListApi
  322. } from '@/api/store.js';
  323. import {
  324. CACHE_LONGITUDE,
  325. CACHE_LATITUDE
  326. } from '@/config/cache.js';
  327. import couponListWindow from '@/components/couponListWindow';
  328. import addressWindow from '@/components/addressWindow';
  329. import orderGoods from '@/components/orderGoods';
  330. import home from '@/components/home';
  331. import invoicePicker from '../components/invoicePicker/index.vue';
  332. import {
  333. toLogin
  334. } from '@/libs/login.js';
  335. import {
  336. mapGetters
  337. } from "vuex";
  338. // #ifdef MP
  339. import authorize from '@/components/Authorize';
  340. // #endif
  341. import payment from '@/components/payment';
  342. import colors from "@/mixins/color";
  343. import Debounce from "@/mixins/debounce";
  344. export default {
  345. components: {
  346. payment,
  347. invoicePicker,
  348. couponListWindow,
  349. addressWindow,
  350. orderGoods,
  351. home,
  352. // #ifdef MP
  353. authorize
  354. // #endif
  355. },
  356. mixins: [colors, Debounce],
  357. data() {
  358. const currentDate = this.getDate({
  359. format: true
  360. })
  361. return {
  362. confirm: '', //自定义留言
  363. date: this.$t(`请选择`),
  364. time: this.$t(`请选择`),
  365. canvasWidth: "",
  366. canvasHeight: "",
  367. canvasStatus: false,
  368. newImg: [],
  369. textareaStatus: true,
  370. //支付方式
  371. cartArr: [{
  372. "name": this.$t(`微信支付`),
  373. "icon": "icon-weixin2",
  374. value: 'weixin',
  375. title: this.$t(`使用微信快捷支付`),
  376. payStatus: 1,
  377. },
  378. {
  379. "name": this.$t(`支付宝支付`),
  380. "icon": "icon-zhifubao",
  381. value: 'alipay',
  382. title: this.$t(`使用支付宝支付`),
  383. payStatus: 1,
  384. },
  385. {
  386. "name": this.$t(`余额支付`),
  387. "icon": "icon-yuezhifu",
  388. value: 'yue',
  389. title: this.$t(`可用余额`),
  390. payStatus: 1,
  391. },
  392. {
  393. "name": this.$t(`线下支付`),
  394. "icon": "icon-yuezhifu1",
  395. value: 'offline',
  396. title: this.$t(`使用线下付款`),
  397. payStatus: 2,
  398. }, {
  399. "name": this.$t(`好友代付`),
  400. "icon": "icon-haoyoudaizhifu",
  401. value: 'friend',
  402. title: this.$t(`找微信好友支付`),
  403. payStatus: 1,
  404. }
  405. ],
  406. virtual_type: 0,
  407. allPrice: 0,
  408. formContent: '',
  409. payType: '', //支付方式
  410. openType: 1, //优惠券打开方式 1=使用
  411. active: 0, //支付方式切换
  412. coupon: {
  413. coupon: false,
  414. list: [],
  415. statusTile: this.$t(`立即使用`)
  416. }, //优惠券组件
  417. address: {
  418. address: false
  419. }, //地址组件
  420. addressInfo: {}, //地址信息
  421. pinkId: 0, //拼团id
  422. addressId: 0, //地址id
  423. couponId: 0, //优惠券id
  424. cartId: '', //购物车id
  425. orderId: '', // 订单id, 领取礼物页面传参
  426. BargainId: 0,
  427. combinationId: 0,
  428. seckillId: 0,
  429. discountId: 0,
  430. userInfo: {}, //用户信息
  431. mark: '', //备注信息
  432. couponTitle: this.$t(`请选择`), //优惠券
  433. coupon_price: 0, //优惠券抵扣金额
  434. useIntegral: false, //是否使用积分
  435. integral_price: 0, //积分抵扣金额
  436. integral: 0,
  437. usable_integral: 0,
  438. ChangePrice: 0, //使用积分抵扣变动后的金额
  439. formIds: [], //收集formid
  440. status: 0,
  441. is_address: false,
  442. toPay: false, //修复进入支付时页面隐藏从新刷新页面
  443. shippingType: 0,
  444. system_store: {},
  445. storePostage: 0,
  446. advanceId: 0,
  447. gift_mark: '这是送您的一份礼物~', // 礼物留言
  448. contacts: '',
  449. contactsTel: '',
  450. mydata: {},
  451. storeList: [],
  452. store_self_mention: 0,
  453. cartInfo: [],
  454. priceGroup: {},
  455. animated: false,
  456. totalPrice: 0,
  457. integralRatio: "0",
  458. pagesUrl: "",
  459. orderKey: "",
  460. // usableCoupon: {},
  461. offlinePostage: "",
  462. isAuto: false, //没有授权的不会自动授权
  463. isShowAuth: false, //是否隐藏授权
  464. from: '',
  465. news: 1,
  466. // invTitle: '不开发票',
  467. invTitle: this.$t(`不开发票`),
  468. special_invoice: false,
  469. invoice_func: false,
  470. header_type: '',
  471. invShow: false,
  472. invList: [],
  473. invChecked: '',
  474. urlQuery: '',
  475. pay_close: false,
  476. noCoupon: 0,
  477. valid_count: 0,
  478. discount_id: 0,
  479. is_shipping: true,
  480. inputTrip: false,
  481. focus: true,
  482. integral_open: false,
  483. jumpData: {},
  484. is_gift: 0, // 1 购买的礼品 2领取礼品
  485. giftData: null,
  486. is_pack: 0//是否报单商品
  487. };
  488. },
  489. computed: mapGetters(['isLogin']),
  490. // watch: {
  491. // startDate() {
  492. // return this.getDate('start');
  493. // },
  494. // endDate() {
  495. // return this.getDate('end');
  496. // }
  497. // },
  498. onLoad(options) {
  499. // #ifdef H5
  500. this.from = this.$wechat.isWeixin() ? 'weixin' : 'weixinh5'
  501. // #endif
  502. // #ifdef MP
  503. this.from = 'routine'
  504. // #endif
  505. // #ifdef APP-PLUS
  506. this.from = 'app'
  507. // #endif
  508. if (!options.cartId && !options.order_id) return this.$util.Tips({
  509. title: this.$t(`请选择要购买的商品`)
  510. }, {
  511. tab: 3,
  512. url: 1
  513. });
  514. if(options.is_gift){
  515. this.is_gift = Number(options.is_gift);
  516. }
  517. if(options.is_pack) {
  518. this.is_pack = Number(options.is_pack);
  519. }
  520. this.couponId = options.couponId || 0;
  521. this.noCoupon = Number(options.noCoupon) || 0;
  522. this.pinkId = options.pinkId ? parseInt(options.pinkId) : 0;
  523. this.addressId = options.addressId || 0;
  524. this.cartId = options.cartId;
  525. this.orderId = options.order_id || 0
  526. this.is_address = options.is_address ? true : false;
  527. this.news = !options.new || options.new === '0' ? 0 : 1;
  528. this.invChecked = options.invoice_id || '';
  529. this.header_type = options.header_type || '1';
  530. this.couponTitle = options.couponTitle || this.$t(`请选择`)
  531. if (options.invoice_id) {
  532. let name = ''
  533. name += options.header_type == 1 ? this.$t(`个人`) : this.$t(`企业`);
  534. name += options.invoice_type == 1 ? this.$t(`普通`) : this.$t(`专用`);
  535. name += this.$t(`发票`);
  536. this.invTitle = name;
  537. }
  538. // #ifndef APP-PLUS
  539. this.textareaStatus = true;
  540. // #endif
  541. if (this.isLogin && this.toPay == false && (this.is_gift == 0 || this.is_gift == 1)) {
  542. this.checkShipping();
  543. }else if(this.is_gift && this.isLogin){
  544. this.getOrderDetail()
  545. } else {
  546. toLogin();
  547. }
  548. },
  549. /**
  550. * 生命周期函数--监听页面显示
  551. */
  552. onShow: function() {
  553. let _this = this
  554. uni.$on("handClick", res => {
  555. if (res) {
  556. _this.system_store = res.address
  557. }
  558. // 清除监听
  559. uni.$off('handClick');
  560. })
  561. },
  562. methods: {
  563. checkShipping() {
  564. let that = this;
  565. checkShipping(that.cartId, that.news).then(res => {
  566. if (res.data.type == 0) {
  567. that.is_shipping = true;
  568. that.shippingType = 0;
  569. this.getaddressInfo();
  570. this.getConfirm();
  571. this.$nextTick(function() {
  572. this.$refs.addressWindow.getAddressList();
  573. })
  574. } else {
  575. if (res.data.type == 1) {
  576. that.is_shipping = false;
  577. that.shippingType = 0;
  578. this.getaddressInfo();
  579. this.getConfirm();
  580. this.$nextTick(function() {
  581. this.$refs.addressWindow.getAddressList();
  582. })
  583. } else if (res.data.type == 2) {
  584. that.is_shipping = false;
  585. that.shippingType = 1;
  586. this.addressType(1)
  587. this.getConfirm();
  588. this.getList();
  589. }
  590. }
  591. }).catch(err => {
  592. uni.showToast({
  593. title: err,
  594. icon: 'none'
  595. });
  596. });
  597. },
  598. // 不开发票
  599. invCancel() {
  600. this.invChecked = '';
  601. this.invTitle = this.$t(`不开发票`)
  602. this.invShow = false;
  603. },
  604. // 选择发票
  605. invChange(id) {
  606. let name = '';
  607. this.invChecked = id;
  608. this.invShow = false;
  609. const result = this.invList.find(item => item.id === id);
  610. name += result.header_type === 1 ? this.$t(`个人`) : this.$t(`企业`);
  611. name += result.type === 1 ? this.$t(`普通`) : this.$t(`专用`);
  612. name += this.$t(`发票`);
  613. this.invTitle = name;
  614. },
  615. openList() {
  616. if (this.shippingType == 0) {
  617. this.onAddress()
  618. } else {
  619. this.showStoreList()
  620. }
  621. },
  622. // 关闭发票
  623. invClose() {
  624. this.invShow = false;
  625. this.getInvoiceList()
  626. },
  627. getInvoiceList() {
  628. uni.showLoading({
  629. title: this.$t(`正在加载中`)
  630. })
  631. invoiceList().then(res => {
  632. uni.hideLoading();
  633. this.invList = res.data.map(item => {
  634. item.id = item.id.toString();
  635. return item;
  636. });
  637. const result = this.invList.find(item => item.id == this.invChecked);
  638. if (result) {
  639. let name = '';
  640. name += result.header_type === 1 ? this.$t(`个人`) : this.$t(`企业`);
  641. name += result.type === 1 ? this.$t(`普通`) : this.$t(`专用`);
  642. name += this.$t(`发票`);
  643. this.invTitle = name;
  644. }
  645. }).catch(err => {
  646. uni.showToast({
  647. title: err,
  648. icon: 'none'
  649. });
  650. });
  651. },
  652. /**
  653. * 开发票
  654. */
  655. goInvoice: function() {
  656. this.getInvoiceList()
  657. this.invShow = true;
  658. this.urlQuery =
  659. `new=${this.news}&cartId=${this.cartId}&pinkId=${this.pinkId}&couponId=${this.couponId}&addressId=${this.addressId}&specialInvoice=${this.special_invoice}&couponTitle=${this.couponTitle}`;
  660. },
  661. /**
  662. * 授权回调事件
  663. *
  664. */
  665. onLoadFun: function() {
  666. this.getaddressInfo();
  667. this.getConfirm();
  668. //调用子页面方法授权后执行获取地址列表
  669. // this.$scope.selectComponent('#address-window').getAddressList();
  670. },
  671. /**
  672. * 事件回调
  673. *
  674. */
  675. onChangeFun: function(e) {
  676. let opt = e;
  677. let action = opt.action || null;
  678. let value = opt.value != undefined ? opt.value : null;
  679. action && this[action] && this[action](value);
  680. },
  681. payClose: function() {
  682. this.pay_close = false;
  683. },
  684. goPay() {
  685. this.pay_close = true;
  686. },
  687. payCheck(type) {
  688. this.payType = type;
  689. this.SubOrder();
  690. },
  691. /**
  692. * 获取门店列表数据
  693. */
  694. getList: function() {
  695. let longitude = uni.getStorageSync("user_longitude") || ''; //经度
  696. let latitude = uni.getStorageSync("user_latitude") || ''; //纬度
  697. let data = {
  698. latitude: latitude, //纬度
  699. longitude: longitude, //经度
  700. page: 1,
  701. limit: 10
  702. }
  703. storeListApi(data).then(res => {
  704. let list = res.data.list.list || [];
  705. this.$set(this, 'storeList', list);
  706. this.$set(this, 'system_store', list[0]);
  707. }).catch(err => {})
  708. },
  709. // 关闭地址弹窗;
  710. changeClose: function() {
  711. this.$set(this.address, 'address', false);
  712. },
  713. /*
  714. * 跳转门店列表
  715. */
  716. showStoreList: function() {
  717. let _this = this
  718. if (this.storeList.length > 0) {
  719. uni.navigateTo({
  720. url: '/pages/goods/goods_details_store/index'
  721. })
  722. }
  723. },
  724. changePayType(type) {
  725. this.payType = type
  726. this.computedPrice()
  727. },
  728. computedPrice() {
  729. let shippingType = this.shippingType;
  730. let data = {
  731. addressId: this.addressId,
  732. useIntegral: this.useIntegral ? 1 : 0,
  733. couponId: this.couponId,
  734. shipping_type: parseInt(shippingType) + 1,
  735. payType: this.payType
  736. }
  737. if (this.is_gift) data.is_gift = this.is_gift
  738. postOrderComputed(this.orderKey, data).then(res => {
  739. let result = res.data.result;
  740. if (result) {
  741. this.totalPrice = result.pay_price;
  742. this.integral_price = result.deduction_price;
  743. this.coupon_price = result.coupon_price;
  744. this.integral = this.useIntegral ? result.SurplusIntegral : this.usable_integral;
  745. this.$set(this.priceGroup, 'storePostage', shippingType == 1 ? 0 : result.pay_postage);
  746. this.$set(this.priceGroup, 'storePostageDiscount', result.storePostageDiscount);
  747. }
  748. })
  749. },
  750. addressType(e) {
  751. let index = e;
  752. let that = this;
  753. if (this.shippingType == parseInt(index)) return
  754. this.shippingType = parseInt(index);
  755. if (index == 1) {
  756. // #ifdef H5
  757. if (that.$wechat.isWeixin()) {
  758. that.$wechat.location().then(res => {
  759. uni.setStorageSync('user_latitude', res.latitude);
  760. uni.setStorageSync('user_longitude', res.longitude);
  761. this.getList()
  762. }).catch(err => {
  763. this.getList()
  764. })
  765. } else {
  766. // #endif
  767. uni.getLocation({
  768. type: 'wgs84',
  769. success: (res) => {
  770. uni.setStorageSync('user_latitude', res.latitude);
  771. uni.setStorageSync('user_longitude', res.longitude);
  772. },
  773. complete: () => {
  774. this.getList()
  775. }
  776. })
  777. // #ifdef H5
  778. }
  779. // #endif
  780. };
  781. this.$nextTick(e => {
  782. if(!this.is_gift){
  783. this.getConfirm();
  784. this.computedPrice();
  785. }
  786. })
  787. },
  788. bindPickerChange: function(e) {
  789. let value = e.detail.value;
  790. this.shippingType = value;
  791. this.computedPrice();
  792. },
  793. ChangCouponsClone: function() {
  794. this.$set(this.coupon, 'coupon', false);
  795. },
  796. changeTextareaStatus: function() {
  797. for (let i = 0, len = this.coupon.list.length; i < len; i++) {
  798. this.coupon.list[i].use_title = '';
  799. this.coupon.list[i].is_use = 0;
  800. }
  801. this.textareaStatus = true;
  802. this.status = 0;
  803. this.$set(this.coupon, 'list', this.coupon.list);
  804. },
  805. /**
  806. * 处理点击优惠券后的事件
  807. *
  808. */
  809. ChangCoupons: function(e) {
  810. // this.usableCoupon = e
  811. // this.coupon.coupon = false
  812. let index = e,
  813. list = this.coupon.list,
  814. couponTitle = this.$t(`请选择`),
  815. couponId = 0;
  816. for (let i = 0, len = list.length; i < len; i++) {
  817. if (i != index) {
  818. list[i].use_title = '';
  819. list[i].is_use = 0;
  820. }
  821. }
  822. if (list[index].is_use) {
  823. //不使用优惠券
  824. list[index].use_title = '';
  825. list[index].is_use = 0;
  826. } else {
  827. //使用优惠券
  828. list[index].use_title = this.$t(`不使用`);
  829. list[index].is_use = 1;
  830. couponTitle = list[index].coupon_title;
  831. couponId = list[index].id;
  832. }
  833. this.couponTitle = couponTitle;
  834. this.couponId = couponId;
  835. this.$set(this.coupon, 'coupon', false);
  836. this.$set(this.coupon, 'list', list);
  837. this.computedPrice();
  838. },
  839. /**
  840. * 使用积分抵扣
  841. */
  842. ChangeIntegral: function() {
  843. this.useIntegral = !this.useIntegral;
  844. this.computedPrice();
  845. },
  846. /**
  847. * 选择地址后改变事件
  848. * @param object e
  849. */
  850. OnChangeAddress: function(e) {
  851. this.textareaStatus = true;
  852. this.addressId = e;
  853. this.address.address = false;
  854. this.getaddressInfo();
  855. if(!this.is_gift){
  856. this.getConfirm()
  857. this.computedPrice();
  858. }
  859. },
  860. bindHideKeyboard: function(e) {
  861. this.mark = e.detail.value;
  862. },
  863. getOrderDetail() {
  864. getGiftOrderDetail(this.orderId).then(res => {
  865. this.giftData = res.data
  866. this.$set(this, 'cartInfo', res.data.cartInfo);
  867. this.virtual_type = res.data.type
  868. this.store_self_mention = res.data.store_self_mention
  869. if (res.data.type == 0) {
  870. this.is_shipping = true;
  871. this.shippingType = 0;
  872. this.getaddressInfo();
  873. this.$nextTick(()=> {
  874. this.$refs.addressWindow.getAddressList();
  875. })
  876. } else {
  877. if (res.data.type == 1) {
  878. this.is_shipping = false;
  879. this.shippingType = 0;
  880. this.getaddressInfo();
  881. this.$nextTick(()=> {
  882. this.$refs.addressWindow.getAddressList();
  883. })
  884. } else if (res.data.type == 2) {
  885. this.is_shipping = false;
  886. this.shippingType = 1;
  887. this.addressType(1)
  888. this.getList();
  889. }
  890. }
  891. })
  892. },
  893. /**
  894. * 获取当前订单详细信息
  895. *
  896. */
  897. getConfirm: function() {
  898. let that = this;
  899. // return;
  900. uni.showLoading({
  901. title: that.$t(`正在加载中`),
  902. mask: true
  903. });
  904. let data = {
  905. is_pack:that.is_pack,
  906. cartId: that.cartId,
  907. new: that.news,
  908. addressId: that.addressId,
  909. shipping_type: that.shippingType + 1
  910. }
  911. if (that.is_gift) data.is_gift = that.is_gift
  912. orderConfirm(data).then(res => {
  913. that.$set(that, 'userInfo', res.data.userInfo);
  914. that.$set(that, 'confirm', res.data.custom_form || []);
  915. this.confirm.map(e => {
  916. if (e.label === 'img') e.value = []
  917. })
  918. that.$set(that, 'integral', res.data.usable_integral);
  919. that.$set(that, 'usable_integral', res.data.usable_integral);
  920. that.$set(that, 'contacts', res.data.userInfo.real_name);
  921. that.$set(that, 'contactsTel', res.data.userInfo.record_phone === '0' ? res.data.userInfo.phone : res
  922. .data
  923. .userInfo.record_phone);
  924. that.$set(that, 'cartInfo', res.data.cartInfo);
  925. that.$set(that, 'integralRatio', res.data.integralRatio);
  926. that.$set(that, 'offlinePostage', res.data.offlinePostage);
  927. that.$set(that, 'orderKey', res.data.orderKey);
  928. that.$set(that, 'valid_count', res.data.valid_count);
  929. that.$set(that, 'discount_id', res.data.discount_id)
  930. that.$set(that, 'priceGroup', res.data.priceGroup);
  931. that.$set(that, 'totalPrice', that.$util.$h.Add(parseFloat(res.data.priceGroup.totalPrice),
  932. parseFloat(res.data
  933. .priceGroup.storePostage)));
  934. that.$set(that, 'allPrice', that.$util.$h.Add(parseFloat(res.data.priceGroup.totalPrice),
  935. parseFloat(res.data
  936. .priceGroup.vipPrice)).toFixed(2));
  937. that.$set(that, 'seckillId', parseInt(res.data.seckill_id));
  938. that.$set(that, 'invoice_func', res.data.invoice_func);
  939. that.$set(that, 'special_invoice', res.data.special_invoice);
  940. that.$set(that, 'store_self_mention', res.data.store_self_mention);
  941. that.$set(that, 'virtual_type', res.data.virtual_type || 0);
  942. that.$set(that, 'integral_open', res.data.integral_open);
  943. uni.hideLoading()
  944. //微信支付是否开启
  945. that.cartArr[0].payStatus = res.data.pay_weixin_open || 0
  946. //支付宝是否开启
  947. that.cartArr[1].payStatus = res.data.ali_pay_status || 0;
  948. //#ifdef MP
  949. that.cartArr[1].payStatus = 0;
  950. //#endif
  951. //余额支付是否开启
  952. // that.cartArr[2].title = '可用余额:' + res.data.userInfo.now_money;
  953. that.cartArr[2].number = res.data.userInfo.now_money;
  954. that.cartArr[2].payStatus = res.data.yue_pay_status == 1 ? res.data.yue_pay_status : 0
  955. if (res.data.offline_pay_status == 2 || res.data.deduction) {
  956. that.cartArr[3].payStatus = 0
  957. } else {
  958. that.cartArr[3].payStatus = 1
  959. }
  960. //好友代付是否开启
  961. that.cartArr[4].payStatus = res.data.friend_pay_status || 0;
  962. // that.$set(that, 'cartArr', that.cartArr);
  963. that.$set(that, 'ChangePrice', that.totalPrice);
  964. that.getBargainId();
  965. setTimeout(() => {
  966. that.getCouponList();
  967. }, 500);
  968. if (this.addressId && !this.is_gift) {
  969. this.computedPrice();
  970. }
  971. }).catch(err => {
  972. uni.hideLoading()
  973. return this.$util.Tips({
  974. title: err
  975. });
  976. });
  977. },
  978. /*
  979. * 提取砍价和拼团id
  980. */
  981. getBargainId: function() {
  982. let that = this;
  983. let cartINfo = that.cartInfo;
  984. let BargainId = 0;
  985. let combinationId = 0;
  986. let discountId = 0;
  987. let advanceId = 0;
  988. cartINfo.forEach(function(value, index, cartINfo) {
  989. BargainId = cartINfo[index].bargain_id,
  990. combinationId = cartINfo[index].combination_id,
  991. discountId = cartINfo[index].discount_id,
  992. advanceId = cartINfo[index].advance_id
  993. })
  994. that.$set(that, 'BargainId', parseInt(BargainId));
  995. that.$set(that, 'combinationId', parseInt(combinationId));
  996. that.$set(that, 'discountId', parseInt(discountId));
  997. that.$set(that, 'advanceId', parseInt(advanceId));
  998. if (that.cartArr.length == 3 && (BargainId || combinationId || that.seckillId || discountId)) {
  999. that.cartArr[2].payStatus = 0;
  1000. that.$set(that, 'cartArr', that.cartArr);
  1001. }
  1002. },
  1003. /**
  1004. * 获取当前金额可用优惠券
  1005. *
  1006. */
  1007. getCouponList: function() {
  1008. let shippingType = this.shippingType;
  1009. let that = this;
  1010. let data = {
  1011. cartId: this.cartId,
  1012. 'new': this.news,
  1013. 'shippingType': parseInt(shippingType) + 1
  1014. }
  1015. getCouponsOrderPrice(this.totalPrice, data).then(res => {
  1016. this.$set(this.coupon, 'list', res.data);
  1017. if (!this.pinkId && !this.BargainId && !this.combinationId && !this.seckillId && !this.noCoupon && !this.discountId && !this.advanceId) {
  1018. this.coupon.list.length && this.ChangCoupons(0)
  1019. }
  1020. this.openType = 1;
  1021. });
  1022. },
  1023. /*
  1024. * 获取默认收货地址或者获取某条地址信息
  1025. */
  1026. getaddressInfo: function() {
  1027. let that = this;
  1028. let fnc = that.addressId ? getAddressDetail : getAddressDefault
  1029. fnc(that.addressId).then(res => {
  1030. if (!Array.isArray(res.data)) {
  1031. res.data.is_default = parseInt(res.data.is_default);
  1032. that.addressInfo = res.data || {};
  1033. that.addressId = res.data.id || 0;
  1034. that.address.addressId = res.data.id || 0;
  1035. }
  1036. })
  1037. },
  1038. onHaveAddressList() {
  1039. this.haveAddressList = true
  1040. },
  1041. payItem: function(e) {
  1042. let that = this;
  1043. let active = e;
  1044. that.active = active;
  1045. that.animated = true;
  1046. that.payType = that.cartArr[active].value;
  1047. that.computedPrice();
  1048. setTimeout(function() {
  1049. that.car();
  1050. }, 500);
  1051. },
  1052. couponTap: function() {
  1053. this.coupon.coupon = true;
  1054. this.coupon.list.forEach((item, index) => {
  1055. if (item.id == this.couponId) {
  1056. item.is_use = 1
  1057. } else {
  1058. item.is_use = 0
  1059. }
  1060. })
  1061. this.$set(this.coupon, 'list', this.coupon.list);
  1062. },
  1063. car: function() {
  1064. let that = this;
  1065. that.animated = false;
  1066. },
  1067. onAddress: function() {
  1068. let that = this;
  1069. if (this.addressInfo.real_name || this.haveAddressList) {
  1070. this.$refs.addressWindow.getAddressList();
  1071. that.textareaStatus = false;
  1072. that.address.address = true;
  1073. that.pagesUrl = '/pages/users/user_address_list/index?news=' + this.news + '&cartId=' + this
  1074. .cartId +
  1075. '&pinkId=' +
  1076. this.pinkId +
  1077. '&couponId=' +
  1078. this.couponId +
  1079. '&is_gift=' +
  1080. that.is_gift +
  1081. '&order_id=' + that.orderId
  1082. } else {
  1083. let url = '/pages/users/user_address/index?cartId=' + this.cartId + '&pinkId=' + this
  1084. .pinkId +
  1085. '&couponId=' + this.couponId + '&new=' + this.news + '&is_gift=' + that.is_gift + '&order_id=' + that.orderId
  1086. uni.navigateTo({
  1087. url: url
  1088. })
  1089. }
  1090. },
  1091. formpost(url, postData) {
  1092. let tempform = document.createElement("form");
  1093. tempform.action = url;
  1094. tempform.method = "post";
  1095. tempform.target = "_self";
  1096. tempform.style.display = "none";
  1097. for (let x in postData) {
  1098. let opt = document.createElement("input");
  1099. opt.name = x;
  1100. opt.value = postData[x];
  1101. tempform.appendChild(opt);
  1102. }
  1103. document.body.appendChild(tempform);
  1104. this.$nextTick(e => {
  1105. tempform.submit();
  1106. })
  1107. },
  1108. payment(data) {
  1109. let that = this;
  1110. orderCreate(that.orderKey, data).then(res => {
  1111. let url = `/pages/goods/cashier/index?order_id=${res.data.result.orderId}&from_type=order`
  1112. uni.reLaunch({
  1113. url
  1114. })
  1115. }).catch(err => {
  1116. uni.hideLoading();
  1117. return that.$util.Tips({
  1118. title: err
  1119. });
  1120. });
  1121. },
  1122. clickTextArea() {
  1123. this.$refs.textarea.focus()
  1124. },
  1125. SubOrder(e) {
  1126. let that = this,
  1127. data = {};
  1128. if (!that.addressId && !that.shippingType && !that.virtual_type && !that.is_gift) return that.$util.Tips({
  1129. title: that.$t(`请选择收货地址`)
  1130. });
  1131. if (that.shippingType == 1) {
  1132. if (that.contacts == "" || that.contactsTel == "") {
  1133. return that.$util.Tips({
  1134. title: that.$t(`请填写联系人或联系人电话`)
  1135. });
  1136. }
  1137. if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(that.contactsTel)) {
  1138. return that.$util.Tips({
  1139. title: that.$t(`请输入正确的手机号码`)
  1140. });
  1141. }
  1142. if (!that.contacts) {
  1143. return that.$util.Tips({
  1144. title: that.$t(`请输入姓名`)
  1145. });
  1146. }
  1147. if (that.storeList.length == 0) return that.$util.Tips({
  1148. title: that.$t(`暂无门店,请选择其他方式`)
  1149. });
  1150. }
  1151. for (var i = 0; i < that.confirm.length; i++) {
  1152. let data = that.confirm[i]
  1153. if (data.status) {
  1154. if (data.label === 'text' || data.label === 'data' || data.label === 'time' || data.label ===
  1155. 'id') {
  1156. if (!data.value.trim()) {
  1157. return uni.showToast({
  1158. title: that.$t(`请输入`) + `${data.title}`,
  1159. icon: 'none'
  1160. });
  1161. }
  1162. }
  1163. if (data.label === 'number') {
  1164. if (data.value <= 0) {
  1165. return uni.showToast({
  1166. title: that.$t(`请输入`) + `${data.title}`,
  1167. icon: 'none'
  1168. });
  1169. }
  1170. }
  1171. if (data.label === 'email') {
  1172. if (!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(data.value)) {
  1173. return uni.showToast({
  1174. title: that.$t(`请输入正确的`) + `${data.title}`,
  1175. icon: 'none'
  1176. });
  1177. }
  1178. }
  1179. if (data.label === 'phone') {
  1180. if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(data.value)) {
  1181. return uni.showToast({
  1182. title: that.$t(`请输入正确的`) + `${data.title}`,
  1183. icon: 'none'
  1184. });
  1185. }
  1186. }
  1187. if (data.label === 'img') {
  1188. if (!data.value.length) {
  1189. return uni.showToast({
  1190. title: that.$t(`请上传`) + `${data.title}`,
  1191. icon: 'none'
  1192. });
  1193. }
  1194. }
  1195. }
  1196. }
  1197. data = {
  1198. is_pack: that.is_pack,
  1199. custom_form: that.confirm,
  1200. gift_mark: that.gift_mark, // 礼物留言
  1201. real_name: that.contacts,
  1202. phone: that.contactsTel,
  1203. addressId: that.addressId,
  1204. formId: '',
  1205. couponId: that.couponId,
  1206. useIntegral: that.useIntegral,
  1207. bargainId: that.BargainId,
  1208. combinationId: that.combinationId,
  1209. discountId: that.discountId,
  1210. pinkId: that.pinkId,
  1211. advanceId: that.advanceId,
  1212. seckill_id: that.seckillId,
  1213. mark: that.mark,
  1214. store_id: that.system_store ? that.system_store.id : 0,
  1215. 'from': that.from,
  1216. shipping_type: that.$util.$h.Add(that.shippingType, 1),
  1217. 'new': that.news,
  1218. 'invoice_id': that.invChecked,
  1219. // #ifdef H5
  1220. quitUrl: location.protocol + '//' + location.hostname +
  1221. '/pages/goods/order_pay_status/index?' +
  1222. '&type=3' + '&totalPrice=' + this.totalPrice
  1223. // #endif
  1224. // #ifdef APP-PLUS
  1225. quitUrl: '/pages/goods/order_details/index?order_id=' + this.order_id
  1226. // #endif
  1227. };
  1228. if (that.is_gift) data.is_gift = that.is_gift
  1229. if (data.payType == 'yue' && parseFloat(that.userInfo.now_money) < parseFloat(that.totalPrice))
  1230. return that.$util.Tips({
  1231. title: that.$t(`余额不足`)
  1232. });
  1233. // uni.showLoading({
  1234. // title: that.$t(`订单支付中`)
  1235. // });
  1236. // #ifdef MP
  1237. openPaySubscribe().then(() => {
  1238. that.payment(data);
  1239. });
  1240. // #endif
  1241. // #ifndef MP
  1242. that.payment(data);
  1243. // #endif
  1244. },
  1245. receiveGift() {
  1246. let data = {
  1247. gift_key: this.giftData.gift_key,
  1248. shipping_type: this.$util.$h.Add(this.shippingType, 1),
  1249. name: this.contacts,
  1250. phone: this.contactsTel,
  1251. address_id: this.addressId,
  1252. store_id: this.system_store ? this.system_store.id : 0,
  1253. }
  1254. orderReceiveGift(this.orderId, data).then(res => {
  1255. uni.reLaunch({
  1256. url: `/pages/goods/receive_gifts_status/index?status=${res.data.status}&order_id=${this.giftData.order_id}`
  1257. })
  1258. }).catch(err => {
  1259. uni.showToast({
  1260. title: err.msg
  1261. })
  1262. })
  1263. },
  1264. bindDateChange: function(e, index) {
  1265. this.confirm[index].value = e.target.value
  1266. },
  1267. bindTimeChange: function(e, index) {
  1268. this.confirm[index].value = e.target.value
  1269. },
  1270. getDate(type) {
  1271. const date = new Date();
  1272. let year = date.getFullYear();
  1273. let month = date.getMonth() + 1;
  1274. let day = date.getDate();
  1275. if (type === 'start') {
  1276. year = year - 60;
  1277. } else if (type === 'end') {
  1278. year = year + 2;
  1279. }
  1280. month = month > 9 ? month : '0' + month;
  1281. day = day > 9 ? day : '0' + day;
  1282. return `${year}-${month}-${day}`;
  1283. },
  1284. uploadpic: function(index, item) {
  1285. let that = this;
  1286. this.canvasStatus = true
  1287. that.$util.uploadImageChange('upload/image', function(res) {
  1288. item.value.push(res.data.url);
  1289. }, (res) => {
  1290. this.canvasStatus = false
  1291. }, (res) => {
  1292. this.canvasWidth = res.w
  1293. this.canvasHeight = res.h
  1294. });
  1295. },
  1296. DelPic: function(index, indexs) {
  1297. let that = this,
  1298. pic = this.confirm[index].value;
  1299. that.confirm[index].value.splice(indexs, 1);
  1300. // that.$set(that, 'pics', that.pics);
  1301. },
  1302. inputTripClick() {
  1303. this.inputTrip = true
  1304. // this.$refs.trip.foucs()
  1305. },
  1306. showMaoLocation(e) {
  1307. let self = this;
  1308. // #ifdef H5
  1309. if (self.$wechat.isWeixin()) {
  1310. self.$wechat.seeLocation({
  1311. latitude: Number(e.latitude),
  1312. longitude: Number(e.longitude),
  1313. name: e.name,
  1314. scale: 13,
  1315. address: `${e.address}-${e.detailed_address}`,
  1316. }).then(res => {})
  1317. } else {
  1318. // #endif
  1319. uni.openLocation({
  1320. latitude: Number(e.latitude),
  1321. longitude: Number(e.longitude),
  1322. name: e.name,
  1323. address: `${e.address}-${e.detailed_address}`,
  1324. success: function() {
  1325. Number
  1326. }
  1327. });
  1328. // #ifdef H5
  1329. }
  1330. // #endif
  1331. },
  1332. call(phone) {
  1333. uni.makePhoneCall({
  1334. phoneNumber: phone,
  1335. });
  1336. },
  1337. }
  1338. }
  1339. </script>
  1340. <style lang="scss" scoped>
  1341. /deep/uni-checkbox[disabled] .uni-checkbox-input {
  1342. background-color: #eee;
  1343. }
  1344. .alipaysubmit {
  1345. display: none;
  1346. }
  1347. .order-submission {
  1348. /* #ifndef H5 */
  1349. padding-bottom: 70rpx;
  1350. /* #endif */
  1351. }
  1352. .order-submission .line {
  1353. width: 100%;
  1354. height: 3rpx;
  1355. }
  1356. .order-submission .line image {
  1357. width: 100%;
  1358. height: 100%;
  1359. display: block;
  1360. }
  1361. .order-submission .address {
  1362. padding: 28rpx 30rpx;
  1363. background-color: #fff;
  1364. box-sizing: border-box;
  1365. flex-wrap: nowrap;
  1366. .icon {
  1367. .iconfont {
  1368. width: 44rpx;
  1369. height: 44rpx;
  1370. background: var(--view-minorColorT);
  1371. font-size: 20rpx;
  1372. border-radius: 50%;
  1373. text-align: center;
  1374. line-height: 44rpx;
  1375. color: var(--view-theme);
  1376. margin-left: 26rpx;
  1377. }
  1378. }
  1379. }
  1380. .order-submission .address .addressCon {
  1381. max-width: 510rpx;
  1382. font-size: 26rpx;
  1383. color: #666;
  1384. }
  1385. .order-submission .address .addressCon .name {
  1386. font-size: 30rpx;
  1387. color: #282828;
  1388. font-weight: bold;
  1389. margin-bottom: 10rpx;
  1390. }
  1391. .order-submission .address .addressCon .name .phone {
  1392. margin-left: 50rpx;
  1393. }
  1394. .order-submission .address .addressCon .default {
  1395. margin-right: 12rpx;
  1396. }
  1397. .order-submission .address .addressCon .setaddress {
  1398. color: #333;
  1399. font-size: 28rpx;
  1400. }
  1401. .order-submission .address .iconfont {
  1402. font-size: 35rpx;
  1403. color: #707070;
  1404. }
  1405. .gift-box {
  1406. background: #FFFFFF;
  1407. margin: 20rpx 0;
  1408. .user-msg {
  1409. padding: 28rpx 30rpx;
  1410. }
  1411. image {
  1412. width: 36rpx;
  1413. height: 36rpx;
  1414. border-radius: 70rpx 70rpx 70rpx 70rpx;
  1415. border: 2rpx solid #FFFFFF;
  1416. }
  1417. .nickname {
  1418. font-weight: 400;
  1419. font-size: 28rpx;
  1420. color: #AE5A2A;
  1421. }
  1422. .gift-mark {
  1423. border-top: 1px solid #F0F0F0;
  1424. font-weight: 400;
  1425. font-size: 28rpx;
  1426. color: #333333;
  1427. padding: 28rpx 30rpx;
  1428. }
  1429. }
  1430. .receive-btn {
  1431. color: #fff;
  1432. text-align: center;
  1433. height: 84rpx;
  1434. line-height: 84rpx;
  1435. border-radius: 80rpx;
  1436. margin: 66rpx 40rpx;
  1437. background-color: var(--view-theme);
  1438. }
  1439. .gift-msg {
  1440. padding: 0rpx 30rpx 20rpx 30rpx;
  1441. background-color: #fff;
  1442. input {
  1443. font-size: 30rpx;
  1444. }
  1445. .placeholder {
  1446. font-size: 28rpx;
  1447. }
  1448. }
  1449. .order-submission .allAddress {
  1450. width: 100%;
  1451. background: linear-gradient(to bottom, var(--view-theme) 0%, #f5f5f5 100%);
  1452. padding-top: 100rpx;
  1453. margin-bottom: 12rpx;
  1454. .add-title {
  1455. height: 72rpx;
  1456. margin: 0 26rpx;
  1457. border-bottom: 1px solid #eee;
  1458. background-color: #fff;
  1459. width: 710rpx;
  1460. margin: 0 auto;
  1461. padding: 0 26rpx;
  1462. border-radius: 12rpx 12rpx 0 0;
  1463. .icon {
  1464. height: 32rpx;
  1465. background: #1890FF;
  1466. border-radius: 4rpx;
  1467. font-size: 20rpx;
  1468. font-weight: 400;
  1469. color: #FFFFFF;
  1470. text-align: center;
  1471. line-height: 32rpx;
  1472. padding: 0 6rpx;
  1473. &.orange {
  1474. background: #FE960F;
  1475. }
  1476. &.red {
  1477. background: #E93323;
  1478. }
  1479. }
  1480. .add-text {
  1481. margin-left: 14rpx;
  1482. width: 360rpx;
  1483. }
  1484. .text {
  1485. font-size: 24rpx;
  1486. font-weight: 400;
  1487. color: #999999;
  1488. .icon-jiantou {
  1489. display: inline-block;
  1490. font-size: 20rpx;
  1491. }
  1492. }
  1493. }
  1494. }
  1495. .order-submission .allAddress .nav {
  1496. width: 710rpx;
  1497. margin: 0 auto;
  1498. }
  1499. .order-submission .allAddress .nav .item {
  1500. width: 355rpx;
  1501. }
  1502. .order-submission .allAddress .nav .item.on {
  1503. position: relative;
  1504. width: 270rpx;
  1505. }
  1506. .order-submission .allAddress .nav .item.on .before {
  1507. position: absolute;
  1508. bottom: 0;
  1509. // content: "快递配送";
  1510. left: 0;
  1511. font-size: 28rpx;
  1512. display: block;
  1513. height: 0;
  1514. width: 356rpx;
  1515. border-width: 0 20rpx 80rpx 0;
  1516. border-style: none solid solid;
  1517. border-color: transparent transparent #fff;
  1518. z-index: 2;
  1519. border-radius: 7rpx 30rpx 0 0;
  1520. text-align: center;
  1521. line-height: 80rpx;
  1522. }
  1523. .order-submission .allAddress .nav .item:nth-of-type(2).on .before {
  1524. // content: "到店自提";
  1525. border-width: 0 0 80rpx 20rpx;
  1526. border-radius: 30rpx 7rpx 0 0;
  1527. }
  1528. .order-submission .allAddress .nav .item.on2 {
  1529. position: relative;
  1530. }
  1531. .order-submission .allAddress .nav .item.on2 .before {
  1532. position: absolute;
  1533. bottom: 0;
  1534. left: 0;
  1535. // content: "到店自提";
  1536. font-size: 28rpx;
  1537. display: block;
  1538. height: 0;
  1539. width: 440rpx;
  1540. border-width: 0 0 60rpx 60rpx;
  1541. border-style: none solid solid;
  1542. border-color: transparent transparent rgba(255, 255, 255, 0.6);
  1543. border-radius: 40rpx 6rpx 0 0;
  1544. text-align: center;
  1545. line-height: 60rpx;
  1546. }
  1547. .order-submission .allAddress .nav .item:nth-of-type(1).on2 .before {
  1548. // content: "快递配送";
  1549. border-width: 0 60rpx 60rpx 0;
  1550. border-radius: 6rpx 40rpx 0 0;
  1551. }
  1552. .order-submission .allAddress .address {
  1553. width: 710rpx;
  1554. height: 150rpx;
  1555. margin: 0 auto;
  1556. }
  1557. .order-submission .allAddress .line {
  1558. width: 710rpx;
  1559. margin: 0 auto;
  1560. }
  1561. .order-submission .wrapper .item .discount .placeholder {
  1562. color: #ccc;
  1563. }
  1564. .placeholder-textarea {
  1565. position: relative;
  1566. .placeholder {
  1567. position: absolute;
  1568. color: #ccc;
  1569. top: 26rpx;
  1570. left: 30rpx;
  1571. }
  1572. }
  1573. .order-submission .wrapper {
  1574. background-color: #fff;
  1575. margin-top: 13rpx;
  1576. }
  1577. .order-submission .wrapper .item {
  1578. padding: 27rpx 30rpx;
  1579. font-size: 30rpx;
  1580. color: #282828;
  1581. border-bottom: 1px solid #f0f0f0;
  1582. .mark {
  1583. background-color: #f9f9f9;
  1584. // width: 345px;
  1585. min-height: 70px;
  1586. border-radius: 1px;
  1587. margin-top: 15px;
  1588. padding: 12px 14px;
  1589. color: #ccc;
  1590. font-size: 28rpx;
  1591. box-sizing: border-box;
  1592. }
  1593. .mark-msg {
  1594. color: #333;
  1595. font-size: 28rpx;
  1596. }
  1597. }
  1598. .order-submission .wrapper .item .discount {
  1599. font-size: 30rpx;
  1600. color: #999;
  1601. }
  1602. .order-submission .wrapper .item .discount input {
  1603. text-align: end;
  1604. }
  1605. .order-submission .wrapper .item .discount .iconfont {
  1606. color: #515151;
  1607. font-size: 30rpx;
  1608. margin-left: 15rpx;
  1609. }
  1610. .order-submission .wrapper .item .discount .num {
  1611. font-size: 32rpx;
  1612. margin-right: 20rpx;
  1613. }
  1614. .order-submission .wrapper .item .shipping {
  1615. font-size: 30rpx;
  1616. color: #999;
  1617. position: relative;
  1618. padding-right: 58rpx;
  1619. }
  1620. .order-submission .wrapper .item .shipping .iconfont {
  1621. font-size: 35rpx;
  1622. color: #707070;
  1623. position: absolute;
  1624. right: 0;
  1625. top: 50%;
  1626. transform: translateY(-50%);
  1627. margin-left: 30rpx;
  1628. }
  1629. .order-submission .wrapper .item textarea {
  1630. background-color: #f9f9f9;
  1631. width: 100%;
  1632. height: 135rpx;
  1633. border-radius: 3rpx;
  1634. margin-top: 30rpx;
  1635. padding: 25rpx 28rpx;
  1636. font-size: 28rpx;
  1637. box-sizing: border-box;
  1638. }
  1639. .order-submission .wrapper .item .placeholder {
  1640. color: #ccc;
  1641. font-size: 28rpx;
  1642. }
  1643. .order-submission .wrapper .item .list {
  1644. margin-top: 35rpx;
  1645. }
  1646. .order-submission .wrapper .item .list .payItem {
  1647. border: 1px solid #eee;
  1648. border-radius: 6rpx;
  1649. height: 86rpx;
  1650. width: 100%;
  1651. box-sizing: border-box;
  1652. margin-top: 20rpx;
  1653. font-size: 28rpx;
  1654. color: #282828;
  1655. }
  1656. .order-submission .wrapper .item .list .payItem.on {
  1657. border-color: #fc5445;
  1658. color: #e93323;
  1659. }
  1660. .order-submission .wrapper .item .list .payItem .name {
  1661. width: 50%;
  1662. text-align: center;
  1663. border-right: 1px solid #eee;
  1664. padding-left: 80rpx;
  1665. }
  1666. .order-submission .wrapper .item .list .payItem .name .iconfont {
  1667. width: 44rpx;
  1668. height: 44rpx;
  1669. border-radius: 50%;
  1670. text-align: center;
  1671. line-height: 44rpx;
  1672. background-color: #fe960f;
  1673. color: #fff;
  1674. font-size: 30rpx;
  1675. margin-right: 15rpx;
  1676. }
  1677. .order-submission .wrapper .item .list .payItem .name .iconfont.icon-weixin2 {
  1678. background-color: #41b035;
  1679. }
  1680. .order-submission .wrapper .item .list .payItem .name .iconfont.icon-zhifubao {
  1681. background-color: #1677FF;
  1682. }
  1683. .order-submission .wrapper .item .list .payItem .tip {
  1684. width: 49%;
  1685. text-align: center;
  1686. font-size: 26rpx;
  1687. color: #aaa;
  1688. }
  1689. .order-submission .moneyList {
  1690. margin-top: 12rpx;
  1691. background-color: #fff;
  1692. padding: 30rpx;
  1693. }
  1694. .order-submission .moneyList .item {
  1695. font-size: 28rpx;
  1696. color: #282828;
  1697. }
  1698. .order-submission .moneyList .item~.item {
  1699. margin-top: 20rpx;
  1700. }
  1701. .order-submission .moneyList .item .money {
  1702. color: #868686;
  1703. }
  1704. .order-submission .footer {
  1705. width: 100%;
  1706. background-color: #fff;
  1707. font-size: 28rpx;
  1708. color: #333;
  1709. box-sizing: border-box;
  1710. position: fixed;
  1711. left: 0;
  1712. bottom: 0;
  1713. padding: 15rpx 30rpx;
  1714. padding-bottom: calc(15rpx + constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  1715. padding-bottom: calc(15rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  1716. z-index: 9;
  1717. }
  1718. .order-submission .footer .settlement {
  1719. font-size: 30rpx;
  1720. color: #fff;
  1721. width: 240rpx;
  1722. height: 70rpx;
  1723. background-color: var(--view-theme);
  1724. border-radius: 50rpx;
  1725. text-align: center;
  1726. line-height: 70rpx;
  1727. }
  1728. .footer .transparent {
  1729. opacity: 0
  1730. }
  1731. .confirm {
  1732. text-align: right;
  1733. font-size: 22rpx;
  1734. }
  1735. .confirmImg {
  1736. width: 100%;
  1737. .img {
  1738. width: 136rpx;
  1739. height: 136rpx;
  1740. }
  1741. .pictrue {
  1742. width: 136rpx;
  1743. height: 136rpx;
  1744. box-sizing: border-box;
  1745. margin: 18rpx;
  1746. margin-bottom: 35rpx;
  1747. position: relative;
  1748. font-size: 22rpx;
  1749. color: #bbb;
  1750. .del {
  1751. position: absolute;
  1752. top: 0;
  1753. right: 0;
  1754. }
  1755. }
  1756. .bor {
  1757. border: 1rpx solid #ddd;
  1758. }
  1759. }
  1760. .fontC {
  1761. color: grey;
  1762. }
  1763. </style>