index.vue 47 KB

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