123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860 |
- <template>
- <view :style="colorStyle">
- <view class='order-submission'>
- <view class="allAddress" :style="store_self_mention && is_shipping ? '':'padding-top:10rpx'"
- v-if="!virtual_type">
- <view class="nav acea-row">
- <view class="item font-num" :class="shippingType == 0 ? 'on' : 'on2'" @tap="addressType(0)"
- v-if='store_self_mention && is_shipping'></view>
- <view class="item font-num" :class="shippingType == 1 ? 'on' : 'on2'" @tap="addressType(1)"
- v-if='store_self_mention && is_shipping'></view>
- </view>
- <view class='address acea-row row-between-wrapper' @tap='onAddress' v-if='shippingType == 0'>
- <view class='addressCon' v-if="addressInfo.real_name">
- <view class='name'>{{addressInfo.real_name}}
- <text class='phone'>{{addressInfo.phone}}</text>
- </view>
- <view class="line1">
- <text class='default font-num'
- v-if="addressInfo.is_default">[{{$t(`默认`)}}]</text>{{addressInfo.province}}{{addressInfo.city}}{{addressInfo.district}}{{addressInfo.detail}}
- </view>
- <!-- <view class='setaddress'>设置收货地址</view> -->
- </view>
- <view class='addressCon' v-else>
- <view class='setaddress'>{{$t(`设置收货地址`)}}</view>
- </view>
- <view class='iconfont icon-jiantou'></view>
- </view>
- <view class='address acea-row row-between-wrapper' v-else @tap="showStoreList">
- <block v-if="storeList.length>0">
- <view class='addressCon'>
- <view class='name'>{{system_store.name}}
- <text class='phone'>{{system_store.phone}}</text>
- </view>
- <view class="line1"> {{system_store.address}}{{", " + system_store.detailed_address}}</view>
- </view>
- <view class='iconfont icon-jiantou'></view>
- </block>
- <block v-else>
- <view>{{$t(`暂无门店信息`)}}</view>
- </block>
- </view>
- <view class='line'>
- <image src='/static/images/line.jpg'></image>
- </view>
- </view>
- <orderGoods :cartInfo="cartInfo" :is_confirm='true' :shipping_type="shippingType"></orderGoods>
- <view class='wrapper'>
- <view class='item acea-row row-between-wrapper' @tap='couponTap'
- v-if="!pinkId && !BargainId && !combinationId && !seckillId&& !noCoupon && !discountId && !advanceId">
- <view>{{$t(`优惠券`)}}</view>
- <view class='discount'>
- {{couponTitle}}
- <text class='iconfont icon-jiantou'></text>
- </view>
- </view>
- <view class='item acea-row row-between-wrapper'
- v-if="!pinkId && !BargainId && !combinationId && !seckillId && !advanceId && integral_open">
- <view>{{$t(`积分抵扣`)}}</view>
- <view class='discount acea-row row-middle'>
- <view> {{useIntegral ? $t(`剩余积分`):$t(`当前积分`)}}
- <text class='num font-color'>{{integral || 0}}</text>
- </view>
- <checkbox-group @change="ChangeIntegral">
- <checkbox :disabled="integral<=0 && !useIntegral" :checked='useIntegral ? true : false' />
- </checkbox-group>
- </view>
- </view>
- <view v-if="invoice_func || special_invoice" class='item acea-row row-between-wrapper' @tap="goInvoice">
- <view>{{$t(`开具发票`)}}</view>
- <view class='discount'>
- {{invTitle}}
- <text class='iconfont icon-jiantou'></text>
- </view>
- </view>
- <view v-if="shippingType == 1">
- <view class="item acea-row row-between-wrapper">
- <view>{{$t(`用户姓名`)}}</view>
- <view class="discount">
- <input style="text-align: right;" v-model="contacts" type="text" :placeholder="$t(`请输入姓名`)"
- placeholder-class="placeholder"></input>
- </view>
- </view>
- <view class="item acea-row row-between-wrapper">
- <view>{{$t(`联系电话`)}}</view>
- <view class="discount">
- <input style="text-align: right;" v-model="contactsTel" type="text"
- :placeholder="$t(`请输入手机号`)" placeholder-class="placeholder"></input>
- </view>
- </view>
- </view>
- <view class='item' v-if="textareaStatus">
- <view>{{$t(`备注说明`)}}</view>
- <view class="mark" v-if="!coupon.coupon && !inputTrip" @click="inputTripClick">
- <view :class="{'mark-msg': mark}" v-text="mark || $t(`填写备注信息,100字以内`)"></view>
- </view>
- <textarea placeholder-class='placeholder' :placeholder="$t(`填写备注信息,100字以内`)"
- v-if="!coupon.coupon && inputTrip" @input='bindHideKeyboard' :focus="focus"
- @blur="inputTrip = false" :value="mark" :maxlength="150" name="mark">
- </textarea>
- </view>
- </view>
- <view class='wrapper' v-if="confirm.length">
- <view class='item acea-row row-between-wrapper' v-for="(item,index) in confirm" :key="index">
- <view>
- <span v-if="item.status" style="color: red;">*</span>
- <span v-else style="marginLeft: 8px;"></span>
- {{ item.title }}
- </view>
- <!-- text -->
- <view v-if="item.label=='text'" class="confirm">
- <input type="text" :placeholder="$t(`请填写`)+' '+item.title" v-model="item.value" />
- </view>
- <!-- number -->
- <view v-if="item.label=='number'" class="confirm">
- <input type="number" :placeholder="$t(`请填写`)+item.title" v-model="item.value" />
- </view>
- <!-- email -->
- <view v-if="item.label=='email'" class="confirm">
- <input type="text" :placeholder="$t(`请填写`)+item.title" v-model="item.value" />
- </view>
- <!-- data -->
- <view v-if="item.label=='data'" class="uni-list">
- <view class="uni-list-cell">
- <view class="uni-list-cell-db">
- <picker mode="date" :value="item.value" @change="bindDateChange($event,index)">
- <view v-if="item.value == ''" class="fontC">{{date+item.title}}<text
- class='iconfont icon-jiantou'></text></view>
- <view v-else class="uni-input">{{item.value}}</view>
- </picker>
- </view>
- </view>
- </view>
- <!-- time -->
- <view v-if="item.label=='time'">
- <view>
- <view>
- <picker mode="time" :value="item.value" start="00:00" end="23:59"
- @change="bindTimeChange($event,index)">
- <view v-if="item.value == ''" class="fontC">{{time+item.title}}<text
- class='iconfont icon-jiantou'></text></view>
- <view>{{item.value}}</view>
- </picker>
- </view>
- </view>
- </view>
- <!-- id -->
- <view v-if="item.label=='id'" class="confirm">
- <input type="idcard" :placeholder="$t(`请填写`)+item.title" v-model="item.value" />
- </view>
- <!-- phone -->
- <view v-if="item.label=='phone'" class="confirm">
- <input type="tel" :placeholder="$t(`请填写`)+item.title" v-model="item.value" />
- </view>
- <!-- img -->
- <view v-if="item.label=='img'" class="confirmImg">
- <view class='list acea-row row-middle'>
- <view class='pictrue' v-for="(items,indexs) in item.value" :key="indexs">
- <image :src='items' class="img"></image>
- <text class='iconfont icon-guanbi1 font-num del' @click='DelPic(index,indexs)'></text>
- </view>
- <view class='pictrue acea-row row-center-wrapper row-column bor'
- @click='uploadpic(index,item)' v-if="item.value.length < 8">
- <text class='iconfont icon-icon25201'></text>
- <view>{{$t(`上传图片`)}}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class='moneyList'>
- <view class='item acea-row row-between-wrapper'>
- <view>{{$t(`商品总价`)}}:</view>
- <view class='money'>
- {{$t(`¥`)}}{{(parseFloat(priceGroup.totalPrice)+parseFloat(priceGroup.vipPrice)).toFixed(2)}}
- </view>
- </view>
- <view class='item acea-row row-between-wrapper'
- v-if="priceGroup.storePostage > 0 || priceGroup.storePostageDiscount > 0">
- <view>{{$t(`配送运费`)}}:</view>
- <view class='money'>
- {{$t(`¥`)}}{{(parseFloat(priceGroup.storePostage)+parseFloat(priceGroup.storePostageDiscount)).toFixed(2)}}
- </view>
- </view>
- <view class='item acea-row row-between-wrapper'
- v-if="priceGroup.levelPrice > 0 && userInfo.vip && !pinkId && !BargainId && !combinationId && !seckillId && !discountId">
- <view>{{$t(`用户等级优惠`)}}:</view>
- <view class='money'>-{{$t(`¥`)}}{{parseFloat(priceGroup.levelPrice).toFixed(2)}}</view>
- </view>
- <view class='item acea-row row-between-wrapper'
- v-if="priceGroup.memberPrice > 0 && userInfo.vip && !pinkId && !BargainId && !combinationId && !seckillId && !discountId">
- <view>{{$t(`付费会员优惠`)}}:</view>
- <view class='money'>-{{$t(`¥`)}}{{parseFloat(priceGroup.memberPrice).toFixed(2)}}</view>
- </view>
- <view class='item acea-row row-between-wrapper' v-if="priceGroup.storePostageDiscount > 0">
- <view>{{$t(`会员运费优惠`)}}:</view>
- <view class='money'>-{{$t(`¥`)}}{{parseFloat(priceGroup.storePostageDiscount).toFixed(2)}}</view>
- </view>
- <view class='item acea-row row-between-wrapper' v-if="coupon_price > 0">
- <view>{{$t(`优惠券抵扣`)}}:</view>
- <view class='money'>-{{$t(`¥`)}}{{parseFloat(coupon_price).toFixed(2)}}</view>
- </view>
- <view class='item acea-row row-between-wrapper' v-if="integral_price > 0">
- <view>{{$t(`积分抵扣`)}}:</view>
- <view class='money'>-{{$t(`¥`)}}{{parseFloat(integral_price).toFixed(2)}}</view>
- </view>
- </view>
- <view style='height:120rpx;'></view>
- <view class='footer acea-row row-between-wrapper'>
- <view>{{$t(`合计`)}}:
- <text class='font-color'>{{$t(`¥`)}}{{totalPrice || 0}}</text>
- </view>
- <view class='settlement' style='z-index:100' @tap.stop="goPay"
- v-if="(valid_count>0&&!discount_id) || (valid_count==cartInfo.length&&discount_id)">{{$t(`立即支付`)}}
- </view>
- <view class='settlement bg-color-hui' style='z-index:100' v-else>{{$t(`立即支付`)}}</view>
- </view>
- </view>
- <view class="alipaysubmit" v-html="formContent"></view>
- <couponListWindow :coupon='coupon' @ChangCouponsClone="ChangCouponsClone" :openType='openType' :cartId='cartId'
- @ChangCoupons="ChangCoupons"></couponListWindow>
- <addressWindow ref="addressWindow" @changeTextareaStatus="changeTextareaStatus" :news='news' :address='address'
- :pagesUrl="pagesUrl" @OnChangeAddress="OnChangeAddress" @changeClose="changeClose"></addressWindow>
- <!-- #ifdef MP -->
- <!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
- <!-- #endif -->
- <home v-show="!invShow"></home>
- <invoice-picker :inv-show="invShow" :inv-list="invList" :inv-checked="invChecked" :is-special="special_invoice"
- :url-query="urlQuery" @inv-close="invClose" @inv-change="invChange" @inv-cancel="invCancel">
- </invoice-picker>
- <payment :payMode="cartArr" :pay_close="pay_close" :isCall="true" :totalPrice="totalPrice.toString()"
- @changePayType="changePayType" @onChangeFun="onChangeFun"></payment>
- <canvas canvas-id="canvas" v-if="canvasStatus"
- :style="{width: canvasWidth + 'px', height: canvasHeight + 'px',position: 'absolute',left:'-100000px',top:'-100000px'}"></canvas>
- </view>
- </template>
- <script>
- import {
- orderConfirm,
- getCouponsOrderPrice,
- orderCreate,
- postOrderComputed,
- checkShipping
- } from '@/api/order.js';
- import {
- getAddressDefault,
- getAddressDetail,
- invoiceList,
- invoiceOrder
- } from '@/api/user.js';
- import {
- openPaySubscribe
- } from '@/utils/SubscribeMessage.js';
- import {
- storeListApi
- } from '@/api/store.js';
- import {
- CACHE_LONGITUDE,
- CACHE_LATITUDE
- } from '@/config/cache.js';
- import couponListWindow from '@/components/couponListWindow';
- import addressWindow from '@/components/addressWindow';
- import orderGoods from '@/components/orderGoods';
- import home from '@/components/home';
- import invoicePicker from '../components/invoicePicker/index.vue';
- import {
- toLogin
- } from '@/libs/login.js';
- import {
- mapGetters
- } from "vuex";
- // #ifdef MP
- import authorize from '@/components/Authorize';
- // #endif
- import payment from '@/components/payment';
- import colors from "@/mixins/color";
- export default {
- components: {
- payment,
- invoicePicker,
- couponListWindow,
- addressWindow,
- orderGoods,
- home,
- // #ifdef MP
- authorize
- // #endif
- },
- mixins: [colors],
- data() {
- const currentDate = this.getDate({
- format: true
- })
- return {
- confirm: '', //自定义留言
- date: this.$t(`请选择`),
- time: this.$t(`请选择`),
- canvasWidth: "",
- canvasHeight: "",
- canvasStatus: false,
- newImg: [],
- textareaStatus: true,
- //支付方式
- cartArr: [{
- "name": this.$t(`微信支付`),
- "icon": "icon-weixin2",
- value: 'weixin',
- title: this.$t(`使用微信快捷支付`),
- payStatus: 1,
- },
- {
- "name": this.$t(`支付宝支付`),
- "icon": "icon-zhifubao",
- value: 'alipay',
- title: this.$t(`使用支付宝支付`),
- payStatus: 1,
- },
- {
- "name": this.$t(`余额支付`),
- "icon": "icon-yuezhifu",
- value: 'yue',
- title: this.$t(`可用余额`),
- payStatus: 1,
- },
- {
- "name": this.$t(`线下支付`),
- "icon": "icon-yuezhifu1",
- value: 'offline',
- title: this.$t(`使用线下付款`),
- payStatus: 2,
- }, {
- "name": this.$t(`好友代付`),
- "icon": "icon-haoyoudaizhifu",
- value: 'friend',
- title: this.$t(`找微信好友支付`),
- payStatus: 1,
- },
- ],
- virtual_type: 0,
- formContent: '',
- payType: 'weixin', //支付方式
- openType: 1, //优惠券打开方式 1=使用
- active: 0, //支付方式切换
- coupon: {
- coupon: false,
- list: [],
- statusTile: this.$t(`立即使用`)
- }, //优惠券组件
- address: {
- address: false
- }, //地址组件
- addressInfo: {}, //地址信息
- pinkId: 0, //拼团id
- addressId: 0, //地址id
- couponId: 0, //优惠券id
- cartId: '', //购物车id
- BargainId: 0,
- combinationId: 0,
- seckillId: 0,
- discountId: 0,
- userInfo: {}, //用户信息
- mark: '', //备注信息
- couponTitle: this.$t(`请选择`), //优惠券
- coupon_price: 0, //优惠券抵扣金额
- useIntegral: false, //是否使用积分
- integral_price: 0, //积分抵扣金额
- integral: 0,
- usable_integral: 0,
- ChangePrice: 0, //使用积分抵扣变动后的金额
- formIds: [], //收集formid
- status: 0,
- is_address: false,
- toPay: false, //修复进入支付时页面隐藏从新刷新页面
- shippingType: 0,
- system_store: {},
- storePostage: 0,
- advanceId: 0,
- contacts: '',
- contactsTel: '',
- mydata: {},
- storeList: [],
- store_self_mention: 0,
- cartInfo: [],
- priceGroup: {},
- animated: false,
- totalPrice: 0,
- integralRatio: "0",
- pagesUrl: "",
- orderKey: "",
- // usableCoupon: {},
- offlinePostage: "",
- isAuto: false, //没有授权的不会自动授权
- isShowAuth: false, //是否隐藏授权
- from: '',
- news: 1,
- // invTitle: '不开发票',
- invTitle: this.$t(`不开发票`),
- special_invoice: false,
- invoice_func: false,
- header_type: '',
- invShow: false,
- invList: [],
- invChecked: '',
- urlQuery: '',
- pay_close: false,
- noCoupon: 0,
- valid_count: 0,
- discount_id: 0,
- is_shipping: true,
- inputTrip: false,
- focus: true,
- integral_open: false,
- jumpData: {}
- };
- },
- computed: mapGetters(['isLogin']),
- // watch: {
- // startDate() {
- // return this.getDate('start');
- // },
- // endDate() {
- // return this.getDate('end');
- // }
- // },
- onLoad(options) {
- // #ifdef H5
- this.from = this.$wechat.isWeixin() ? 'weixin' : 'weixinh5'
- // #endif
- // #ifdef MP
- this.from = 'routine'
- // #endif
- // #ifdef APP-PLUS
- this.from = 'app'
- // #endif
- if (!options.cartId) return this.$util.Tips({
- title: this.$t(`请选择要购买的商品`)
- }, {
- tab: 3,
- url: 1
- });
- this.couponId = options.couponId || 0;
- this.noCoupon = Number(options.noCoupon) || 0;
- this.pinkId = options.pinkId ? parseInt(options.pinkId) : 0;
- this.addressId = options.addressId || 0;
- this.cartId = options.cartId;
- this.is_address = options.is_address ? true : false;
- this.news = !options.new || options.new === '0' ? 0 : 1;
- this.invChecked = options.invoice_id || '';
- this.header_type = options.header_type || '1';
- this.couponTitle = options.couponTitle || this.$t(`请选择`)
- switch (options.invoice_type) {
- case '1':
- this.invTitle = this.$t(`电子普通发票`);
- break;
- case '2':
- this.invTitle = this.$t(`电子专用发票`);
- break;
- }
- // #ifndef APP-PLUS
- this.textareaStatus = true;
- // #endif
- if (this.isLogin && this.toPay == false) {
- this.checkShipping();
- // this.getaddressInfo();
- // this.getConfirm();
- // this.$nextTick(function() {
- // this.$refs.addressWindow.getAddressList();
- // })
- } else {
- toLogin();
- }
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function() {
- let _this = this
- let options = wx.getEnterOptionsSync();
- if (options.scene == '1038' && options.referrerInfo.appId == 'wxef277996acc166c3' && this.initIn) {
- // 代表从收银台小程序返回
- let extraData = options.referrerInfo.extraData;
- this.initIn = false
- if (!extraData) {
- // "当前通过物理按键返回,未接收到返参,建议自行查询交易结果";
- this.$util.Tips({
- title: this.$t(`取消支付`)
- }, {
- tab: 5,
- url: `/pages/goods/order_pay_status/index?order_id=${this.jumpData.orderId}&msg=${this.$t(`取消支付`)}&type=3&totalPrice=${this.totalPrice}&status=2`
- });
- } else {
- if (extraData.code == 'success') {
- this.$util.Tips({
- title: this.$t(`支付成功`),
- icon: 'success'
- }, {
- tab: 5,
- url: `/pages/goods/order_pay_status/index?order_id=${this.jumpData.orderId}&msg=${this.jumpData.msg}&type=3&totalPrice=${this.totalPrice}`
- });
- } else if (extraData.code == 'cancel') {
- // "支付已取消";
- this.$util.Tips({
- title: this.$t(`取消支付`)
- }, {
- tab: 5,
- url: `/pages/goods/order_pay_status/index?order_id=${this.jumpData.orderId}&msg=${this.$t(`取消支付`)}&type=3&totalPrice=${this.totalPrice}&status=2`
- });
- } else {
- // "支付失败:" + extraData.errmsg;
- uni.reLaunch({
- url: `/pages/goods/order_pay_status/index?order_id=${this.jumpData.orderId}&msg=${this.$t(`支付失败`)}&totalPrice=${this.totalPrice}`
- })
- }
- }
- }
- uni.$on("handClick", res => {
- if (res) {
- _this.system_store = res.address
- }
- // 清除监听
- uni.$off('handClick');
- })
- },
- methods: {
- checkShipping() {
- let that = this;
- checkShipping(that.cartId, that.news).then(res => {
- if (res.data.type == 0) {
- that.is_shipping = true;
- that.shippingType = 0;
- this.getaddressInfo();
- this.getConfirm();
- this.$nextTick(function() {
- this.$refs.addressWindow.getAddressList();
- })
- } else {
- if (res.data.type == 1) {
- that.is_shipping = false;
- that.shippingType = 0;
- this.getaddressInfo();
- this.getConfirm();
- this.$nextTick(function() {
- this.$refs.addressWindow.getAddressList();
- })
- } else if (res.data.type == 2) {
- that.is_shipping = false;
- that.shippingType = 1;
- this.getConfirm();
- this.getList();
- }
- }
- }).catch(err => {
- uni.showToast({
- title: err,
- icon: 'none'
- });
- });
- },
- // 不开发票
- invCancel() {
- this.invChecked = '';
- this.invTitle = this.$t(`不开发票`)
- this.invShow = false;
- },
- // 选择发票
- invChange(id) {
- this.invChecked = id;
- this.invShow = false;
- const result = this.invList.find(item => item.id === id);
- let name = '';
- name += result.header_type === 1 ? this.$t(`个人`) : this.$t(`企业`);
- name += result.type === 1 ? this.$t(`普通`) : this.$t(`专用`);
- name += this.$t(`发票`);
- this.invTitle = name;
- },
- // 关闭发票
- invClose() {
- this.invShow = false;
- this.getInvoiceList()
- },
- getInvoiceList() {
- uni.showLoading({
- title: this.$t(`正在加载中`)
- })
- invoiceList().then(res => {
- uni.hideLoading();
- this.invList = res.data.map(item => {
- item.id = item.id.toString();
- return item;
- });
- const result = this.invList.find(item => item.id == this.invChecked);
- if (result) {
- let name = '';
- name += result.header_type === 1 ? this.$t(`个人`) : this.$t(`企业`);
- name += result.type === 1 ? this.$t(`普通`) : this.$t(`专用`);
- name += this.$t(`发票`);
- this.invTitle = name;
- }
- }).catch(err => {
- uni.showToast({
- title: err,
- icon: 'none'
- });
- });
- },
- /**
- * 开发票
- */
- goInvoice: function() {
- this.getInvoiceList()
- this.invShow = true;
- this.urlQuery =
- `new=${this.news}&cartId=${this.cartId}&pinkId=${this.pinkId}&couponId=${this.couponId}&addressId=${this.addressId}&specialInvoice=${this.special_invoice}&couponTitle=${this.couponTitle}`;
- },
- /**
- * 授权回调事件
- *
- */
- onLoadFun: function() {
- this.getaddressInfo();
- this.getConfirm();
- //调用子页面方法授权后执行获取地址列表
- // this.$scope.selectComponent('#address-window').getAddressList();
- },
- /**
- * 事件回调
- *
- */
- onChangeFun: function(e) {
- let opt = e;
- let action = opt.action || null;
- let value = opt.value != undefined ? opt.value : null;
- action && this[action] && this[action](value);
- },
- payClose: function() {
- this.pay_close = false;
- },
- goPay() {
- this.pay_close = true;
- },
- payCheck(type) {
- this.payType = type;
- this.SubOrder();
- },
- /**
- * 获取门店列表数据
- */
- getList: function() {
- let longitude = uni.getStorageSync("user_longitude"); //经度
- let latitude = uni.getStorageSync("user_latitude"); //纬度
- let data = {
- latitude: latitude, //纬度
- longitude: longitude, //经度
- page: 1,
- limit: 10
- }
- storeListApi(data).then(res => {
- let list = res.data.list.list || [];
- this.$set(this, 'storeList', list);
- this.$set(this, 'system_store', list[0]);
- }).catch(err => {})
- },
- // 关闭地址弹窗;
- changeClose: function() {
- this.$set(this.address, 'address', false);
- },
- /*
- * 跳转门店列表
- */
- showStoreList: function() {
- let _this = this
- if (this.storeList.length > 0) {
- uni.navigateTo({
- url: '/pages/goods/goods_details_store/index'
- })
- }
- },
- changePayType(type) {
- this.payType = type
- this.computedPrice()
- },
- computedPrice: function() {
- let shippingType = this.shippingType;
- postOrderComputed(this.orderKey, {
- addressId: this.addressId,
- useIntegral: this.useIntegral ? 1 : 0,
- couponId: this.couponId,
- shipping_type: parseInt(shippingType) + 1,
- payType: this.payType
- }).then(res => {
- let result = res.data.result;
- if (result) {
- this.totalPrice = result.pay_price;
- this.integral_price = result.deduction_price;
- this.coupon_price = result.coupon_price;
- this.integral = this.useIntegral ? result.SurplusIntegral : this.usable_integral;
- this.$set(this.priceGroup, 'storePostage', shippingType == 1 ? 0 : result.pay_postage);
- this.$set(this.priceGroup, 'storePostageDiscount', result.storePostageDiscount);
- }
- })
- },
- addressType(e) {
- let index = e;
- let that = this;
- if (this.shippingType == parseInt(index)) return
- this.shippingType = parseInt(index);
- if (index == 1) {
- // #ifdef H5
- if (that.$wechat.isWeixin()) {
- that.$wechat.location().then(res => {
- uni.setStorageSync('user_latitude', res.latitude);
- uni.setStorageSync('user_longitude', res.longitude);
- this.getList()
- }).catch(err => {
- this.getList()
- })
- } else {
- // #endif
- uni.getLocation({
- type: 'wgs84',
- success: (res) => {
- uni.setStorageSync('user_latitude', res.latitude);
- uni.setStorageSync('user_longitude', res.longitude);
- this.getList()
- },
- complete: () => {
- this.getList()
- }
- });
- // #ifdef H5
- }
- // #endif
- };
- this.$nextTick(e => {
- this.getConfirm();
- this.computedPrice();
- })
- },
- bindPickerChange: function(e) {
- let value = e.detail.value;
- this.shippingType = value;
- this.computedPrice();
- },
- ChangCouponsClone: function() {
- this.$set(this.coupon, 'coupon', false);
- },
- changeTextareaStatus: function() {
- for (let i = 0, len = this.coupon.list.length; i < len; i++) {
- this.coupon.list[i].use_title = '';
- this.coupon.list[i].is_use = 0;
- }
- this.textareaStatus = true;
- this.status = 0;
- this.$set(this.coupon, 'list', this.coupon.list);
- },
- /**
- * 处理点击优惠券后的事件
- *
- */
- ChangCoupons: function(e) {
- // this.usableCoupon = e
- // this.coupon.coupon = false
- let index = e,
- list = this.coupon.list,
- couponTitle = this.$t(`请选择`),
- couponId = 0;
- for (let i = 0, len = list.length; i < len; i++) {
- if (i != index) {
- list[i].use_title = '';
- list[i].is_use = 0;
- }
- }
- if (list[index].is_use) {
- //不使用优惠券
- list[index].use_title = '';
- list[index].is_use = 0;
- } else {
- //使用优惠券
- list[index].use_title = this.$t(`不使用`);
- list[index].is_use = 1;
- couponTitle = list[index].coupon_title;
- couponId = list[index].id;
- }
- this.couponTitle = couponTitle;
- this.couponId = couponId;
- this.$set(this.coupon, 'coupon', false);
- this.$set(this.coupon, 'list', list);
- this.computedPrice();
- },
- /**
- * 使用积分抵扣
- */
- ChangeIntegral: function() {
- this.useIntegral = !this.useIntegral;
- this.computedPrice();
- },
- /**
- * 选择地址后改变事件
- * @param object e
- */
- OnChangeAddress: function(e) {
- this.textareaStatus = true;
- this.addressId = e;
- this.address.address = false;
- this.getConfirm()
- this.getaddressInfo();
- this.computedPrice();
- },
- bindHideKeyboard: function(e) {
- this.mark = e.detail.value;
- },
- /**
- * 获取当前订单详细信息
- *
- */
- getConfirm: function() {
- let that = this;
- // return;
- uni.showLoading({
- title: that.$t(`正在加载中`),
- mask: true
- });
- orderConfirm(that.cartId, that.news, that.addressId, that.shippingType + 1).then(res => {
- that.$set(that, 'userInfo', res.data.userInfo);
- that.$set(that, 'confirm', res.data.custom_form || []);
- this.confirm.map(e => {
- if (e.label === 'img') e.value = []
- })
- that.$set(that, 'integral', res.data.usable_integral);
- that.$set(that, 'usable_integral', res.data.usable_integral);
- that.$set(that, 'contacts', res.data.userInfo.real_name);
- that.$set(that, 'contactsTel', res.data.userInfo.record_phone === '0' ? '' : res.data
- .userInfo.record_phone);
- that.$set(that, 'cartInfo', res.data.cartInfo);
- that.$set(that, 'integralRatio', res.data.integralRatio);
- that.$set(that, 'offlinePostage', res.data.offlinePostage);
- that.$set(that, 'orderKey', res.data.orderKey);
- that.$set(that, 'valid_count', res.data.valid_count);
- that.$set(that, 'discount_id', res.data.discount_id)
- that.$set(that, 'priceGroup', res.data.priceGroup);
- that.$set(that, 'totalPrice', that.$util.$h.Add(parseFloat(res.data.priceGroup.totalPrice),
- parseFloat(res.data
- .priceGroup.storePostage)));
- that.$set(that, 'seckillId', parseInt(res.data.seckill_id));
- that.$set(that, 'invoice_func', res.data.invoice_func);
- that.$set(that, 'special_invoice', res.data.special_invoice);
- that.$set(that, 'store_self_mention', res.data.store_self_mention);
- that.$set(that, 'virtual_type', res.data.virtual_type || 0);
- that.$set(that, 'integral_open', res.data.integral_open);
- uni.hideLoading()
- //微信支付是否开启
- that.cartArr[0].payStatus = res.data.pay_weixin_open || 0
- //支付宝是否开启
- that.cartArr[1].payStatus = res.data.ali_pay_status || 0;
- //#ifdef MP
- that.cartArr[1].payStatus = 0;
- //#endif
- //余额支付是否开启
- // that.cartArr[2].title = '可用余额:' + res.data.userInfo.now_money;
- that.cartArr[2].number = res.data.userInfo.now_money;
- that.cartArr[2].payStatus = res.data.yue_pay_status == 1 ? res.data.yue_pay_status : 0
- if (res.data.offline_pay_status == 2 || res.data.deduction) {
- that.cartArr[3].payStatus = 0
- } else {
- that.cartArr[3].payStatus = 1
- }
- //好友代付是否开启
- that.cartArr[4].payStatus = res.data.friend_pay_status || 0;
- // that.$set(that, 'cartArr', that.cartArr);
- that.$set(that, 'ChangePrice', that.totalPrice);
- that.getBargainId();
- that.getCouponList();
- if (this.addressId) {
- this.computedPrice();
- }
- }).catch(err => {
- uni.hideLoading()
- return this.$util.Tips({
- title: err
- });
- });
- },
- /*
- * 提取砍价和拼团id
- */
- getBargainId: function() {
- let that = this;
- let cartINfo = that.cartInfo;
- let BargainId = 0;
- let combinationId = 0;
- let discountId = 0;
- let advanceId = 0;
- cartINfo.forEach(function(value, index, cartINfo) {
- BargainId = cartINfo[index].bargain_id,
- combinationId = cartINfo[index].combination_id,
- discountId = cartINfo[index].discount_id,
- advanceId = cartINfo[index].advance_id
- })
- that.$set(that, 'BargainId', parseInt(BargainId));
- that.$set(that, 'combinationId', parseInt(combinationId));
- that.$set(that, 'discountId', parseInt(discountId));
- that.$set(that, 'advanceId', parseInt(advanceId));
- if (that.cartArr.length == 3 && (BargainId || combinationId || that.seckillId || discountId)) {
- that.cartArr[2].payStatus = 0;
- that.$set(that, 'cartArr', that.cartArr);
- }
- },
- /**
- * 获取当前金额可用优惠券
- *
- */
- getCouponList: function() {
- let shippingType = this.shippingType;
- let that = this;
- let data = {
- cartId: this.cartId,
- 'new': this.news,
- 'shippingType': parseInt(shippingType) + 1
- }
- getCouponsOrderPrice(this.totalPrice, data).then(res => {
- that.$set(that.coupon, 'list', res.data);
- that.openType = 1;
- });
- },
- /*
- * 获取默认收货地址或者获取某条地址信息
- */
- getaddressInfo: function() {
- let that = this;
- if (that.addressId) {
- getAddressDetail(that.addressId).then(res => {
- res.data.is_default = parseInt(res.data.is_default);
- that.addressInfo = res.data || {};
- that.addressId = res.data.id || 0;
- that.address.addressId = res.data.id || 0;
- })
- } else {
- getAddressDefault().then(res => {
- res.data.is_default = parseInt(res.data.is_default);
- that.addressInfo = res.data || {};
- that.addressId = res.data.id || 0;
- that.address.addressId = res.data.id || 0;
- })
- }
- },
- payItem: function(e) {
- let that = this;
- let active = e;
- that.active = active;
- that.animated = true;
- that.payType = that.cartArr[active].value;
- that.computedPrice();
- setTimeout(function() {
- that.car();
- }, 500);
- },
- couponTap: function() {
- this.coupon.coupon = true;
- this.coupon.list.forEach((item, index) => {
- if (item.id == this.couponId) {
- item.is_use = 1
- } else {
- item.is_use = 0
- }
- })
- this.$set(this.coupon, 'list', this.coupon.list);
- },
- car: function() {
- let that = this;
- that.animated = false;
- },
- onAddress: function() {
- let that = this;
- if (this.addressInfo.real_name) {
- that.textareaStatus = false;
- that.address.address = true;
- that.pagesUrl = '/pages/users/user_address_list/index?news=' + this.news + '&cartId=' + this
- .cartId +
- '&pinkId=' +
- this.pinkId +
- '&couponId=' +
- this.couponId;
- } else {
- uni.navigateTo({
- url: '/pages/users/user_address/index?cartId=' + this.cartId + '&pinkId=' + this
- .pinkId +
- '&couponId=' + this.couponId + '&new=' + this.news
- })
- }
- },
- formpost(url, postData) {
- let tempform = document.createElement("form");
- tempform.action = url;
- tempform.method = "post";
- tempform.target = "_self";
- tempform.style.display = "none";
- for (let x in postData) {
- let opt = document.createElement("input");
- opt.name = x;
- opt.value = postData[x];
- tempform.appendChild(opt);
- }
- document.body.appendChild(tempform);
- this.$nextTick(e => {
- tempform.submit();
- })
- },
- payment(data) {
- let that = this;
- orderCreate(that.orderKey, data).then(res => {
- let status = res.data.status,
- orderId = res.data.result.orderId,
- jsConfig = res.data.result.jsConfig,
- goPages = '/pages/goods/order_pay_status/index?order_id=' + orderId + '&msg=' + res.msg +
- '&type=3' + '&totalPrice=' + this.totalPrice,
- friendPay = '/pages/users/payment_on_behalf/index?order_id=' + orderId + '&spread=' +
- this
- .$store.state.app.uid
- switch (status) {
- case 'ORDER_EXIST':
- case 'EXTEND_ORDER':
- uni.hideLoading();
- return that.$util.Tips({
- title: res.msg
- }, {
- tab: 5,
- url: goPages
- });
- case 'ALLINPAY_PAY':
- uni.hideLoading();
- // #ifdef MP
- this.initIn = true
- wx.openEmbeddedMiniProgram({
- appId: 'wxef277996acc166c3',
- extraData: {
- cusid: jsConfig.cusid,
- appid: jsConfig.appid,
- version: jsConfig.version,
- trxamt: jsConfig.trxamt,
- reqsn: jsConfig.reqsn,
- notify_url: jsConfig.notify_url,
- body: jsConfig.body,
- remark: jsConfig.remark,
- validtime: jsConfig.validtime,
- randomstr: jsConfig.randomstr,
- paytype: jsConfig.paytype,
- sign: jsConfig.sign,
- signtype: jsConfig.signtype
- }
- })
- this.jumpData = {
- orderId: res.data.result.orderId,
- msg: res.msg,
- }
- // #endif
- // #ifdef APP-PLUS
- plus.runtime.openURL(jsConfig.payinfo);
- setTimeout(e => {
- uni.reLaunch({
- url: goPages
- })
- }, 1000)
- // #endif
- // #ifdef H5
- this.formpost(res.data.result.pay_url, jsConfig)
- // #endif
- break;
- case 'PAY_ERROR':
- uni.hideLoading();
- return that.$util.Tips({
- title: res.msg
- }, {
- tab: 5,
- url: goPages
- });
- break;
- case 'SUCCESS':
- uni.hideLoading();
- if ((that.BargainId || that.combinationId || that.pinkId || that.seckillId || that
- .discountId) && data.payType != 'friend')
- return that.$util.Tips({
- title: res.msg,
- icon: 'success'
- }, {
- tab: 4,
- url: goPages
- });
- return that.$util.Tips({
- title: res.msg,
- icon: 'success'
- }, {
- tab: 4,
- url: data.payType == 'friend' ? friendPay : goPages
- });
- break;
- case 'WECHAT_PAY':
- that.toPay = true;
- // #ifdef MP
- /* that.toPay = true; */
- let mp_pay_name = ''
- if (uni.requestOrderPayment) {
- mp_pay_name = 'requestOrderPayment'
- } else {
- mp_pay_name = 'requestPayment'
- }
- uni[mp_pay_name]({
- timeStamp: jsConfig.timestamp,
- nonceStr: jsConfig.nonceStr,
- package: jsConfig.package,
- signType: jsConfig.signType,
- paySign: jsConfig.paySign,
- success: function(res) {
- uni.hideLoading();
- if (that.BargainId || that.combinationId || that.pinkId || that
- .seckillId || that.discountId)
- return that.$util.Tips({
- title: that.$t(`支付成功`),
- icon: 'success'
- }, {
- tab: 4,
- url: goPages
- });
- return that.$util.Tips({
- title: that.$t(`支付成功`),
- icon: 'success'
- }, {
- tab: 5,
- url: goPages
- });
- },
- fail: function(e) {
- uni.hideLoading();
- return that.$util.Tips({
- title: that.$t(`取消支付`)
- }, {
- tab: 5,
- url: goPages + '&status=2'
- });
- },
- complete: function(e) {
- uni.hideLoading();
- //关闭当前页面跳转至订单状态
- if (res.errMsg == 'requestPayment:cancel' || e.errMsg ==
- 'requestOrderPayment:cancel') return that.$util
- .Tips({
- title: that.$t(`取消支付`)
- }, {
- tab: 5,
- url: goPages + '&status=2'
- });
- },
- })
- // #endif
- // #ifdef H5
- this.$wechat.pay(res.data.result.jsConfig).then(res => {
- return that.$util.Tips({
- title: that.$t(`支付成功`),
- icon: 'success'
- }, {
- tab: 5,
- url: goPages
- });
- }).catch(res => {
- if (!this.$wechat.isWeixin()) {
- uni.redirectTo({
- url: goPages + '&msg=' + that.$t(`支付失败`) + '&status=2'
- // '&msg=支付失败&status=2'
- })
- }
- if (res.errMsg == 'chooseWXPay:cancel') return that.$util.Tips({
- title: that.$t(`取消支付`)
- }, {
- tab: 5,
- url: goPages + '&status=2'
- });
- })
- // #endif
- // #ifdef APP-PLUS
- uni.requestPayment({
- provider: 'wxpay',
- orderInfo: jsConfig,
- success: (e) => {
- let url = goPages;
- uni.showToast({
- title: that.$t(`支付成功`)
- })
- setTimeout(res => {
- uni.redirectTo({
- url: url
- })
- }, 2000)
- },
- fail: (e) => {
- let url = '/pages/goods/order_pay_status/index?order_id=' +
- orderId +
- '&msg=' + that.$t(`支付失败`);
- uni.showModal({
- content: that.$t(`支付失败`),
- showCancel: false,
- success: function(res) {
- if (res.confirm) {
- uni.redirectTo({
- url: url
- })
- } else if (res.cancel) {}
- }
- })
- },
- complete: () => {
- uni.hideLoading();
- },
- });
- // #endif
- break;
- case 'PAY_DEFICIENCY':
- uni.hideLoading();
- //余额不足
- return that.$util.Tips({
- title: res.msg
- }, {
- tab: 5,
- url: goPages + '&status=1'
- });
- break;
- case "WECHAT_H5_PAY":
- uni.hideLoading();
- that.$util.Tips({
- title: that.$t(`订单创建成功`)
- }, {
- tab: 4,
- url: goPages + '&status=0'
- });
- setTimeout(() => {
- location.href = res.data.result.jsConfig.mweb_url;
- }, 2000);
- break;
- case 'ALIPAY_PAY':
- //#ifdef H5
- if (this.from === 'weixin') {
- uni.redirectTo({
- url: `/pages/users/alipay_invoke/index?id=${orderId}&pay_key=${res.data.result.pay_key}`
- });
- } else {
- uni.hideLoading();
- that.formContent = res.data.result.jsConfig;
- that.$nextTick(() => {
- document.getElementById('alipaysubmit').submit();
- })
- }
- //#endif
- // #ifdef MP
- uni.navigateTo({
- url: `/pages/users/alipay_invoke/index?id=${orderId}&link=${jsConfig.qrCode}`
- });
- // #endif
- // #ifdef APP-PLUS
- uni.requestPayment({
- provider: 'alipay',
- orderInfo: jsConfig,
- success: (e) => {
- uni.showToast({
- title: that.$t(`支付成功`)
- })
- let url = '/pages/goods/order_pay_status/index?order_id=' +
- orderId +
- '&msg=' + that.$t(`支付成功`);
- setTimeout(res => {
- uni.redirectTo({
- url: url
- })
- }, 2000)
- },
- fail: (e) => {
- let url = '/pages/goods/order_pay_status/index?order_id=' +
- orderId +
- '&msg=' + that.$t(`支付失败`);
- uni.showModal({
- content: that.$t(`支付失败`),
- showCancel: false,
- success: function(res) {
- if (res.confirm) {
- uni.redirectTo({
- url: url
- })
- } else if (res.cancel) {}
- }
- })
- },
- complete: () => {
- uni.hideLoading();
- },
- });
- // #endif
- break;
- }
- }).catch(err => {
- uni.hideLoading();
- return that.$util.Tips({
- title: err
- });
- });
- },
- clickTextArea() {
- this.$refs.textarea.focus()
- },
- SubOrder(e) {
- let that = this,
- data = {};
- if (!that.payType) return that.$util.Tips({
- title: that.$t(`请选择支付方式`)
- });
- if (!that.addressId && !that.shippingType && !that.virtual_type) return that.$util.Tips({
- title: that.$t(`请选择收货地址`)
- });
- if (that.shippingType == 1) {
- if (that.contacts == "" || that.contactsTel == "") {
- return that.$util.Tips({
- title: that.$t(`请填写联系人或联系人电话`)
- });
- }
- if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(that.contactsTel)) {
- return that.$util.Tips({
- title: that.$t(`请输入正确的手机号码`)
- });
- }
- if (!that.contacts) {
- return that.$util.Tips({
- title: that.$t(`请输入姓名`)
- });
- }
- if (that.storeList.length == 0) return that.$util.Tips({
- title: that.$t(`暂无门店,请选择其他方式`)
- });
- }
- for (var i = 0; i < that.confirm.length; i++) {
- let data = that.confirm[i]
- if (data.status) {
- if (data.label === 'text' || data.label === 'data' || data.label === 'time' || data.label ===
- 'id') {
- if (!data.value.trim()) {
- return uni.showToast({
- title: that.$t(`请输入`) + `${data.title}`,
- icon: 'none'
- });
- }
- }
- if (data.label === 'number') {
- if (data.value <= 0) {
- return uni.showToast({
- title: that.$t(`请输入`) + `${data.title}`,
- icon: 'none'
- });
- }
- }
- if (data.label === 'email') {
- if (!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(data.value)) {
- return uni.showToast({
- title: that.$t(`请输入正确的`) + `${data.title}`,
- icon: 'none'
- });
- }
- }
- if (data.label === 'phone') {
- if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(data.value)) {
- return uni.showToast({
- title: that.$t(`请输入正确的`) + `${data.title}`,
- icon: 'none'
- });
- }
- }
- if (data.label === 'img') {
- if (!data.value.length) {
- return uni.showToast({
- title: that.$t(`请上传`) + `${data.title}`,
- icon: 'none'
- });
- }
- }
- }
- }
- data = {
- custom_form: that.confirm,
- real_name: that.contacts,
- phone: that.contactsTel,
- addressId: that.addressId,
- formId: '',
- couponId: that.couponId,
- payType: that.payType,
- useIntegral: that.useIntegral,
- bargainId: that.BargainId,
- combinationId: that.combinationId,
- discountId: that.discountId,
- pinkId: that.pinkId,
- advanceId: that.advanceId,
- seckill_id: that.seckillId,
- mark: that.mark,
- store_id: that.system_store ? that.system_store.id : 0,
- 'from': that.from,
- shipping_type: that.$util.$h.Add(that.shippingType, 1),
- 'new': that.news,
- 'invoice_id': that.invChecked,
- // #ifdef H5
- quitUrl: location.protocol + '//' + location.hostname +
- '/pages/goods/order_pay_status/index?' +
- '&type=3' + '&totalPrice=' + this.totalPrice
- // #endif
- // #ifdef APP-PLUS
- quitUrl: '/pages/goods/order_details/index?order_id=' + this.order_id
- // #endif
- };
- if (data.payType == 'yue' && parseFloat(that.userInfo.now_money) < parseFloat(that.totalPrice))
- return that.$util.Tips({
- title: that.$t(`余额不足`)
- });
- uni.showLoading({
- title: that.$t(`订单支付中`)
- });
- // #ifdef MP
- openPaySubscribe().then(() => {
- that.payment(data);
- });
- // #endif
- // #ifndef MP
- that.payment(data);
- // #endif
- },
- bindDateChange: function(e, index) {
- this.confirm[index].value = e.target.value
- },
- bindTimeChange: function(e, index) {
- this.confirm[index].value = e.target.value
- },
- getDate(type) {
- const date = new Date();
- let year = date.getFullYear();
- let month = date.getMonth() + 1;
- let day = date.getDate();
- if (type === 'start') {
- year = year - 60;
- } else if (type === 'end') {
- year = year + 2;
- }
- month = month > 9 ? month : '0' + month;
- day = day > 9 ? day : '0' + day;
- return `${year}-${month}-${day}`;
- },
- uploadpic: function(index, item) {
- let that = this;
- this.canvasStatus = true
- that.$util.uploadImageChange('upload/image', function(res) {
- item.value.push(res.data.url);
- }, (res) => {
- this.canvasStatus = false
- }, (res) => {
- this.canvasWidth = res.w
- this.canvasHeight = res.h
- });
- },
- DelPic: function(index, indexs) {
- let that = this,
- pic = this.confirm[index].value;
- that.confirm[index].value.splice(indexs, 1);
- // that.$set(that, 'pics', that.pics);
- },
- inputTripClick() {
- this.inputTrip = true
- // this.$refs.trip.foucs()
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- /deep/uni-checkbox[disabled] .uni-checkbox-input {
- background-color: #eee;
- }
- .alipaysubmit {
- display: none;
- }
- .order-submission .line {
- width: 100%;
- height: 3rpx;
- }
- .order-submission .line image {
- width: 100%;
- height: 100%;
- display: block;
- }
- .order-submission .address {
- padding: 28rpx 30rpx;
- background-color: #fff;
- box-sizing: border-box;
- }
- .order-submission .address .addressCon {
- width: 610rpx;
- font-size: 26rpx;
- color: #666;
- }
- .order-submission .address .addressCon .name {
- font-size: 30rpx;
- color: #282828;
- font-weight: bold;
- margin-bottom: 10rpx;
- }
- .order-submission .address .addressCon .name .phone {
- margin-left: 50rpx;
- }
- .order-submission .address .addressCon .default {
- margin-right: 12rpx;
- }
- .order-submission .address .addressCon .setaddress {
- color: #333;
- font-size: 28rpx;
- }
- .order-submission .address .iconfont {
- font-size: 35rpx;
- color: #707070;
- }
- .order-submission .allAddress {
- width: 100%;
- background: linear-gradient(to bottom, var(--view-theme) 0%, #f5f5f5 100%);
- padding-top: 100rpx;
- margin-bottom: 12rpx;
- }
- .order-submission .allAddress .nav {
- width: 710rpx;
- margin: 0 auto;
- }
- .order-submission .allAddress .nav .item {
- width: 355rpx;
- }
- .order-submission .allAddress .nav .item.on {
- position: relative;
- width: 250rpx;
- }
- .order-submission .allAddress .nav .item.on::before {
- position: absolute;
- bottom: 0;
- content: "快递配送";
- font-size: 28rpx;
- display: block;
- height: 0;
- width: 336rpx;
- border-width: 0 20rpx 80rpx 0;
- border-style: none solid solid;
- border-color: transparent transparent #fff;
- z-index: 2;
- border-radius: 7rpx 30rpx 0 0;
- text-align: center;
- line-height: 80rpx;
- }
- .order-submission .allAddress .nav .item:nth-of-type(2).on::before {
- content: "到店自提";
- border-width: 0 0 80rpx 20rpx;
- border-radius: 30rpx 7rpx 0 0;
- }
- .order-submission .allAddress .nav .item.on2 {
- position: relative;
- }
- .order-submission .allAddress .nav .item.on2::before {
- position: absolute;
- bottom: 0;
- content: "到店自提";
- font-size: 28rpx;
- display: block;
- height: 0;
- width: 400rpx;
- border-width: 0 0 60rpx 60rpx;
- border-style: none solid solid;
- border-color: transparent transparent rgba(255, 255, 255, 0.6);
- border-radius: 40rpx 6rpx 0 0;
- text-align: center;
- line-height: 60rpx;
- }
- .order-submission .allAddress .nav .item:nth-of-type(1).on2::before {
- content: "快递配送";
- border-width: 0 60rpx 60rpx 0;
- border-radius: 6rpx 40rpx 0 0;
- }
- .order-submission .allAddress .address {
- width: 710rpx;
- height: 150rpx;
- margin: 0 auto;
- }
- .order-submission .allAddress .line {
- width: 710rpx;
- margin: 0 auto;
- }
- .order-submission .wrapper .item .discount .placeholder {
- color: #ccc;
- }
- .placeholder-textarea {
- position: relative;
- .placeholder {
- position: absolute;
- color: #ccc;
- top: 26rpx;
- left: 30rpx;
- }
- }
- .order-submission .wrapper {
- background-color: #fff;
- margin-top: 13rpx;
- }
- .order-submission .wrapper .item {
- padding: 27rpx 30rpx;
- font-size: 30rpx;
- color: #282828;
- border-bottom: 1px solid #f0f0f0;
- .mark {
- background-color: #f9f9f9;
- width: 345px;
- height: 70px;
- border-radius: 1px;
- margin-top: 15px;
- padding: 12px 14px;
- color: #ccc;
- font-size: 28rpx;
- box-sizing: border-box;
- }
- .mark-msg {
- color: #333;
- font-size: 32rpx;
- }
- }
- .order-submission .wrapper .item .discount {
- font-size: 30rpx;
- color: #999;
- }
- .order-submission .wrapper .item .discount input {
- text-align: end;
- }
- .order-submission .wrapper .item .discount .iconfont {
- color: #515151;
- font-size: 30rpx;
- margin-left: 15rpx;
- }
- .order-submission .wrapper .item .discount .num {
- font-size: 32rpx;
- margin-right: 20rpx;
- }
- .order-submission .wrapper .item .shipping {
- font-size: 30rpx;
- color: #999;
- position: relative;
- padding-right: 58rpx;
- }
- .order-submission .wrapper .item .shipping .iconfont {
- font-size: 35rpx;
- color: #707070;
- position: absolute;
- right: 0;
- top: 50%;
- transform: translateY(-50%);
- margin-left: 30rpx;
- }
- .order-submission .wrapper .item textarea {
- background-color: #f9f9f9;
- width: 690rpx;
- height: 140rpx;
- border-radius: 3rpx;
- margin-top: 30rpx;
- padding: 25rpx 28rpx;
- box-sizing: border-box;
- }
- .order-submission .wrapper .item .placeholder {
- color: #ccc;
- font-size: 28rpx;
- }
- .order-submission .wrapper .item .list {
- margin-top: 35rpx;
- }
- .order-submission .wrapper .item .list .payItem {
- border: 1px solid #eee;
- border-radius: 6rpx;
- height: 86rpx;
- width: 100%;
- box-sizing: border-box;
- margin-top: 20rpx;
- font-size: 28rpx;
- color: #282828;
- }
- .order-submission .wrapper .item .list .payItem.on {
- border-color: #fc5445;
- color: #e93323;
- }
- .order-submission .wrapper .item .list .payItem .name {
- width: 50%;
- text-align: center;
- border-right: 1px solid #eee;
- padding-left: 80rpx;
- }
- .order-submission .wrapper .item .list .payItem .name .iconfont {
- width: 44rpx;
- height: 44rpx;
- border-radius: 50%;
- text-align: center;
- line-height: 44rpx;
- background-color: #fe960f;
- color: #fff;
- font-size: 30rpx;
- margin-right: 15rpx;
- }
- .order-submission .wrapper .item .list .payItem .name .iconfont.icon-weixin2 {
- background-color: #41b035;
- }
- .order-submission .wrapper .item .list .payItem .name .iconfont.icon-zhifubao {
- background-color: #1677FF;
- }
- .order-submission .wrapper .item .list .payItem .tip {
- width: 49%;
- text-align: center;
- font-size: 26rpx;
- color: #aaa;
- }
- .order-submission .moneyList {
- margin-top: 12rpx;
- background-color: #fff;
- padding: 30rpx;
- }
- .order-submission .moneyList .item {
- font-size: 28rpx;
- color: #282828;
- }
- .order-submission .moneyList .item~.item {
- margin-top: 20rpx;
- }
- .order-submission .moneyList .item .money {
- color: #868686;
- }
- .order-submission .footer {
- width: 100%;
- height: 100rpx;
- background-color: #fff;
- padding: 0 30rpx;
- font-size: 28rpx;
- color: #333;
- box-sizing: border-box;
- position: fixed;
- bottom: 0;
- left: 0;
- z-index: 9;
- }
- .order-submission .footer .settlement {
- font-size: 30rpx;
- color: #fff;
- width: 240rpx;
- height: 70rpx;
- background-color: var(--view-theme);
- border-radius: 50rpx;
- text-align: center;
- line-height: 70rpx;
- }
- .footer .transparent {
- opacity: 0
- }
- .confirm {
- text-align: right;
- font-size: 22rpx;
- }
- .confirmImg {
- width: 100%;
- .img {
- width: 136rpx;
- height: 136rpx;
- }
- .pictrue {
- width: 136rpx;
- height: 136rpx;
- box-sizing: border-box;
- margin: 18rpx;
- margin-bottom: 35rpx;
- position: relative;
- font-size: 22rpx;
- color: #bbb;
- .del {
- position: absolute;
- top: 0;
- right: 0;
- }
- }
- .bor {
- border: 1rpx solid #ddd;
- }
- }
- .fontC {
- color: grey;
- }
- </style>
|