index.vue 47 KB

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