123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406 |
- <template>
- <view :style="colorStyle">
- <view class='order-submission'>
- <view class="headerCon">
- <view class="add-title acea-row row-between-wrapper">
- <view class="acea-row row-middle">
- <view class="icon ">
- 门店选择</view>
- <view class="text add-text line1">线上下单</view>
- <view class="text add-text line1" v-if="deliveryType==3">{{system_store.name || '请选择门店'}}
- </view>
- </view>
- <view class="text" @tap='onDelivery'>
- 点击切换 <text class='iconfont icon-jiantou'></text></view>
- </view>
- <view class="address acea-row row-between-wrapper">
- <view class="addressCon" v-if="storeList.length>0">
- <view class='name acea-row row-middle'>
- <view class="nameCon line1 on">{{system_store.name || ''}}</view>
- </view>
- <view class="line1">
- {{system_store.address || ''}}{{system_store.detailed_address || ''}}
- </view>
- </view>
- <view class='addressCon' v-else>
- <view class='setaddress'>暂无门店信息</view>
- </view>
- <view class="icon acea-row row-middle" v-if="storeList.length>0">
- <view class="iconfont icon-dianhua" @click.stop="call(system_store.phone)"></view>
- <view class="iconfont icon-dingwei2" @click.stop="showMaoLocation(system_store)"></view>
- </view>
- </view>
- </view>
- <view class="allAddress" v-if="product_type == 0">
- <!-- #ifdef MP -->
- <!-- 桌码信息 -->
- <view v-if="tableId" class="table-header">
- <view class="top">
- <view class="name">{{ codeData.storeName.storeName }}</view>
- <view class="number"><text
- class="light">{{ codeData.category.name }}{{ codeData.table_number }}</text>号桌</view>
- </view>
- <view>{{ codeData.serial_number }}</view>
- </view>
- <!-- #endif -->
- <!-- 地址 -->
- <view v-if="!tableId" class='line'>
- <image src='/static/images/line.jpg'></image>
- </view>
- </view>
- <view class="wrapper">
- <group-goods-list v-if="collage_id" :goods-list="goodsList"></group-goods-list>
- <orderGoods v-else :cartInfo="cartInfo" :giveData="giveData" :shippingType="shippingType"
- :product_type='product_type' :giveCartInfo="giveCartInfo"></orderGoods>
- </view>
- <view class='wrapper'>
- <view class="item acea-row row-between-wrapper">
- <view>预约时间</view>
- <view class='discount' @click="openDatetimePicker">
- {{yytime || '请选择预约时间'}}
- <text class='iconfont icon-jiantou'></text>
- </view>
- </view>
- </view>
- <view class='moneyList'>
- <!-- <view class="item acea-row row-between-wrapper" >
- <view>销售员工</view>
- </view>
- <scroll-view scroll-x="true" class="zp-wrap" @scrolltolower="">
- <view class="zp-item" v-for="ygitem in saleyg.list" @click="choosYg(ygitem,1)"
- :class="{'choose': ygitem.id == sale_yg.id}">
- <image :src="ygitem.avatar || '../../../static/images/avt.png'" mode="" class="zp-logo"></image>
- <view class="zp-name">{{ygitem.alias}}</view>
- </view>
- </scroll-view> -->
- <view class="item acea-row row-between-wrapper">
- <view>预约员工</view>
- </view>
- <scroll-view scroll-x="true" class="zp-wrap" @scrolltolower="">
- <view class="zp-item" v-for="ygitem in yg.list" @click="choosYg(ygitem,2)"
- :class="{'choose': ygitem.id == choose_yg.id}">
- <image :src="ygitem.avatar || '../../../static/images/avt.png'" mode="" class="zp-logo"></image>
- <view class="zp-name">{{ygitem.alias}}</view>
- </view>
- </scroll-view>
- </view>
- <view class='wrapper'>
- <view class='item acea-row row-between-wrapper' @tap='couponTap'>
- <view>优惠券</view>
- <view class='discount'>{{couponTitle}}
- <text class='iconfont icon-jiantou'></text>
- </view>
- </view>
- </view>
- <view class='moneyList'>
- <view class='item acea-row row-between-wrapper'>
- <view>商品总价:</view>
- <view class='money'>
- ¥{{payInfo.total_price}}
- </view>
- </view>
- <view class='item acea-row row-between-wrapper' v-if="payInfo.deduction_price">
- <view>优惠金额:</view>
- <view class='money'>
- ¥{{payInfo.deduction_price}}
- </view>
- </view>
- </view>
- <view class="height-add"></view>
- <view class='footer acea-row row-between-wrapper'>
- <view>合计:
- <text class='font-color'>¥{{payInfo.pay_price || 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)) && shippingType) || (!shippingType && addressId) || product_type != 0">
- 立即结算</view>
- <view class='settlement bg-color-hui' style='z-index:100' v-else>立即结算</view> -->
- <view class='settlement' style='z-index:100' @tap.stop="goPay">立即结算</view>
- </view>
- </view>
- <view class="alipaysubmit" v-html="formContent"></view>
- <view class="tipaddress" v-show="isaddress">
- <view class="top"></view>
- <view class="bottom">
- <div class="font1">更新地址</div>
- <div class="font2">当前地址功能已更新,请重新修改</div>
- <div class="btn" @tap="payAddress">前往修改</div>
- </view>
- </view>
- <view class="mark" v-show="isaddress"></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>
- <home v-show="!invShow && navigation"></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 v-if="totalPrice" :payMode="cartArr" :pay_close="pay_close" :isCall="true" :totalPrice="totalPrice"
- @changePayType="changePayType" @onChangeFun="onChangeFun"></payment>
- <deliveryMethod ref="deliveryMethod" :isDisplay="isDisplay" :storeList="storeList" :ptype="ptype"
- :storeSelfMention="store_self_mention" @deliveryFun="deliveryFun" @storeFun="storeFun"></deliveryMethod>
- <!-- #ifdef MP -->
- <!-- <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize> -->
- <!-- #endif -->
- <timeranges :isShow='isShow' :time='timeranges' @confrim="confrim" @cancel="cancels"></timeranges>
- <areaWindow ref="areaWindow" :display="display" :address='addressInfoArea' :cityShow='cityShow'
- @submit="OnAreaAddress" @changeClose="changeAddressClose"></areaWindow>
- <buuug7-simple-datetime-picker ref="myPicker" @submit="handleSubmit" @err="datetimePickerErr"
- :start-year="start_year" :end-year="2030" :time-hide="[true, true, true, true, true, false]"
- :time-label="['年', '月', '日', '时', '分', '秒']" />
- </view>
- </template>
- <script>
- const CACHE_CITY = {};
- import dayjs from '@/plugin/dayjs/dayjs.min.js';
- import {
- orderConfirm,
- getCouponsServeOrderPrice,
- orderCreate,
- postOrderComputed,
- checkShipping,
- computedServe,
- SubscribeCreate
- } from '@/api/order.js';
- import {
- getAddressDefault,
- getAddressDetail,
- invoiceList,
- invoiceOrder,
- getUserInfo
- } from '@/api/user.js';
- import {
- openPaySubscribe
- } from '@/utils/SubscribeMessage.js';
- import {
- storeListApi,
- getCollagePartake,
- getCodeData,
- getMen
- } from '@/api/store.js';
- import {
- CACHE_LONGITUDE,
- CACHE_LATITUDE
- } from '@/config/cache.js';
- import areaWindow from '@/components/areaWindow';
- import couponListWindow from '@/components/couponListWindow';
- import addressWindow from '@/components/addressWindow';
- import orderGoods from '@/components/orderGoods';
- import deliveryMethod from '../components/deliveryMethod/index.vue';
- import timeranges from '@/components/timeranges';
- import home from '@/components/home';
- import invoicePicker from '../components/invoicePicker';
- import groupGoodsList from '@/components/groupGoodsList/index.vue'
- import {
- toLogin
- } from '@/libs/login.js';
- import {
- mapGetters
- } from "vuex";
- import payment from '@/components/payment';
- import colors from "@/mixins/color";
- let newTime = new Date()
- export default {
- components: {
- payment,
- invoicePicker,
- couponListWindow,
- addressWindow,
- orderGoods,
- home,
- deliveryMethod,
- timeranges,
- areaWindow,
- groupGoodsList
- },
- mixins: [colors],
- data() {
- return {
- paying: false,
- time_init: newTime.getTime() + 60 * 30,
- start_year: newTime.getFullYear(),
- addressInfoArea: [],
- cityShow: 2,
- display: false,
- timeranges: [],
- isShow: false,
- giveData: {
- give_integral: 0,
- give_coupon: []
- },
- giveCartInfo: [],
- confirm: [], //自定义留言
- id: 0,
- isaddress: false,
- textareaStatus: true,
- //支付方式
- cartArr: [{
- "name": "微信支付",
- "icon": "icon-weixin2",
- value: 'weixin',
- title: '使用微信快捷支付',
- payStatus: 1,
- },
- {
- "name": "支付宝支付",
- "icon": "icon-zhifubao",
- value: 'alipay',
- title: '使用线上支付宝支付',
- payStatus: 1,
- },
- {
- "name": "余额支付",
- "icon": "icon-yuezhifu",
- value: 'yue',
- title: '可用余额:',
- payStatus: 1,
- },
- // {
- // "name": "线下支付",
- // "icon": "icon-yuezhifu1",
- // value: 'offline',
- // title: '选择线下付款方式',
- // payStatus: 2,
- // }
- ],
- formContent: '',
- payType: 'weixin', //支付方式
- openType: 1, //优惠券打开方式 1=使用
- active: 0, //支付方式切换
- coupon: {
- coupon: false,
- list: [],
- statusTile: '立即使用'
- }, //优惠券组件
- 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: '请选择', //优惠券
- coupon_price: 0, //优惠券抵扣金额
- promotions_detail: [], //优惠活动金额明细
- useIntegral: false, //是否使用积分
- integral_price: 0, //积分抵扣金额
- integral: 0,
- ChangePrice: 0, //使用积分抵扣变动后的金额
- formIds: [], //收集formid
- status: 0,
- is_address: false,
- toPay: false, //修复进入支付时页面隐藏从新刷新页面
- shippingType: 0,
- system_store: {},
- storePostage: 0,
- contacts: '',
- contactsTel: '',
- mydata: {},
- storeList: [],
- store_self_mention: 0, //是开启门店自提;
- store_func_status: false, //是否开启门店自提和门店配送;
- cartInfo: [],
- priceGroup: {},
- animated: false,
- totalPrice: 0,
- integralRatio: "0",
- pagesUrl: "",
- orderKey: "",
- // usableCoupon: {},
- offlinePostage: "",
- isAuto: false, //没有授权的不会自动授权
- isShowAuth: false, //是否隐藏授权
- from: '',
- news: 1,
- invTitle: '不开发票',
- special_invoice: false,
- invoice_func: false,
- integral_ratio_status: 1,
- header_type: '',
- invShow: false,
- invList: [],
- invChecked: '',
- urlQuery: '',
- pay_close: false,
- noCoupon: 0,
- valid_count: 0,
- discount_id: 0,
- storeId: 0,
- product_type: 1,
- newImg: [],
- isDisplay: [],
- deliveryType: 1,
- goodsType: 0,
- product_id: 0,
- selectIndex: 0,
- timerangesIndex: 0,
- collage_id: 0,
- goodsList: [],
- tableId: 0,
- codeData: {},
- ptype: 1,
- yytime: '', //预约时间
- yg: {
- page: 1,
- limit: 100,
- list: [],
- loadingType: 'loadmore',
- loaded: false,
- },
- saleyg: {
- list: []
- },
- choose_yg: {},
- sale_yg: {},
- payInfo: {},
- };
- },
- computed: mapGetters(['isLogin']),
- onLoad: function(options) {
- this.ptype = options.product_type
- // #ifdef H5
- this.from = this.$wechat.isWeixin() ? 'weixin' : 'weixinh5'
- // #endif
- // #ifdef MP
- this.from = 'routine'
- // #endif
- this.product_id = options.product_id || 0;
- this.getUserInfo()
- this.computedServe()
- this.getList()
- this.ptype = 6
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function() {
- uni.removeStorageSync('form_type_cart');
- let _this = this
- uni.$on("handClick", res => {
- if (res) {
- _this.system_store = res.address
- _this.storeId = _this.system_store.id
- _this.cartId = res.cartId
- _this.news = res.new
- _this.pinkId = Number(res.pinkId)
- _this.couponId = res.couponId
- _this.getConfirm()
- }
- // 清除监听
- uni.$off('handClick');
- })
- let current = (dayjs(new Date(Number(new Date().getTime()))).format('HH:mm')).split(':');
- let currentArray = current;
- currentArray.push(0);
- let arrayNew = [];
- [...currentArray, ...current].forEach(item => {
- arrayNew.push(Number(item))
- })
- this.timeranges = arrayNew;
- },
- methods: {
- /**
- * 获取当前金额可用优惠券
- *
- */
- getCouponList: function() {
- let that = this;
- let data = {
- products:that.product_id,
- store_id:that.system_store.id
- }
- getCouponsServeOrderPrice(this.totalPrice, data).then(res => {
- // console.log(that.coupon,'that.coupon');
- const arr = res.data.map((re)=>{
- re.title = re.coupon_title;
- return re
- })
- that.$set(that.coupon, 'list', arr);
- that.openType = 1;
- });
- },
- getUserInfo() {
- let that = this
- getUserInfo().then(res => {
- this.userInfo = res.data
- //#ifdef MP
- that.cartArr[1].payStatus = 0;
- //#endif
- //余额支付是否开启
- that.cartArr[2].title = '可用余额:' + this.userInfo.now_money;
- })
- },
- computedServe() {
- computedServe({
- products: this.product_id,
- coupon_id:this.couponId
- }).then(ress => {
- console.log(ress)
- this.payInfo = ress.data
- this.totalPrice = ress.data.pay_price + ''
- this.cartArr[2].number = ress.data.pay_price + '';
- })
- },
- // 选择员工
- choosYg(item, index) {
- if (index == 1) {
- this.sale_yg = item
- } else {
- this.choose_yg = item
- }
- },
- // 获取员工列表
- getMen(type) {
- let that = this
- if (type == 're') {
- that.yg.loadingType = 'more'
- that.yg.page = 1
- that.yg.list = []
- }
- if (that.yg.loadingType == 'noMore' || that.yg.loadingType == 'loading') {
- return
- }
- that.yg.loadingType = 'loading'
- getMen({
- page: that.yg.page,
- limit: that.yg.limit,
- store_id: this.system_store.id
- }).then(res => {
- console.log(res)
- let arr = []
- let arr1 = res.data.list
- arr1.forEach(item => {
- if (item.is_reservation == 1) {
- arr.push(item)
- }
- })
- let arr2 = [{
- id: 0,
- alias: '暂无'
- }]
- that.yg.list = arr
- that.saleyg.list = arr2.concat(arr1)
- if (that.yg.limit == res.data.list.length) {
- that.yg.loadingType = 'more'
- that.yg.page++
- } else {
- that.yg.loadingType = 'noMore'
- }
- that.yg.loaded = true
- })
- },
- // 打开picker
- openDatetimePicker() {
- this.$refs.myPicker.show();
- },
- // 关闭picker
- closeDatetimePicker() {
- this.$refs.myPicker.hide();
- },
- datetimePickerErr() {
- this.yytime = ''
- return this.$util.Tips({
- title: '所选预约时间已过时'
- });
- },
- handleSubmit(e) {
- console.log(e);
- this.yytime = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`;
- },
- // #ifdef MP
- // 桌码信息
- getCodeData() {
- getCodeData({
- tableId: this.tableId
- }).then(res => {
- this.codeData = res.data;
- });
- },
- // #endif
- getCollagePartake() {
- getCollagePartake({
- collage_id: this.collage_id
- }).then(res => {
- this.goodsList = res.data;
- });
- },
- OnAreaAddress(address) {
- let addr = '';
- if (address.length == 4) {
- addr = address[0].label + '/' + address[1].label + '/' + address[2].label + '/' + address[3].label;
- } else if (address.length == 3) {
- addr = address[0].label + '/' + address[1].label + '/' + address[2].label;
- } else if (address.length == 2) {
- addr = address[0].label + '/' + address[1].label;
- } else {
- addr = address[0].label;
- }
- this.confirm[this.timerangesIndex].value = addr;
- CACHE_CITY[this.timerangesIndex] = address;
- },
- changeRegion(index) {
- if (!this.confirm[index].value) {
- this.addressInfoArea = [];
- }
- this.timerangesIndex = index;
- this.cityShow = Number(this.confirm[index].valConfig.tabVal) + 1;
- this.display = true;
- if (CACHE_CITY[index]) {
- this.addressInfoArea = CACHE_CITY[index];
- }
- },
- // 关闭地址弹窗;
- changeAddressClose: function() {
- this.display = false;
- },
- maskClick(e) {
- console.log(e);
- },
- // 授权关闭
- authColse: function(e) {
- this.isShowAuth = e
- },
- showMaoLocation(e) {
- let self = this;
- // #ifdef H5
- if (self.$wechat.isWeixin()) {
- self.$wechat.seeLocation({
- latitude: Number(e.latitude),
- longitude: Number(e.longitude),
- name: e.name,
- scale: 13,
- address: `${e.address}-${e.detailed_address}`,
- }).then(res => {})
- } else {
- // #endif
- uni.openLocation({
- latitude: Number(e.latitude),
- longitude: Number(e.longitude),
- name: e.name,
- address: `${e.address}-${e.detailed_address}`,
- success: function() {
- Number
- }
- });
- // #ifdef H5
- }
- // #endif
- },
- call(phone) {
- uni.makePhoneCall({
- phoneNumber: phone,
- });
- },
- // 选中配送类型
- deliveryFun(e, item) {
- this.deliveryType = e;
- this.$refs.deliveryMethod.module = false;
- if (e == 2) {
- this.storeId = item.id;
- } else {
- if (e == 3) {
- this.storeId = item.id;
- if (this.isDisplay.includes("2") && this.isDisplay.includes("3")) {
- this.getaddressInfo();
- this.$nextTick(function() {
- this.$refs.addressWindow.getAddressList();
- })
- }
- }
- this.system_store = item;
- }
- if (e == 1 || e == 3) {
- this.addressType(0, e);
- } else {
- this.addressType(1, e);
- }
- this.getMen('re')
- this.choose_yg = {}
- this.sale_yg = {}
- },
- // 选择配送方式
- onDelivery() {
- this.$refs.deliveryMethod.module = true
- },
- // 子集调用门店列表接口
- storeFun(index) {
- this.getList(1, index);
- },
- // 是否显示快递配送
- getCheckShipping() {
- let data = {
- cartId: this.cartId,
- new: this.news
- }
- checkShipping(data).then(res => {
- // 1:快递配送,2:到店自提,3:门店配送
- res.data.type.sort((x, y) => x - y) //正序
- this.isDisplay = res.data.type;
- if (((this.isDisplay.includes("2") && this.isDisplay.length == 1) || (this.deliveryType == 2 &&
- !this.tableId) || (this.deliveryType == 3 && this.storeId > 0 && !this.system_store
- .name)) && this.isDisplay.length) {
- if ((this.deliveryType == 2 || (this.deliveryType == 3 && !this.isDisplay.includes(
- "3"))) && this.isDisplay.includes("2")) {
- this.deliveryType = 2
- this.addressType(1, this.deliveryType);
- }
- if ((this.deliveryType == 3 || (this.deliveryType == 2 && !this.isDisplay.includes(
- "2"))) && this.isDisplay.includes("3")) {
- this.deliveryType = 3
- this.addressType(0, this.deliveryType);
- this.getaddressInfo();
- this.$nextTick(function() {
- this.$refs.addressWindow.getAddressList();
- })
- }
- } else {
- this.getaddressInfo();
- this.getConfirm();
- this.$nextTick(function() {
- this.$refs.addressWindow.getAddressList();
- })
- }
- }).catch(err => {
- uni.showToast({
- title: err,
- icon: 'none'
- });
- })
- },
- /**
- * 删除图片
- *
- */
- DelPic: function(index, indexs) {
- let that = this,
- pic = this.confirm[index].value;
- that.confirm[index].value.splice(indexs, 1);
- that.$set(that.confirm[index], 'value', that.confirm[index].value);
- },
- /**
- * 上传文件
- *
- */
- uploadpic: function(index) {
- let that = this;
- this.$util.uploadImageOne('upload/image', function(res) {
- that.newImg.push(res.data.url);
- that.$set(that.confirm[index], 'value', that.newImg);
- });
- },
- // 不开发票
- invCancel() {
- this.invChecked = '';
- this.invTitle = '不开发票';
- 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 ? '个人' : '企业';
- name += result.type === 1 ? '普通' : '专用';
- name += '发票';
- this.invTitle = name;
- },
- // 关闭发票
- invClose() {
- this.invShow = false;
- this.getInvoiceList()
- },
- getInvoiceList() {
- uni.showLoading({
- title: '正在加载…'
- })
- 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 ? '个人' : '企业';
- name += result.type === 1 ? '普通' : '专用';
- name += '发票';
- 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}&delivery_type=${this.deliveryType}&store_id=${this.storeId}&store_name=${this.system_store.name}&product_id=${this.product_id}`;
- },
- /**
- * 授权回调事件
- *
- */
- onLoadFun: function() {
- this.getCheckShipping();
- this.isShowAuth = false;
- //调用子页面方法授权后执行获取地址列表
- // 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);
- console.log(e)
- let that = this
- if (e.action == 'payClose') {
- console.log(this.payType)
- this.pay_close = false
- } else {
- if(that.paying) {
- return
- }
- that.paying = true
- SubscribeCreate({
- uid: this.userInfo.uid,
- work_member_id: this.choose_yg.id,
- products: this.product_id,
- pay_type: e.value,
- store_id: that.system_store.id,
- reservation_time: that.yytime,
- sale_uid: that.sale_yg.id || 0,
- coupon_id:this.couponId,
- // #ifdef MP-WEIXIN
- from: "routine"
- // #endif
- }).then(res => {
- setTimeout(()=> {
- that.paying = false
- },2500)
- let status = res.data.status,
- orderId = res.data.result.order_id,
- jsConfig = res.data.result.jsConfig,
- goPages = '/pages/goods/order_pay_status/index?order_id=' + orderId + '&msg=' + res
- .msg +
- '&type=6' + '&totalPrice=' + this.totalPrice + '&pay_type=' + e.value
- switch (status) {
- case 'ORDER_EXIST':
- case 'EXTEND_ORDER':
- case 'PAY_ERROR':
- uni.hideLoading();
- return that.$util.Tips({
- title: res.msg
- }, {
- tab: 5,
- url: goPages + '&pay_end=error'
- });
- break;
- case 'SUCCESS':
- uni.hideLoading();
- if (that.BargainId || that.combinationId || that.pinkId || that.seckillId ||
- that
- .discountId)
- return that.$util.Tips({
- title: res.msg,
- icon: 'success'
- }, {
- tab: 4,
- url: goPages+ '&pay_end=SUCCESS'
- });
- return that.$util.Tips({
- title: res.msg,
- icon: 'success'
- }, {
- tab: 5,
- url: goPages + '&pay_end=SUCCESS'
- });
- 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: '支付成功',
- icon: 'success'
- }, {
- tab: 4,
- url: goPages + '&pay_end=SUCCESS'
- });
- return that.$util.Tips({
- title: '支付成功',
- icon: 'success'
- }, {
- tab: 5,
- url: goPages + '&pay_end=SUCCESS'
- });
- },
- fail: function(e) {
- uni.hideLoading();
- return that.$util.Tips({
- title: '取消支付'
- }, {
- tab: 5,
- url: goPages + '&status=2' + '&pay_end=error'
- });
- },
- complete: function(e) {
- uni.hideLoading();
- //关闭当前页面跳转至订单状态
- if (res.errMsg == 'requestPayment:cancel') return that
- .$util
- .Tips({
- title: '取消支付'
- }, {
- tab: 5,
- url: goPages + '&status=2' + '&pay_end=SUCCESS'
- });
- },
- })
- // #endif
- // #ifdef H5
- this.$wechat.pay(res.data.result.jsConfig).then(res => {
- return that.$util.Tips({
- title: '支付成功',
- icon: 'success'
- }, {
- tab: 5,
- url: goPages + '&pay_end=SUCCESS'
- });
- }).catch(res => {
- if (!this.$wechat.isWeixin()) {
- uni.redirectTo({
- url: goPages +
- '&msg=支付失败&status=2' + '&pay_end=SUCCESS'
- })
- }
- if (res.errMsg == 'chooseWXPay:cancel') return that.$util.Tips({
- title: '取消支付'
- }, {
- tab: 5,
- url: goPages + '&status=2'
- });
- })
- // #endif
- // #ifdef APP-PLUS
- uni.requestPayment({
- provider: 'wxpay',
- orderInfo: jsConfig,
- success: (e) => {
- let url = goPages;
- uni.showToast({
- title: "支付成功"
- })
- setTimeout(res => {
- uni.redirectTo({
- url: url
- })
- }, 2000)
- },
- fail: (e) => {
- let url = '/pages/goods/order_pay_status/index?order_id=' +
- orderId +
- '&msg=支付失败';
- uni.showModal({
- content: "支付失败",
- showCancel: false,
- success: function(res) {
- if (res.confirm) {
- uni.redirectTo({
- url: url
- })
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- })
- },
- 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: '订单创建成功!'
- }, {
- 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: "支付成功"
- })
- let url = '/pages/goods/order_pay_status/index?order_id=' +
- orderId +
- '&msg=支付成功';
- setTimeout(res => {
- uni.redirectTo({
- url: url
- })
- }, 2000)
- },
- fail: (e) => {
- let url = '/pages/goods/order_pay_status/index?order_id=' +
- orderId +
- '&msg=支付失败';
- uni.showModal({
- content: "支付失败",
- showCancel: false,
- success: function(res) {
- if (res.confirm) {
- uni.redirectTo({
- url: url
- })
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- })
- },
- complete: () => {
- uni.hideLoading();
- },
- });
- // #endif
- break;
- }
- }).catch(err=> {
- that.paying = false
- })
- }
- },
- payClose: function() {
- this.pay_close = false;
- },
- goPay() {
- // if(!this.sale_yg.id) {
- // return this.$util.Tips({
- // title: '请选择销售员工'
- // });
- // }
- if (!this.choose_yg.id) {
- return this.$util.Tips({
- title: '请选择预约员工'
- });
- }
- if (!this.yytime) {
- return this.$util.Tips({
- title: '请选择预约时间'
- });
- }
- this.formVerify();
- },
- payCheck(type) {
- this.payType = type;
- this.SubOrder();
- },
- payAddress() {
- uni.navigateTo({
- // /pages/users/user_address/index?id=25&cartId=76179610656654229504&pinkId=0&couponId=0&new=1
- url: '/pages/users/user_address/index?id=' + this.id + '&new=' + this.news + '&cartId=' + this
- .cartId +
- '&pinkId=' +
- this.pinkId +
- '&couponId=' +
- this.couponId + '&delivery_type=' + this.deliveryType + '&addressId=' + this.addressId +
- '&store_id=' + this.storeId + '&store_name=' + this.system_store.name + '&product_id=' +
- this.product_id
- })
- },
- /**
- * 获取门店列表数据
- */
- getList: function(fromType, index) {
- let longitude = uni.getStorageSync("user_longitude"); //经度
- let latitude = uni.getStorageSync("user_latitude"); //纬度
- let data = {
- latitude: latitude, //纬度
- longitude: longitude, //经度
- page: 1,
- limit: 100,
- type: this.seckillId > 0 ? 1 : 0,
- product_id: this.product_id,
- is_store: index
- }
- storeListApi(data).then(res => {
- let list = res.data.list.list || [];
- this.$set(this, 'storeList', list);
- this.$set(this, 'storeId', this.storeId != 0 ? this.storeId : list[0].id);
- list.forEach(item => {
- if (this.storeId == item.id) {
- this.$set(this, 'system_store', item);
- }
- })
- if (fromType != 1) {
- this.getConfirm();
- }
- this.yg.list = []
- this.yg.loadingType = 'more'
- this.yg.page = 1
- this.getMen();
- this.getCouponList();
- }).catch(err => {})
- },
- // 关闭地址弹窗;
- changeClose: function() {
- this.$set(this.address, 'address', false);
- },
- /*
- * 跳转门店列表
- */
- showStoreList: function() {
- let _this = this
- if (this.storeList.length > 0) {
- uni.navigateTo({
- url: `/pages/store/store_list/index?type=1&cartId=${_this.cartId}&new=${_this.news}&pinkId=${_this.pinkId}&couponId=${_this.couponId}`
- })
- }
- },
- changePayType(type) {
- this.payType = type
- this.computedPrice()
- },
- computedPrice: function() {
- let shippingType = this.shippingType;
- console.log(this.priceGroup.couponPrice == 0 ? 0 : this.couponId,'this.priceGroup.couponPrice == 0 ? 0 : this.couponId');
- postOrderComputed(this.orderKey, {
- addressId: this.addressId,
- useIntegral: this.useIntegral ? 1 : 0,
- couponId: this.priceGroup.couponPrice == 0 ? 0 : this.couponId,
- shipping_type: this.tableId ? 4 : 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.promotions_detail = result.promotions_detail;
- this.integral = this.useIntegral ? result.SurplusIntegral : this.userInfo.integral;
- this.$set(this.priceGroup, 'storePostage', shippingType == 1 ? 0 : result.pay_postage);
- this.$set(this.priceGroup, 'storePostageDiscount', result.storePostageDiscount);
- }
- }).catch(err => {
- return that.$util.Tips({
- title: err
- });
- })
- },
- addressType: function(e, type) {
- let index = e;
- this.shippingType = parseInt(index);
- // this.computedPrice();
- if (index == 1) {
- this.getList(0, type);
- } else {
- this.getConfirm();
- }
- },
- 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 = '请选择',
- 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 = '不使用';
- 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.getConfirm(1);
- },
- /**
- * 使用积分抵扣
- */
- 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;
- },
- // 对象转数组
- objToArr(data) {
- let obj = Object.keys(data);
- let m = obj.map(key => data[key]);
- return m;
- },
- /**
- * 获取当前订单详细信息
- *
- */
- getConfirm: function(numType) {
- this.computedServe();
- },
- /*
- * 获取默认收货地址或者获取某条地址信息
- */
- 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(name) {
- let that = this;
- if (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 + '&delivery_type=' + this.deliveryType + '&addressId=' + this.addressId +
- '&store_id=' + this.storeId + '&store_name=' + this.system_store.name + '&product_id=' + this
- .product_id
- } else {
- uni.navigateTo({
- url: '/pages/users/user_address/index?new=' + this.news + '&cartId=' + this.cartId +
- '&pinkId=' +
- this.pinkId +
- '&couponId=' +
- this.couponId + '&delivery_type=' + this.deliveryType + '&addressId=' + this
- .addressId + '&store_id=' + this.storeId + '&store_name=' + this.system_store
- .name + '&product_id=' + this.product_id
- })
- }
- },
- payment: function(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
- switch (status) {
- case 'ORDER_EXIST':
- case 'EXTEND_ORDER':
- 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)
- return that.$util.Tips({
- title: res.msg,
- icon: 'success'
- }, {
- tab: 4,
- url: goPages
- });
- return that.$util.Tips({
- title: res.msg,
- icon: 'success'
- }, {
- tab: 5,
- url: 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: '支付成功',
- icon: 'success'
- }, {
- tab: 4,
- url: goPages
- });
- return that.$util.Tips({
- title: '支付成功',
- icon: 'success'
- }, {
- tab: 5,
- url: goPages
- });
- },
- fail: function(e) {
- uni.hideLoading();
- return that.$util.Tips({
- title: '取消支付'
- }, {
- tab: 5,
- url: goPages + '&status=2'
- });
- },
- complete: function(e) {
- uni.hideLoading();
- //关闭当前页面跳转至订单状态
- if (res.errMsg == 'requestPayment:cancel') return that.$util
- .Tips({
- title: '取消支付'
- }, {
- tab: 5,
- url: goPages + '&status=2'
- });
- },
- })
- // #endif
- // #ifdef H5
- this.$wechat.pay(res.data.result.jsConfig).then(res => {
- return that.$util.Tips({
- title: '支付成功',
- icon: 'success'
- }, {
- tab: 5,
- url: goPages
- });
- }).catch(res => {
- if (!this.$wechat.isWeixin()) {
- uni.redirectTo({
- url: goPages +
- '&msg=支付失败&status=2'
- })
- }
- if (res.errMsg == 'chooseWXPay:cancel') return that.$util.Tips({
- title: '取消支付'
- }, {
- tab: 5,
- url: goPages + '&status=2'
- });
- })
- // #endif
- // #ifdef APP-PLUS
- uni.requestPayment({
- provider: 'wxpay',
- orderInfo: jsConfig,
- success: (e) => {
- let url = goPages;
- uni.showToast({
- title: "支付成功"
- })
- setTimeout(res => {
- uni.redirectTo({
- url: url
- })
- }, 2000)
- },
- fail: (e) => {
- let url = '/pages/goods/order_pay_status/index?order_id=' +
- orderId +
- '&msg=支付失败';
- uni.showModal({
- content: "支付失败",
- showCancel: false,
- success: function(res) {
- if (res.confirm) {
- uni.redirectTo({
- url: url
- })
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- })
- },
- 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: '订单创建成功!'
- }, {
- 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: "支付成功"
- })
- let url = '/pages/goods/order_pay_status/index?order_id=' +
- orderId +
- '&msg=支付成功';
- setTimeout(res => {
- uni.redirectTo({
- url: url
- })
- }, 2000)
- },
- fail: (e) => {
- let url = '/pages/goods/order_pay_status/index?order_id=' +
- orderId +
- '&msg=支付失败';
- uni.showModal({
- content: "支付失败",
- showCancel: false,
- success: function(res) {
- if (res.confirm) {
- uni.redirectTo({
- url: url
- })
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- })
- },
- complete: () => {
- uni.hideLoading();
- },
- });
- // #endif
- break;
- }
- }).catch(err => {
- uni.hideLoading();
- return that.$util.Tips({
- title: err
- });
- });
- },
- clickTextArea() {
- this.$refs.textarea.focus()
- },
- bindDateChange: function(e, index) {
- this.confirm[index].value = e.target.value
- },
- bindTimeChange: function(e, index) {
- this.confirm[index].value = e.target.value
- },
- bindSelectChange: function(e, index, item) {
- this.confirm[index].value = item.wordsConfig.list[e.detail.value].val
- },
- getTimeranges(index) {
- this.isShow = true
- this.timerangesIndex = index
- },
- confrim(e) {
- this.isShow = false;
- this.confirm[this.timerangesIndex].value = e.time;
- let arrayNew = [];
- e.val.forEach(item => {
- arrayNew.push(Number(item))
- })
- this.timeranges = arrayNew;
- },
- cancels() {
- this.isShow = false;
- },
- // 单选
- radioChange(e, index, item) {
- this.confirm[index].value = item.wordsConfig.list[e.detail.value].val
- },
- // 多选
- checkboxChange(e, index, item) {
- let obj = e.detail.value;
- let val = '';
- item.wordsConfig.list.forEach((j, jindex) => {
- obj.forEach(x => {
- if (jindex == x) {
- val = val + (val ? ',' : '') + j.val;
- }
- })
- })
- this.confirm[index].value = val
- },
- formVerify() {
- this.pay_close = true;
- },
- SubOrder: function(e) {
- let that = this,
- data = {};
- if (!that.payType) return that.$util.Tips({
- title: '请选择支付方式'
- });
- data = {
- collate_code_id: that.collage_id || that.tableId,
- custom_form: that.confirm,
- real_name: that.contacts,
- phone: that.contactsTel,
- addressId: that.addressId,
- formId: '',
- couponId: that.priceGroup.couponPrice == 0 ? 0 : that.couponId,
- payType: that.payType,
- useIntegral: that.useIntegral,
- bargainId: that.BargainId,
- combinationId: that.combinationId,
- discountId: that.discountId,
- pinkId: that.pinkId,
- seckill_id: that.seckillId,
- mark: that.mark,
- store_id: that.ptype == 6 ? that.system_store.id : (that.deliveryType == 1 ? 0 : that
- .system_store.id || 0),
- 'from': that.from,
- shipping_type: that.tableId ? 4 : 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: '余额不足!'
- });
- uni.showLoading({
- title: '订单支付中'
- });
- // #ifdef MP
- openPaySubscribe().then(() => {
- that.payment(data);
- });
- // #endif
- // #ifndef MP
- that.payment(data);
- // #endif
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- /deep/.uni-date-x--border {
- border: 0;
- }
- /deep/.uni-icons {
- font-size: 0 !important;
- }
- /deep/.uni-date-x {
- color: #999;
- font-size: 15px;
- }
- /deep/.uni-date__x-input {
- font-size: 15px;
- }
- .height-add {
- height: calc(120rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
- height: calc(120rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
- }
- /deep/uni-checkbox[disabled] .uni-checkbox-input {
- background-color: #eee;
- }
- .confirmImg {
- width: 100%;
- }
- /deep/.orderGoods {
- margin-top: 20rpx;
- border-radius: 14rpx;
- }
- .confirmImg .upload {
- padding-bottom: 36rpx;
- }
- .confirmImg .upload .pictrue {
- margin: 22rpx 23rpx 0 0;
- width: 146rpx;
- height: 146rpx;
- position: relative;
- font-size: 24rpx;
- color: #bbb;
- }
- .confirmImg .upload .pictrue:nth-of-type(4n) {
- margin-right: 0;
- }
- .confirmImg .upload .pictrue image {
- width: 100%;
- height: 100%;
- border-radius: 8rpx;
- }
- .confirmImg .upload .pictrue .icon-guanbi1 {
- position: absolute;
- font-size: 45rpx;
- top: -10rpx;
- right: -10rpx;
- }
- .confirmImg .upload .pictrue .close {
- position: absolute;
- width: 26rpx;
- height: 26rpx;
- border-radius: 0 8rpx 0 8rpx;
- background-color: rgba(0, 0, 0, 0.6);
- top: 0;
- right: 0;
- }
- .confirmImg .upload .pictrue .close .iconfont {
- font-size: 24rpx;
- }
- .confirmImg .upload .pictrue .icon-icon25201 {
- color: #bfbfbf;
- font-size: 50rpx;
- }
- .confirmImg .upload .pictrue:nth-last-child(1) {
- border: 1rpx solid #ddd;
- box-sizing: border-box;
- }
- .alipaysubmit {
- display: none;
- }
- .order-submission .line {
- width: 100%;
- height: 4rpx;
- }
- .order-submission .line image {
- width: 100%;
- height: 100%;
- display: block;
- }
- .order-submission .headerCon {
- background-color: #fff;
- box-sizing: border-box;
- .icon-s-bianji {
- width: 44rpx;
- height: 44rpx;
- background: #F5F5F5;
- border-radius: 50%;
- text-align: center;
- line-height: 44rpx;
- font-size: 17rpx;
- color: #666;
- }
- .add-title {
- height: 72rpx;
- padding: 0 26rpx;
- border-bottom: 1px solid #eee;
- .icon {
- height: 32rpx;
- background: #1890FF;
- border-radius: 4rpx;
- font-size: 20rpx;
- font-weight: 400;
- color: #FFFFFF;
- text-align: center;
- line-height: 32rpx;
- padding: 0 6rpx;
- &.orange {
- background: #FE960F;
- }
- &.red {
- background: #E93323;
- }
- }
- .add-text {
- margin-left: 14rpx;
- width: 360rpx;
- }
- .text {
- font-size: 24rpx;
- font-weight: 400;
- color: #999999;
- .icon-jiantou {
- display: inline-block;
- font-size: 20rpx;
- }
- }
- }
- }
- .order-submission .address {
- padding: 0 26rpx;
- height: 130rpx;
- .icon {
- .iconfont {
- width: 44rpx;
- height: 44rpx;
- background: var(--view-minorColorT);
- font-size: 20rpx;
- border-radius: 50%;
- text-align: center;
- line-height: 44rpx;
- color: var(--view-theme);
- margin-left: 26rpx;
- }
- }
- }
- .order-submission .address .addressCon {
- width: 502rpx;
- font-size: 26rpx;
- color: #666;
- }
- .order-submission .address .addressCon .name {
- font-size: 30rpx;
- color: #282828;
- font-weight: bold;
- margin-bottom: 10rpx;
- .nameCon {
- max-width: 244rpx;
- &.on {
- max-width: unset;
- }
- }
- }
- .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 .allAddress {
- width: 100%;
- background: linear-gradient(to bottom, var(--view-theme) 0%, #f5f5f5 100%);
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- padding-top: 24rpx;
- }
- .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;
- }
- .header-title {
- font-size: 36rpx;
- font-weight: 600;
- color: #FFFFFF;
- }
- .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 .headerCon {
- width: 710rpx;
- margin: 0 auto;
- border-radius: 14rpx;
- background-color: #fff;
- }
- .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;
- width: 710rpx;
- border-radius: 14rpx;
- margin: 0 auto;
- margin-top: 14rpx;
- }
- .order-submission .wrapper .item .name {
- position: relative;
- width: 190rpx;
- }
- .order-submission .wrapper .item .asterisk {
- position: absolute;
- color: red;
- left: -15rpx
- }
- .order-submission .wrapper .item {
- padding: 27rpx 30rpx;
- font-size: 30rpx;
- color: #282828;
- border-bottom: 1px solid #f0f0f0;
- }
- .order-submission .wrapper .item.on {
- padding: 17rpx 14rpx 17rpx 30rpx;
- align-items: baseline;
- }
- .order-submission .wrapper .item.on3 {
- align-items: baseline;
- }
- .order-submission .wrapper .item.on2 {
- padding: 17rpx 30rpx;
- }
- .order-submission .wrapper .item .discount {
- font-size: 30rpx;
- color: #999;
- }
- .order-submission .wrapper .item.on .discount,
- .order-submission .wrapper .item.on3 .discount {
- width: 460rpx;
- text-align: right;
- }
- .order-submission .wrapper .item.on3 .discount .city {
- width: 400rpx;
- }
- .order-submission .wrapper .item .discount input {
- text-align: right;
- width: 450rpx;
- }
- .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 .discount .radio {
- margin: 0 22rpx 0 22rpx;
- padding: 10rpx 0;
- }
- .order-submission .wrapper .item .discount .radio /deep/uni-checkbox .uni-checkbox-input {
- border-radius: 0
- }
- .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: 650rpx;
- height: 140rpx;
- border-radius: 3rpx;
- margin-top: 30rpx;
- padding: 25rpx 28rpx;
- box-sizing: border-box;
- }
- .order-submission .wrapper .item .placeholder {
- color: #ccc;
- }
- .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 {
- background-color: #fff;
- padding: 30rpx;
- width: 710rpx;
- border-radius: 14rpx;
- margin: 0 auto;
- margin-top: 14rpx;
- }
- .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;
- height: calc(100rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
- height: calc(100rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
- padding-bottom: calc(0rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
- padding-bottom: calc(0rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
- }
- .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
- }
- .tipaddress {
- position: fixed;
- left: 13%;
- top: 25%;
- // margin-left: -283rpx;
- width: 560rpx;
- height: 614rpx;
- background-color: #fff;
- border-radius: 10rpx;
- z-index: 100;
- text-align: center;
- .top {
- width: 560rpx;
- height: 270rpx;
- border-top-left-radius: 10rpx;
- border-top-right-radius: 10rpx;
- background-image: url(../../../static/images/address.png);
- background-repeat: round;
- background-color: var(--view-theme);
- .tipsphoto {
- display: inline-block;
- width: 200rpx;
- height: 200rpx;
- margin-top: 73rpx;
- }
- }
- .bottom {
- font-size: 32rpx;
- font-weight: 400;
- .font1 {
- font-size: 36rpx;
- font-weight: 600;
- color: #333333;
- margin: 32rpx 0rpx 22rpx;
- }
- .font2 {
- color: #666666;
- margin-bottom: 48rpx;
- }
- .btn {
- width: 360rpx;
- height: 82rpx;
- border-radius: 42rpx;
- background: linear-gradient(to left, var(--view-theme) 0%, #f5f5f5 100%);
- color: #FFFFFF;
- line-height: 82rpx;
- margin: 0 auto;
- }
- }
- }
- .mark {
- position: fixed;
- top: 0;
- left: 0;
- bottom: 0;
- right: 0;
- background: rgba(0, 0, 0, 0.5);
- z-index: 99;
- }
- .table-header {
- width: 710rpx;
- padding: 52rpx 24rpx 46rpx;
- border-radius: 14rpx;
- margin: 0 30rpx;
- background-color: #FFFFFF;
- font-size: 24rpx;
- color: #999999;
- .top {
- display: flex;
- margin-bottom: 18rpx;
- }
- .name {
- flex: 1;
- min-width: 0;
- font-weight: 600;
- font-size: 34rpx;
- color: #333333;
- }
- .number {
- color: #333333;
- }
- .light {
- margin-right: 6rpx;
- font-weight: 600;
- font-size: 34rpx;
- color: var(--view-theme);
- }
- }
- //指派
- .zp-wrap {
- margin-top: 20rpx;
- width: 650rpx;
- height: 216rpx;
- white-space: nowrap;
- .zp-item {
- display: inline-block;
- margin-right: 15rpx;
- padding-top: 34rpx;
- width: 172rpx;
- height: 216rpx;
- // background: #E02020;
- background-color: #fff;
- border-radius: 10rpx;
- .zp-logo {
- display: block;
- width: 106rpx;
- height: 106rpx;
- margin: auto;
- border-radius: 50%;
- background-color: #eee;
- }
- .zp-name {
- margin-top: 15rpx;
- width: 100%;
- text-align: center;
- font-size: 30rpx;
- font-weight: bold;
- color: #333333;
- }
- }
- .choose {
- background-color: #262261 !important;
- .zp-name {
- color: #fff !important;
- }
- }
- }
- </style>
|