index.vue 47 KB

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