index.vue 51 KB

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