index.vue 76 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435
  1. <template>
  2. <view :style="colorStyle">
  3. <view class='order-submission'>
  4. <view class="allAddress" v-if="product_type == 0">
  5. <!-- #ifdef MP -->
  6. <!-- 桌码信息 -->
  7. <view v-if="tableId" class="table-header">
  8. <view class="top">
  9. <view class="name">{{ codeData.storeName.storeName }}</view>
  10. <view class="number"><text class="light">{{ codeData.category.name }}{{ codeData.table_number }}</text>号桌</view>
  11. </view>
  12. <view>{{ codeData.serial_number }}</view>
  13. </view>
  14. <!-- #endif -->
  15. <!-- 地址 -->
  16. <view v-if="!tableId" class='headerCon'>
  17. <view class="add-title acea-row row-between-wrapper">
  18. <view class="acea-row row-middle">
  19. <view class="icon" :class="deliveryType==1?'':deliveryType==3?'orange':'red'">{{deliveryType==1?'商城配送':deliveryType==2?'门店自提':'门店配送'}}</view>
  20. <view class="text add-text line1" v-if="deliveryType==1">由平台为您提供配送服务</view>
  21. <view class="text add-text line1" v-if="deliveryType==2">线上下单,到店自提</view>
  22. <view class="text add-text line1" v-if="deliveryType==3">{{system_store.name || '请选择门店'}}</view>
  23. </view>
  24. <view class="text" @tap='onDelivery' v-if="(isDisplay.length >1 || (isDisplay.length==1 && deliveryType !=1)) && store_func_status && goodsType != 9">点击切换 <text class='iconfont icon-jiantou'></text></view>
  25. </view>
  26. <view class="address acea-row row-between-wrapper" @tap="onAddress(addressInfo.real_name)" v-if="deliveryType==1 || deliveryType==3">
  27. <view class="addressCon" v-if="addressInfo.real_name">
  28. <view class='name acea-row row-middle'><view class="nameCon line1">{{addressInfo.real_name}}</view><text class='phone'>{{addressInfo.phone}}</text></view>
  29. <view class="line1">
  30. <text class='default font-num'
  31. v-if="addressInfo.is_default">[默认]</text>{{addressInfo.province}}{{addressInfo.city}}{{addressInfo.district}}{{addressInfo.street}}{{addressInfo.detail}}
  32. </view>
  33. </view>
  34. <view class='addressCon' v-else>
  35. <view class='setaddress'>设置收货地址</view>
  36. </view>
  37. <view class="iconfont icon-s-bianji"></view>
  38. </view>
  39. <view class="address acea-row row-between-wrapper" v-else>
  40. <view class="addressCon" v-if="storeList.length>0">
  41. <view class='name acea-row row-middle'><view class="nameCon line1 on">{{system_store.name || ''}}</view></view>
  42. <view class="line1">
  43. {{system_store.address || ''}}{{system_store.detailed_address || ''}}
  44. </view>
  45. </view>
  46. <view class='addressCon' v-else>
  47. <view class='setaddress'>暂无门店信息</view>
  48. </view>
  49. <view class="icon acea-row row-middle" v-if="storeList.length>0">
  50. <view class="iconfont icon-dianhua" @click.stop="call(system_store.phone)"></view>
  51. <view class="iconfont icon-dingwei2" @click.stop="showMaoLocation(system_store)"></view>
  52. </view>
  53. </view>
  54. </view>
  55. <view v-if="!tableId" class='line'>
  56. <image src='/static/images/line.jpg'></image>
  57. </view>
  58. </view>
  59. <view class="wrapper">
  60. <group-goods-list v-if="collage_id" :goods-list="goodsList"></group-goods-list>
  61. <orderGoods v-else :cartInfo="cartInfo" :giveData="giveData" :shippingType="shippingType" :product_type='product_type'
  62. :giveCartInfo="giveCartInfo"></orderGoods>
  63. </view>
  64. <view class='wrapper'>
  65. <view class='item acea-row row-between-wrapper' @tap='couponTap'
  66. v-if="!pinkId && !BargainId && !combinationId && !seckillId&& !noCoupon && !discountId && goodsType != 7 && priceGroup.firstOrderPrice==0">
  67. <view>优惠券</view>
  68. <view class='discount'>{{couponTitle}}
  69. <text class='iconfont icon-jiantou'></text>
  70. </view>
  71. </view>
  72. <view class='item acea-row row-between-wrapper' v-if="!pinkId && !BargainId && !combinationId && !seckillId && integral_ratio_status == 1">
  73. <view>积分抵扣</view>
  74. <view class='discount acea-row row-middle'>
  75. <view> {{useIntegral ? "剩余积分":"当前积分"}}
  76. <text class='num font-color'>{{integral || 0}}</text>
  77. </view>
  78. <checkbox-group @change="ChangeIntegral">
  79. <checkbox :disabled="integral<=0 && !useIntegral" :checked='useIntegral ? true : false' />
  80. </checkbox-group>
  81. </view>
  82. </view>
  83. <view v-if="invoice_func || special_invoice" class='item acea-row row-between-wrapper' @tap="goInvoice">
  84. <view>开具发票</view>
  85. <view class='discount'>
  86. {{invTitle}}
  87. <text class='iconfont icon-jiantou'></text>
  88. </view>
  89. </view>
  90. <!-- <view class='item acea-row row-between-wrapper' v-if="priceGroup.vipPrice > 0 && userInfo.vip && !pinkId && !BargainId && !combinationId && !seckillId">
  91. <view>会员优惠</view>
  92. <view class='discount'>-¥{{priceGroup.vipPrice}}</view>
  93. </view>
  94. <view class='item acea-row row-between-wrapper' v-if='shippingType==0'>
  95. <view>快递费用</view>
  96. <view class='discount' v-if='priceGroup.storePostage > 0'>+¥{{priceGroup.storePostage}}</view>
  97. <view class='discount' v-else>免运费</view>
  98. </view> -->
  99. <view v-if="shippingType == 1">
  100. <view class="item acea-row row-between-wrapper">
  101. <view>联系人</view>
  102. <view class="discount">
  103. <input v-model="contacts" type="text" placeholder="请填写您的联系姓名" placeholder-class="placeholder"></input>
  104. </view>
  105. </view>
  106. <view class="item acea-row row-between-wrapper">
  107. <view>联系电话</view>
  108. <view class="discount">
  109. <input type="number" maxlength="11" v-model="contactsTel" placeholder="请填写您的联系电话"
  110. placeholder-class="placeholder"></input>
  111. </view>
  112. </view>
  113. </view>
  114. <!-- <view class='item acea-row row-between-wrapper' wx:else>
  115. <view>自提门店</view>
  116. <view class='discount'>{{system_store.name}}</view>
  117. </view> -->
  118. <view class='item' v-if="textareaStatus">
  119. <view>备注信息</view>
  120. <!-- <view class="placeholder-textarea"> -->
  121. <textarea placeholder-class='placeholder' placeholder="请添加备注(150字以内)" :always-embed="true" :adjust-position="true" cursor-spacing="30" v-if="!coupon.coupon"
  122. @input='bindHideKeyboard' :value="mark" :maxlength="150" name="mark">
  123. </textarea>
  124. <!-- <view class="placeholder" @click="clickTextArea" v-show="!mark">
  125. 请添加备注(150字以内)
  126. </view> -->
  127. <!-- </view> -->
  128. </view>
  129. </view>
  130. <view class='wrapper' v-if="confirm.length">
  131. <view class='item acea-row row-between-wrapper' :class="{on:(item.name=='radios' || item.name=='checkboxs'),on2:item.name == 'dateranges',on3:item.name == 'citys'}" v-for="(item,index) in confirm" :key="index">
  132. <view class="name">
  133. <span class="asterisk" v-if="item.titleShow.val">*</span>
  134. {{ item.titleConfig.value }}
  135. </view>
  136. <!-- radio -->
  137. <view v-if="item.name=='radios'" class="discount">
  138. <radio-group @change="radioChange(e, index, item)" class="acea-row row-middle row-right">
  139. <label class="radio" v-for="(j,jindex) in item.wordsConfig.list" :key="jindex">
  140. <view class="acea-row row-middle">
  141. <!-- #ifndef MP -->
  142. <radio :value="jindex.toString()" :checked='j.show'/>
  143. <!-- #endif -->
  144. <!-- #ifdef MP -->
  145. <radio :value="jindex" :checked='j.show'/>
  146. <!-- #endif -->
  147. <view>{{j.val}}</view>
  148. </view>
  149. </label>
  150. </radio-group>
  151. </view>
  152. <!-- checkbox -->
  153. <view v-if="item.name=='checkboxs'" class="discount">
  154. <checkbox-group @change="checkboxChange($event, index, item)" class="acea-row row-middle row-right">
  155. <label class="radio" v-for="(j,jindex) in item.wordsConfig.list" :key="jindex">
  156. <view class="acea-row row-middle">
  157. <!-- #ifndef MP -->
  158. <checkbox :value="jindex.toString()" :checked="j.show" style="transform:scale(0.9)" />
  159. <!-- #endif -->
  160. <!-- #ifdef MP -->
  161. <checkbox :value="jindex" :checked="j.show" style="transform:scale(0.9)" />
  162. <!-- #endif -->
  163. <view>{{j.val}}</view>
  164. </view>
  165. </label>
  166. </checkbox-group>
  167. </view>
  168. <!-- text -->
  169. <view v-if="item.name=='texts' && item.valConfig.tabVal == 0" class="discount">
  170. <input type="text" :placeholder="item.tipConfig.value" placeholder-class="placeholder" v-model="item.value" />
  171. </view>
  172. <!-- number -->
  173. <view v-if="item.name=='texts' && item.valConfig.tabVal == 4" class="discount">
  174. <input type="number" :placeholder="item.tipConfig.value" placeholder-class="placeholder" v-model="item.value" />
  175. </view>
  176. <!-- email -->
  177. <view v-if="item.name=='texts' && item.valConfig.tabVal == 3" class="discount">
  178. <input type="text" :placeholder="item.tipConfig.value" placeholder-class="placeholder" v-model="item.value" />
  179. </view>
  180. <!-- data -->
  181. <view v-if="item.name=='dates'" class="discount">
  182. <picker mode="date" :value="item.value" @change="bindDateChange($event,index)">
  183. <view class="acea-row row-between-wrapper">
  184. <view v-if="item.value == ''">{{item.tipConfig.value}}</view>
  185. <view v-else>{{item.value}}</view>
  186. <text class='iconfont icon-jiantou'></text>
  187. </view>
  188. </picker>
  189. </view>
  190. <!-- dateranges -->
  191. <view v-if="item.name=='dateranges'" class="discount">
  192. <uni-datetime-picker v-model="item.value" type="daterange" @maskClick="maskClick">
  193. {{item.value.length?item.value[0]+' - '+item.value[1]:item.tipConfig.value}}
  194. <text class='iconfont icon-jiantou'></text>
  195. </uni-datetime-picker>
  196. </view>
  197. <!-- time -->
  198. <view v-if="item.name=='times'" class="discount">
  199. <picker mode="time" :value="item.value" @change="bindTimeChange($event,index)"
  200. :placeholder="item.tipConfig.value">
  201. <view class="acea-row row-between-wrapper">
  202. <view v-if="item.value == ''">{{item.tipConfig.value}}</view>
  203. <view v-else>{{item.value}}</view>
  204. <text class='iconfont icon-jiantou'></text>
  205. </view>
  206. </picker>
  207. </view>
  208. <!-- timeranges -->
  209. <view v-if="item.name=='timeranges'" class="discount acea-row row-between-wrapper" @click="getTimeranges(index)">
  210. <view v-if="item.value">{{item.value}}</view>
  211. <view v-else>{{item.tipConfig.value}}</view>
  212. <text class='iconfont icon-jiantou'></text>
  213. </view>
  214. <!-- select -->
  215. <view v-if="item.name=='selects'" class="discount">
  216. <picker :value="item.value" :range="item.wordsConfig.list" @change="bindSelectChange($event,index,item)" range-key="val">
  217. <view class="acea-row row-between-wrapper">
  218. <view v-if="item.value == ''">请选择</view>
  219. <view v-else>{{item.value}}</view>
  220. <text class='iconfont icon-jiantou'></text>
  221. </view>
  222. </picker>
  223. </view>
  224. <!-- city -->
  225. <view v-if="item.name=='citys'" class="discount" @click="changeRegion(index)">
  226. <view class="acea-row row-middle row-right">
  227. <view class="city" v-if="item.value == ''">{{item.tipConfig.value}}</view>
  228. <view class="city" v-else>{{item.value}}</view>
  229. <text class='iconfont icon-jiantou'></text>
  230. </view>
  231. </view>
  232. <!-- id -->
  233. <view v-if="item.name=='texts' && item.valConfig.tabVal == 2" class="discount">
  234. <input type="idcard" :placeholder="item.tipConfig.value" placeholder-class="placeholder" v-model="item.value" />
  235. </view>
  236. <!-- phone -->
  237. <view v-if="item.name=='texts' && item.valConfig.tabVal == 1" class="discount">
  238. <input type="number" :placeholder="item.tipConfig.value" placeholder-class="placeholder" v-model="item.value" />
  239. </view>
  240. <!-- img -->
  241. <view v-if="item.name=='uploadPicture'" class="confirmImg">
  242. <view class='upload acea-row row-middle'>
  243. <view class='pictrue' v-for="(items,indexs) in item.value" :key="indexs">
  244. <image :src='items' mode="aspectFill"></image>
  245. <!-- <view class='iconfont icon-guanbi1 font-num' @tap='DelPic(index,indexs)'></view> -->
  246. <view class="close acea-row row-center-wrapper" @tap='DelPic(index,indexs)'>
  247. <view class="iconfont icon-guanbi5"></view>
  248. </view>
  249. </view>
  250. <view class='pictrue acea-row row-center-wrapper row-column' @tap='uploadpic(index)'
  251. v-if="item.value.length < item.numConfig.val">
  252. <text class='iconfont icon-icon25201'></text>
  253. <view>上传图片</view>
  254. </view>
  255. </view>
  256. </view>
  257. </view>
  258. </view>
  259. <view class='moneyList'>
  260. <view class='item acea-row row-between-wrapper'>
  261. <view>商品总价:</view>
  262. <!-- {{(parseFloat(priceGroup.totalPrice)+parseFloat(priceGroup.vipPrice)).toFixed(2)}} -->
  263. <view class='money'>
  264. ¥{{priceGroup.sumPrice}}
  265. </view>
  266. </view>
  267. <view class='item acea-row row-between-wrapper' v-if="priceGroup.storePostage > 0">
  268. <view>配送运费:</view>
  269. <view class='money'>
  270. ¥{{(parseFloat(priceGroup.storePostage)+parseFloat(priceGroup.storePostageDiscount)).toFixed(2)}}
  271. </view>
  272. </view>
  273. <view class='item acea-row row-between-wrapper'
  274. v-if="priceGroup.vipPrice > 0 && userInfo.vip && !pinkId && !BargainId && !combinationId && !seckillId && !discountId">
  275. <view>会员商品优惠:</view>
  276. <view class='money'>-¥{{parseFloat(priceGroup.vipPrice).toFixed(2)}}</view>
  277. </view>
  278. <view class='item acea-row row-between-wrapper' v-if="priceGroup.storePostageDiscount > 0">
  279. <view>会员运费优惠:</view>
  280. <view class='money'>-¥{{parseFloat(priceGroup.storePostageDiscount).toFixed(2)}}</view>
  281. </view>
  282. <view class='item acea-row row-between-wrapper' v-if="coupon_price > 0">
  283. <view>优惠券抵扣:</view>
  284. <view class='money'>-¥{{parseFloat(coupon_price).toFixed(2)}}</view>
  285. </view>
  286. <view class='item acea-row row-between-wrapper' v-if="parseFloat(priceGroup.firstOrderPrice) > 0">
  287. <view>新人首单优惠:</view>
  288. <view class='money'>-¥{{parseFloat(priceGroup.firstOrderPrice).toFixed(2)}}</view>
  289. </view>
  290. <view class='item acea-row row-between-wrapper' v-if="integral_price > 0">
  291. <view>积分抵扣:</view>
  292. <view class='money'>-¥{{parseFloat(integral_price).toFixed(2)}}</view>
  293. </view>
  294. <view class='item acea-row row-between' v-for="(item,index) in promotions_detail" :key="index"
  295. v-if="parseFloat(item.promotions_price)">
  296. <view>{{item.title}}:</view>
  297. <view class='money'>-¥{{parseFloat(item.promotions_price).toFixed(2)}}</view>
  298. </view>
  299. <!-- <view class='item acea-row row-between-wrapper' v-if="priceGroup.storePostage > 0">
  300. <view>运费:</view>
  301. <view class='money'>+¥{{priceGroup.storePostage}}</view>
  302. </view>
  303. <view class='item acea-row row-between-wrapper' v-if="priceGroup.storePostageDiscount > 0">
  304. <view>会员运费抵扣:</view>
  305. <view class='money'>-¥{{priceGroup.storePostageDiscount}}</view>
  306. </view> -->
  307. </view>
  308. <view class="height-add"></view>
  309. <view class='footer acea-row row-between-wrapper'>
  310. <view>合计:
  311. <text class='font-color'>¥{{totalPrice || 0}}</text>
  312. </view>
  313. <!-- <view class='settlement' style='z-index:100' @tap.stop="goPay"
  314. v-if="(((valid_count>0&&!discount_id) || (valid_count==cartInfo.length&&discount_id)) && shippingType) || (!shippingType && addressId) || product_type != 0">
  315. 立即结算</view>
  316. <view class='settlement bg-color-hui' style='z-index:100' v-else>立即结算</view> -->
  317. <view class='settlement' style='z-index:100' @tap.stop="goPay"
  318. v-if="
  319. (((valid_count>0&&!discount_id) || (valid_count==cartInfo.length&&discount_id))) ||
  320. (deliveryType == 2 && !shippingType) ||
  321. (deliveryType == 3 && shippingType) ||
  322. product_type != 0"
  323. >
  324. 提交订单</view>
  325. <view class='settlement bg-color-hui' style='z-index:100' v-else>提交订单</view>
  326. </view>
  327. </view>
  328. <view class="alipaysubmit" v-html="formContent"></view>
  329. <view class="tipaddress" v-show="isaddress">
  330. <view class="top"></view>
  331. <view class="bottom">
  332. <div class="font1">更新地址</div>
  333. <div class="font2">当前地址功能已更新,请重新修改</div>
  334. <div class="btn" @tap="payAddress">前往修改</div>
  335. </view>
  336. </view>
  337. <view class="mark" v-show="isaddress"></view>
  338. <couponListWindow :coupon='coupon' @ChangCouponsClone="ChangCouponsClone" :openType='openType' :cartId='cartId'
  339. @ChangCoupons="ChangCoupons"></couponListWindow>
  340. <addressWindow ref="addressWindow" @changeTextareaStatus="changeTextareaStatus" :news='news' :address='address'
  341. :pagesUrl="pagesUrl" @OnChangeAddress="OnChangeAddress" @changeClose="changeClose">
  342. </addressWindow>
  343. <home v-show="!invShow && navigation"></home>
  344. <invoice-picker :inv-show="invShow" :inv-list="invList" :inv-checked="invChecked" :is-special="special_invoice"
  345. :url-query="urlQuery" @inv-close="invClose" @inv-change="invChange" @inv-cancel="invCancel">
  346. </invoice-picker>
  347. <payment :payMode="cartArr" :pay_close="pay_close" :isCall="true" :totalPrice="totalPrice.toString()"
  348. @changePayType="changePayType" @onChangeFun="onChangeFun"></payment>
  349. <deliveryMethod ref="deliveryMethod" :isDisplay="isDisplay" :storeList="storeList" :storeSelfMention="store_self_mention" @deliveryFun="deliveryFun" @storeFun="storeFun"></deliveryMethod>
  350. <!-- #ifdef MP -->
  351. <!-- <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize> -->
  352. <!-- #endif -->
  353. <timeranges :isShow='isShow' :time='timeranges' @confrim="confrim" @cancel="cancels"></timeranges>
  354. <areaWindow ref="areaWindow" :display="display" :address='addressInfoArea' :cityShow='cityShow' @submit="OnAreaAddress" @changeClose="changeAddressClose"></areaWindow>
  355. </view>
  356. </template>
  357. <script>
  358. const CACHE_CITY = {};
  359. import dayjs from '@/plugin/dayjs/dayjs.min.js';
  360. import {
  361. orderConfirm,
  362. getCouponsOrderPrice,
  363. orderCreate,
  364. postOrderComputed,
  365. checkShipping
  366. } from '@/api/order.js';
  367. import {
  368. getAddressDefault,
  369. getAddressDetail,
  370. invoiceList,
  371. invoiceOrder
  372. } from '@/api/user.js';
  373. import {
  374. openPaySubscribe
  375. } from '@/utils/SubscribeMessage.js';
  376. import {
  377. storeListApi,
  378. getCollagePartake,
  379. getCodeData
  380. } from '@/api/store.js';
  381. import {
  382. CACHE_LONGITUDE,
  383. CACHE_LATITUDE
  384. } from '@/config/cache.js';
  385. import areaWindow from '@/components/areaWindow';
  386. import couponListWindow from '@/components/couponListWindow';
  387. import addressWindow from '@/components/addressWindow';
  388. import orderGoods from '@/components/orderGoods';
  389. import deliveryMethod from '../components/deliveryMethod/index.vue';
  390. import timeranges from '@/components/timeranges';
  391. import home from '@/components/home';
  392. import invoicePicker from '../components/invoicePicker';
  393. import groupGoodsList from '@/components/groupGoodsList/index.vue'
  394. import {
  395. toLogin
  396. } from '@/libs/login.js';
  397. import {
  398. mapGetters
  399. } from "vuex";
  400. import payment from '@/components/payment';
  401. import colors from "@/mixins/color";
  402. export default {
  403. components: {
  404. payment,
  405. invoicePicker,
  406. couponListWindow,
  407. addressWindow,
  408. orderGoods,
  409. home,
  410. deliveryMethod,
  411. timeranges,
  412. areaWindow,
  413. groupGoodsList
  414. },
  415. mixins: [colors],
  416. data() {
  417. return {
  418. addressInfoArea: [],
  419. cityShow: 2,
  420. display: false,
  421. timeranges:[],
  422. isShow:false,
  423. giveData: {
  424. give_integral: 0,
  425. give_coupon: []
  426. },
  427. giveCartInfo: [],
  428. confirm: [], //自定义留言
  429. id: 0,
  430. isaddress: false,
  431. textareaStatus: true,
  432. //支付方式
  433. cartArr: [{
  434. "name": "微信支付",
  435. "icon": "icon-weixin2",
  436. value: 'weixin',
  437. title: '使用微信快捷支付',
  438. payStatus: 1,
  439. },
  440. {
  441. "name": "支付宝支付",
  442. "icon": "icon-zhifubao",
  443. value: 'alipay',
  444. title: '使用线上支付宝支付',
  445. payStatus: 1,
  446. },
  447. {
  448. "name": "余额支付",
  449. "icon": "icon-yuezhifu",
  450. value: 'yue',
  451. title: '可用余额:',
  452. payStatus: 1,
  453. },
  454. {
  455. "name": "线下支付",
  456. "icon": "icon-yuezhifu1",
  457. value: 'offline',
  458. title: '选择线下付款方式',
  459. payStatus: 2,
  460. }
  461. ],
  462. formContent: '',
  463. payType: 'weixin', //支付方式
  464. openType: 1, //优惠券打开方式 1=使用
  465. active: 0, //支付方式切换
  466. coupon: {
  467. coupon: false,
  468. list: [],
  469. statusTile: '立即使用'
  470. }, //优惠券组件
  471. address: {
  472. address: false
  473. }, //地址组件
  474. addressInfo: {}, //地址信息
  475. pinkId: 0, //拼团id
  476. addressId: 0, //地址id
  477. couponId: 0, //优惠券id
  478. cartId: '', //购物车id
  479. BargainId: 0,
  480. combinationId: 0,
  481. seckillId: 0,
  482. discountId: 0,
  483. userInfo: {}, //用户信息
  484. mark: '', //备注信息
  485. couponTitle: '请选择', //优惠券
  486. coupon_price: 0, //优惠券抵扣金额
  487. promotions_detail: [], //优惠活动金额明细
  488. useIntegral: false, //是否使用积分
  489. integral_price: 0, //积分抵扣金额
  490. integral: 0,
  491. ChangePrice: 0, //使用积分抵扣变动后的金额
  492. formIds: [], //收集formid
  493. status: 0,
  494. is_address: false,
  495. toPay: false, //修复进入支付时页面隐藏从新刷新页面
  496. shippingType: 0,
  497. system_store: {},
  498. storePostage: 0,
  499. contacts: '',
  500. contactsTel: '',
  501. mydata: {},
  502. storeList: [],
  503. store_self_mention: 0,//是开启门店自提;
  504. store_func_status: false,//是否开启门店自提和门店配送;
  505. cartInfo: [],
  506. priceGroup: {},
  507. animated: false,
  508. totalPrice: 0,
  509. integralRatio: "0",
  510. pagesUrl: "",
  511. orderKey: "",
  512. // usableCoupon: {},
  513. offlinePostage: "",
  514. isAuto: false, //没有授权的不会自动授权
  515. isShowAuth: false, //是否隐藏授权
  516. from: '',
  517. news: 1,
  518. invTitle: '不开发票',
  519. special_invoice: false,
  520. invoice_func: false,
  521. integral_ratio_status : 1,
  522. header_type: '',
  523. invShow: false,
  524. invList: [],
  525. invChecked: '',
  526. urlQuery: '',
  527. pay_close: false,
  528. noCoupon: 0,
  529. valid_count: 0,
  530. discount_id: 0,
  531. storeId: 0,
  532. product_type: 1,
  533. newImg: [],
  534. isDisplay: [],
  535. deliveryType:1,
  536. goodsType:0,
  537. product_id:0,
  538. selectIndex:0,
  539. timerangesIndex:0,
  540. collage_id: 0,
  541. goodsList: [],
  542. tableId: 0,
  543. codeData: {}
  544. };
  545. },
  546. computed: mapGetters(['isLogin']),
  547. onLoad: function(options) {
  548. // #ifdef H5
  549. this.from = this.$wechat.isWeixin() ? 'weixin' : 'weixinh5'
  550. // #endif
  551. // #ifdef MP
  552. this.from = 'routine'
  553. // #endif
  554. if (!options.cartId) return this.$util.Tips({
  555. title: '请选择要购买的商品'
  556. }, {
  557. tab: 3,
  558. url: 1
  559. });
  560. this.deliveryType = options.delivery_type || 1;
  561. if(this.deliveryType == 1 || this.deliveryType == 3){
  562. this.addressId = options.addressId || 0;
  563. this.system_store.name = options.store_name;
  564. }
  565. if(this.deliveryType == 2 || this.deliveryType == 3){
  566. this.storeId = options.store_id || 0;
  567. this.system_store.id = options.store_id || 0;
  568. }
  569. this.couponId = options.couponId || 0;
  570. this.noCoupon = options.noCoupon || 0;
  571. this.product_id = options.product_id || 0;
  572. this.pinkId = options.pinkId ? parseInt(options.pinkId) : 0;
  573. this.cartId = options.cartId;
  574. this.is_address = options.is_address ? true : false;
  575. this.news = !options.new || options.new === '0' ? 0 : 1;
  576. uni.setStorageSync('news', this.news);
  577. this.invChecked = options.invoice_id || '';
  578. this.header_type = options.header_type || '1';
  579. this.couponTitle = options.couponTitle || '请选择'
  580. switch (options.invoice_type) {
  581. case '1':
  582. this.invTitle = '增值税电子普通发票';
  583. break;
  584. case '2':
  585. this.invTitle = '增值税电子专用发票';
  586. break;
  587. }
  588. if (options.invoice_name) {
  589. this.invTitle = options.invoice_name;
  590. }
  591. // #ifndef APP-PLUS
  592. this.textareaStatus = true;
  593. // #endif
  594. if (this.isLogin && this.toPay == false) {
  595. this.getCheckShipping();
  596. } else {
  597. toLogin();
  598. }
  599. this.collage_id = options.collage_id || 0;
  600. if (this.collage_id) {
  601. this.getCollagePartake();
  602. }
  603. // #ifdef MP
  604. // 桌码
  605. this.tableId = options.tableId || 0;
  606. if (this.tableId) {
  607. this.getCodeData();
  608. }
  609. // #endif
  610. },
  611. /**
  612. * 生命周期函数--监听页面显示
  613. */
  614. onShow: function() {
  615. uni.removeStorageSync('form_type_cart');
  616. let _this = this
  617. uni.$on("handClick", res => {
  618. if (res) {
  619. _this.system_store = res.address
  620. _this.storeId = _this.system_store.id
  621. _this.cartId = res.cartId
  622. _this.news = res.new
  623. _this.pinkId = Number(res.pinkId)
  624. _this.couponId = res.couponId
  625. _this.getConfirm()
  626. }
  627. // 清除监听
  628. uni.$off('handClick');
  629. })
  630. let current = (dayjs(new Date(Number(new Date().getTime()))).format('HH:mm')).split(':');
  631. let currentArray = current;
  632. currentArray.push(0);
  633. let arrayNew = [];
  634. [...currentArray,...current].forEach(item=>{
  635. arrayNew.push(Number(item))
  636. })
  637. this.timeranges = arrayNew;
  638. },
  639. methods: {
  640. // #ifdef MP
  641. // 桌码信息
  642. getCodeData() {
  643. getCodeData({
  644. tableId: this.tableId
  645. }).then(res => {
  646. this.codeData = res.data;
  647. });
  648. },
  649. // #endif
  650. getCollagePartake() {
  651. getCollagePartake({
  652. collage_id: this.collage_id
  653. }).then(res => {
  654. this.goodsList = res.data;
  655. });
  656. },
  657. OnAreaAddress(address){
  658. let addr = '';
  659. if (address.length==4){
  660. addr = address[0].label+'/'+address[1].label+'/'+address[2].label+'/'+address[3].label;
  661. }else if (address.length==3){
  662. addr = address[0].label+'/'+address[1].label+'/'+address[2].label;
  663. }else if(address.length==2){
  664. addr = address[0].label+'/'+address[1].label;
  665. }else{
  666. addr = address[0].label;
  667. }
  668. this.confirm[this.timerangesIndex].value = addr;
  669. CACHE_CITY[this.timerangesIndex] = address;
  670. },
  671. changeRegion(index){
  672. if(!this.confirm[index].value){
  673. this.addressInfoArea = [];
  674. }
  675. this.timerangesIndex = index;
  676. this.cityShow = Number(this.confirm[index].valConfig.tabVal) + 1;
  677. this.display = true;
  678. if(CACHE_CITY[index]){
  679. this.addressInfoArea = CACHE_CITY[index];
  680. }
  681. },
  682. // 关闭地址弹窗;
  683. changeAddressClose: function() {
  684. this.display = false;
  685. },
  686. maskClick(e) {
  687. console.log(e);
  688. },
  689. // 授权关闭
  690. authColse: function(e) {
  691. this.isShowAuth = e
  692. },
  693. showMaoLocation(e) {
  694. let self = this;
  695. // #ifdef H5
  696. if (self.$wechat.isWeixin()) {
  697. self.$wechat.seeLocation({
  698. latitude: Number(e.latitude),
  699. longitude: Number(e.longitude),
  700. name: e.name,
  701. scale: 13,
  702. address: `${e.address}-${e.detailed_address}`,
  703. }).then(res => {})
  704. } else {
  705. // #endif
  706. uni.openLocation({
  707. latitude: Number(e.latitude),
  708. longitude: Number(e.longitude),
  709. name: e.name,
  710. address: `${e.address}-${e.detailed_address}`,
  711. success: function() {
  712. Number
  713. }
  714. });
  715. // #ifdef H5
  716. }
  717. // #endif
  718. },
  719. call(phone) {
  720. uni.makePhoneCall({
  721. phoneNumber: phone,
  722. });
  723. },
  724. // 选中配送类型
  725. deliveryFun(e,item){
  726. this.deliveryType = e;
  727. this.$refs.deliveryMethod.module = false;
  728. if(e==2){
  729. this.storeId = item.id;
  730. }else{
  731. if(e == 3){
  732. this.storeId = item.id;
  733. if(this.isDisplay.includes("2") && this.isDisplay.includes("3")){
  734. this.getaddressInfo();
  735. this.$nextTick(function() {
  736. this.$refs.addressWindow.getAddressList();
  737. })
  738. }
  739. }
  740. this.system_store = item;
  741. }
  742. if(e == 1 || e == 3){
  743. this.addressType(0,e);
  744. }else{
  745. this.addressType(1,e);
  746. }
  747. },
  748. // 选择配送方式
  749. onDelivery() {
  750. this.$refs.deliveryMethod.module = true
  751. },
  752. // 子集调用门店列表接口
  753. storeFun(index){
  754. this.getList(1,index);
  755. },
  756. // 是否显示快递配送
  757. getCheckShipping() {
  758. let data = {
  759. cartId: this.cartId,
  760. new: this.news
  761. }
  762. checkShipping(data).then(res => {
  763. // 1:快递配送,2:到店自提,3:门店配送
  764. res.data.type.sort((x,y)=>x - y)//正序
  765. this.isDisplay = res.data.type;
  766. if (((this.isDisplay.includes("2") && this.isDisplay.length == 1) || (this.deliveryType == 2 && !this.tableId) || (this.deliveryType == 3 && this.storeId>0 && !this.system_store.name)) && this.isDisplay.length) {
  767. if((this.deliveryType == 2 || (this.deliveryType == 3 && !this.isDisplay.includes("3"))) && this.isDisplay.includes("2")){
  768. this.deliveryType = 2
  769. this.addressType(1,this.deliveryType);
  770. }
  771. if((this.deliveryType == 3 || (this.deliveryType == 2 && !this.isDisplay.includes("2"))) && this.isDisplay.includes("3")){
  772. this.deliveryType = 3
  773. this.addressType(0,this.deliveryType);
  774. this.getaddressInfo();
  775. this.$nextTick(function() {
  776. this.$refs.addressWindow.getAddressList();
  777. })
  778. }
  779. } else {
  780. this.getaddressInfo();
  781. this.getConfirm();
  782. this.$nextTick(function() {
  783. this.$refs.addressWindow.getAddressList();
  784. })
  785. }
  786. }).catch(err => {
  787. uni.showToast({
  788. title: err,
  789. icon: 'none'
  790. });
  791. })
  792. },
  793. /**
  794. * 删除图片
  795. *
  796. */
  797. DelPic: function(index, indexs) {
  798. let that = this,
  799. pic = this.confirm[index].value;
  800. that.confirm[index].value.splice(indexs, 1);
  801. that.$set(that.confirm[index], 'value', that.confirm[index].value);
  802. },
  803. /**
  804. * 上传文件
  805. *
  806. */
  807. uploadpic: function(index) {
  808. let that = this;
  809. this.$util.uploadImageOne('upload/image', function(res) {
  810. that.newImg.push(res.data.url);
  811. that.$set(that.confirm[index], 'value', that.newImg);
  812. });
  813. },
  814. // 不开发票
  815. invCancel() {
  816. this.invChecked = '';
  817. this.invTitle = '不开发票';
  818. this.invShow = false;
  819. },
  820. // 选择发票
  821. invChange(id) {
  822. this.invChecked = id;
  823. this.invShow = false;
  824. const result = this.invList.find(item => item.id === id);
  825. let name = '';
  826. name += result.header_type === 1 ? '个人' : '企业';
  827. name += result.type === 1 ? '普通' : '专用';
  828. name += '发票';
  829. this.invTitle = name;
  830. },
  831. // 关闭发票
  832. invClose() {
  833. this.invShow = false;
  834. this.getInvoiceList()
  835. },
  836. getInvoiceList() {
  837. uni.showLoading({
  838. title: '正在加载…'
  839. })
  840. invoiceList().then(res => {
  841. uni.hideLoading();
  842. this.invList = res.data.map(item => {
  843. item.id = item.id.toString();
  844. return item;
  845. });
  846. const result = this.invList.find(item => item.id == this.invChecked);
  847. if (result) {
  848. let name = '';
  849. name += result.header_type === 1 ? '个人' : '企业';
  850. name += result.type === 1 ? '普通' : '专用';
  851. name += '发票';
  852. this.invTitle = name;
  853. }
  854. }).catch(err => {
  855. uni.showToast({
  856. title: err,
  857. icon: 'none'
  858. });
  859. });
  860. },
  861. /**
  862. * 开发票
  863. */
  864. goInvoice: function() {
  865. this.getInvoiceList()
  866. this.invShow = true;
  867. this.urlQuery =
  868. `new=${this.news}&cartId=${this.cartId}&pinkId=${this.pinkId}&couponId=${this.couponId}&addressId=${this.addressId}&specialInvoice=${this.special_invoice}&couponTitle=${this.couponTitle}&delivery_type=${this.deliveryType}&store_id=${this.storeId}&store_name=${this.system_store.name}&product_id=${this.product_id}`;
  869. },
  870. /**
  871. * 授权回调事件
  872. *
  873. */
  874. onLoadFun: function() {
  875. this.getCheckShipping();
  876. this.isShowAuth = false;
  877. //调用子页面方法授权后执行获取地址列表
  878. // this.$scope.selectComponent('#address-window').getAddressList();
  879. },
  880. /**
  881. * 事件回调
  882. *
  883. */
  884. onChangeFun: function(e) {
  885. let opt = e;
  886. let action = opt.action || null;
  887. let value = opt.value != undefined ? opt.value : null;
  888. action && this[action] && this[action](value);
  889. },
  890. payClose: function() {
  891. this.pay_close = false;
  892. },
  893. goPay() {
  894. uni.showModal({
  895. title: '温馨提示',
  896. content: '此笔交易一旦确认支付,将无法申请退款!(除质量问题可换货)',
  897. success: res => {
  898. if(res.confirm){
  899. this.formVerify();
  900. }
  901. },
  902. fail: () => {},
  903. complete: () => {}
  904. });
  905. },
  906. payCheck(type) {
  907. this.payType = type;
  908. this.SubOrder();
  909. },
  910. payAddress() {
  911. uni.navigateTo({
  912. // /pages/users/user_address/index?id=25&cartId=76179610656654229504&pinkId=0&couponId=0&new=1
  913. url: '/pages/users/user_address/index?id=' + this.id + '&new=' + this.news + '&cartId=' + this.cartId +
  914. '&pinkId=' +
  915. this.pinkId +
  916. '&couponId=' +
  917. this.couponId +'&delivery_type='+this.deliveryType+'&addressId='+this.addressId+'&store_id='+this.storeId+'&store_name='+ this.system_store.name+'&product_id='+this.product_id
  918. })
  919. },
  920. /**
  921. * 获取门店列表数据
  922. */
  923. getList: function(fromType,index) {
  924. let longitude = uni.getStorageSync("user_longitude"); //经度
  925. let latitude = uni.getStorageSync("user_latitude"); //纬度
  926. let data = {
  927. latitude: latitude, //纬度
  928. longitude: longitude, //经度
  929. page: 1,
  930. limit: 100,
  931. type: this.seckillId>0?1:0,
  932. product_id: this.product_id,
  933. is_store: index
  934. }
  935. storeListApi(data).then(res => {
  936. let list = res.data.list.list || [];
  937. this.$set(this, 'storeList', list);
  938. this.$set(this, 'storeId', this.storeId !=0?this.storeId:list[0].id);
  939. list.forEach(item=>{
  940. if(this.storeId == item.id){
  941. this.$set(this, 'system_store', item);
  942. }
  943. })
  944. if(fromType !=1 ){
  945. this.getConfirm();
  946. }
  947. }).catch(err => {})
  948. },
  949. // 关闭地址弹窗;
  950. changeClose: function() {
  951. this.$set(this.address, 'address', false);
  952. },
  953. /*
  954. * 跳转门店列表
  955. */
  956. showStoreList: function() {
  957. let _this = this
  958. if (this.storeList.length > 0) {
  959. uni.navigateTo({
  960. url: `/pages/store/store_list/index?type=1&cartId=${_this.cartId}&new=${_this.news}&pinkId=${_this.pinkId}&couponId=${_this.couponId}`
  961. })
  962. }
  963. },
  964. changePayType(type) {
  965. this.payType = type
  966. this.computedPrice()
  967. },
  968. computedPrice: function() {
  969. let shippingType = this.shippingType;
  970. postOrderComputed(this.orderKey, {
  971. addressId: this.addressId,
  972. useIntegral: this.useIntegral ? 1 : 0,
  973. couponId: this.priceGroup.couponPrice == 0 ? 0 : this.couponId,
  974. shipping_type: this.tableId ? 4 : parseInt(shippingType) + 1,
  975. payType: this.payType
  976. }).then(res => {
  977. let result = res.data.result;
  978. if (result) {
  979. this.totalPrice = result.pay_price;
  980. this.integral_price = result.deduction_price;
  981. this.coupon_price = result.coupon_price;
  982. this.promotions_detail = result.promotions_detail;
  983. this.integral = this.useIntegral ? result.SurplusIntegral : this.userInfo.integral;
  984. this.$set(this.priceGroup, 'storePostage', shippingType == 1 ? 0 : result.pay_postage);
  985. this.$set(this.priceGroup, 'storePostageDiscount', result.storePostageDiscount);
  986. }
  987. }).catch(err => {
  988. return that.$util.Tips({
  989. title: err
  990. });
  991. })
  992. },
  993. addressType: function(e,type) {
  994. let index = e;
  995. this.shippingType = parseInt(index);
  996. // this.computedPrice();
  997. if (index == 1) {
  998. this.getList(0,type);
  999. } else {
  1000. this.getConfirm();
  1001. }
  1002. },
  1003. bindPickerChange: function(e) {
  1004. let value = e.detail.value;
  1005. this.shippingType = value;
  1006. this.computedPrice();
  1007. },
  1008. ChangCouponsClone: function() {
  1009. this.$set(this.coupon, 'coupon', false);
  1010. },
  1011. changeTextareaStatus: function() {
  1012. for (let i = 0, len = this.coupon.list.length; i < len; i++) {
  1013. this.coupon.list[i].use_title = '';
  1014. this.coupon.list[i].is_use = 0;
  1015. }
  1016. this.textareaStatus = true;
  1017. this.status = 0;
  1018. this.$set(this.coupon, 'list', this.coupon.list);
  1019. },
  1020. /**
  1021. * 处理点击优惠券后的事件
  1022. *
  1023. */
  1024. ChangCoupons: function(e) {
  1025. // this.usableCoupon = e
  1026. // this.coupon.coupon = false
  1027. let index = e,
  1028. list = this.coupon.list,
  1029. couponTitle = '请选择',
  1030. couponId = 0;
  1031. for (let i = 0, len = list.length; i < len; i++) {
  1032. if (i != index) {
  1033. list[i].use_title = '';
  1034. list[i].is_use = 0;
  1035. }
  1036. }
  1037. if (list[index].is_use) {
  1038. //不使用优惠券
  1039. list[index].use_title = '';
  1040. list[index].is_use = 0;
  1041. } else {
  1042. //使用优惠券
  1043. list[index].use_title = '不使用';
  1044. list[index].is_use = 1;
  1045. couponTitle = list[index].coupon_title;
  1046. couponId = list[index].id;
  1047. }
  1048. this.couponTitle = couponTitle;
  1049. this.couponId = couponId;
  1050. this.$set(this.coupon, 'coupon', false);
  1051. this.$set(this.coupon, 'list', list);
  1052. this.getConfirm(1);
  1053. },
  1054. /**
  1055. * 使用积分抵扣
  1056. */
  1057. ChangeIntegral: function() {
  1058. this.useIntegral = !this.useIntegral;
  1059. this.computedPrice();
  1060. },
  1061. /**
  1062. * 选择地址后改变事件
  1063. * @param object e
  1064. */
  1065. OnChangeAddress: function(e) {
  1066. this.textareaStatus = true;
  1067. this.addressId = e;
  1068. this.address.address = false;
  1069. this.getConfirm()
  1070. this.getaddressInfo();
  1071. this.computedPrice();
  1072. },
  1073. bindHideKeyboard: function(e) {
  1074. this.mark = e.detail.value;
  1075. },
  1076. // 对象转数组
  1077. objToArr(data) {
  1078. let obj = Object.keys(data);
  1079. let m = obj.map(key => data[key]);
  1080. return m;
  1081. },
  1082. /**
  1083. * 获取当前订单详细信息
  1084. *
  1085. */
  1086. getConfirm: function(numType) {
  1087. let that = this;
  1088. let shippingType = parseInt(this.shippingType) + 1;
  1089. let addressId = 0,storeid;
  1090. if (this.tableId) {
  1091. shippingType = 4;
  1092. }
  1093. if (shippingType == 1) {
  1094. addressId = that.addressId
  1095. if(this.deliveryType == 1){
  1096. storeid = 0
  1097. }else{
  1098. storeid = that.storeId
  1099. }
  1100. } else {
  1101. addressId = ''
  1102. storeid = that.storeId
  1103. }
  1104. orderConfirm(that.cartId, that.news, addressId, shippingType, storeid, that.couponId).then(res => {
  1105. if (res.data.upgrade_addr == 1) {
  1106. that.id = res.data.addressInfo.id
  1107. this.isaddress = true
  1108. }
  1109. if (numType != 1) {
  1110. let confirm = this.objToArr(res.data.custom_form);
  1111. confirm.forEach((item, index, arr)=>{
  1112. CACHE_CITY[index] = ''; //清空省市区
  1113. if(item.name == 'texts'){
  1114. if(item.defaultValConfig.value){
  1115. item.value = item.defaultValConfig.value
  1116. }else{
  1117. item.value = ''
  1118. }
  1119. }else if(item.name == 'radios'){
  1120. item.value = item.wordsConfig.list[0].val
  1121. }else if(item.name == 'uploadPicture'){
  1122. item.value = [];
  1123. }else if(item.name == 'dateranges'){
  1124. if(item.valConfig.tabVal==0){
  1125. if(item.valConfig.tabData==0){
  1126. let obj = dayjs(new Date(Number(new Date().getTime()))).format('YYYY-MM-DD');
  1127. item.value = [obj,obj]
  1128. }else{
  1129. let data1 = dayjs(new Date(Number(new Date(item.valConfig.specifyDate[0]).getTime()))).format('YYYY-MM-DD');
  1130. let data2 = dayjs(new Date(Number(new Date(item.valConfig.specifyDate[1]).getTime()))).format('YYYY-MM-DD');
  1131. item.value = [data1,data2];
  1132. }
  1133. }else{
  1134. item.value = [];
  1135. }
  1136. }else{
  1137. if(['times','dates','timeranges'].indexOf(item.name) != -1){
  1138. if(item.valConfig.tabVal==0){
  1139. if(item.valConfig.tabData==0){
  1140. if(item.name == 'times'){
  1141. item.value = dayjs(new Date(Number(new Date().getTime()))).format('HH:mm');
  1142. }else if(item.name == 'dates'){
  1143. item.value = dayjs(new Date(Number(new Date().getTime()))).format('YYYY-MM-DD');
  1144. }else{
  1145. let current = dayjs(new Date(Number(new Date().getTime()))).format('HH:mm');
  1146. item.value = current+' - '+current;
  1147. }
  1148. }else{
  1149. if(item.name == 'times' || item.name == 'dates'){
  1150. item.value = item.valConfig.specifyDate;
  1151. }else{
  1152. item.value = item.valConfig.specifyDate[0]+' - '+item.valConfig.specifyDate[1];
  1153. }
  1154. }
  1155. }else{
  1156. item.value = '';
  1157. }
  1158. }else{
  1159. item.value = '';
  1160. }
  1161. }
  1162. })
  1163. function sortNumber(a, b) {
  1164. return a.timestamp - b.timestamp;
  1165. }
  1166. confirm.sort(sortNumber);
  1167. that.$set(that, 'confirm', confirm);
  1168. }
  1169. that.$set(that, 'goodsType', res.data.type);
  1170. that.$set(that, 'userInfo', res.data.userInfo);
  1171. that.$set(that, 'integral', res.data.userInfo.integral);
  1172. that.$set(that, 'contacts', res.data.userInfo.real_name);
  1173. that.$set(that, 'contactsTel', res.data.userInfo.record_phone || '');
  1174. that.$set(that, 'integralRatio', res.data.integralRatio);
  1175. that.$set(that, 'offlinePostage', res.data.offlinePostage);
  1176. that.$set(that, 'orderKey', res.data.orderKey);
  1177. that.$set(that, 'valid_count', res.data.valid_count);
  1178. that.$set(that, 'discount_id', res.data.discount_id)
  1179. that.$set(that, 'priceGroup', res.data.priceGroup);
  1180. that.$set(that, 'seckillId', parseInt(res.data.seckill_id));
  1181. that.$set(that, 'BargainId', parseInt(res.data.bargain_id));
  1182. that.$set(that, 'combinationId', parseInt(res.data.combination_id));
  1183. that.$set(that, 'discountId', parseInt(res.data.discount_id));
  1184. that.$set(that, 'invoice_func', res.data.invoice_func);
  1185. that.$set(that, 'special_invoice', res.data.special_invoice);
  1186. that.$set(that, 'integral_ratio_status', res.data.integral_ratio_status);
  1187. that.$set(that, 'store_self_mention', res.data.store_self_mention);
  1188. that.$set(that, 'store_func_status', res.data.store_func_status);
  1189. that.giveData.give_integral = res.data.give_integral;
  1190. that.giveData.give_coupon = res.data.give_coupon;
  1191. let cartInfo = res.data.cartInfo;
  1192. let cartObj = [],
  1193. giftObj = [];
  1194. cartInfo.forEach(item => {
  1195. if (item.is_gift == 1) {
  1196. giftObj.push(item)
  1197. } else {
  1198. cartObj.push(item)
  1199. }
  1200. })
  1201. that.$set(that, 'cartInfo', cartObj);
  1202. that.$set(that, 'giveCartInfo', giftObj);
  1203. let giveType = -1;
  1204. giftObj.forEach(item => {
  1205. if (item.product_type == 0 || item.product_type == 4) {
  1206. return giveType = 0
  1207. }
  1208. })
  1209. that.$set(that, 'product_type', (res.data.product_type == 0 || giveType == 0 || res.data.product_type == 4) ? 0 : 1);
  1210. //微信支付是否开启
  1211. that.cartArr[0].payStatus = res.data.pay_weixin_open || 0
  1212. //支付宝是否开启
  1213. that.cartArr[1].payStatus = res.data.ali_pay_status || 0;
  1214. //#ifdef MP
  1215. that.cartArr[1].payStatus = 0;
  1216. //#endif
  1217. //余额支付是否开启
  1218. // that.cartArr[2].title = '可用余额:' + res.data.userInfo.now_money;
  1219. that.cartArr[2].number = res.data.userInfo.now_money;
  1220. that.cartArr[2].payStatus = res.data.yue_pay_status == 1 ? res.data.yue_pay_status : 0
  1221. if (res.data.offline_pay_status == 2) {
  1222. that.cartArr[3].payStatus = 0
  1223. } else {
  1224. that.cartArr[3].payStatus = 1
  1225. }
  1226. // that.$set(that, 'cartArr', that.cartArr);
  1227. that.$set(that, 'ChangePrice', that.totalPrice);
  1228. that.getBargainId();
  1229. that.getCouponList();
  1230. that.computedPrice();
  1231. if (this.addressId || this.couponId) {
  1232. // this.computedPrice();
  1233. } else {
  1234. that.$set(that, 'totalPrice', that.$util.$h.Add(parseFloat(res.data.priceGroup.totalPrice),
  1235. parseFloat(res.data
  1236. .priceGroup.storePostage)));
  1237. }
  1238. }).catch(err => {
  1239. return this.$util.Tips({
  1240. title: err
  1241. });
  1242. });
  1243. },
  1244. /*
  1245. * 提取砍价和拼团id
  1246. */
  1247. getBargainId: function() {
  1248. let that = this;
  1249. // let cartINfo = that.cartInfo;
  1250. // let BargainId = 0;
  1251. // let combinationId = 0;
  1252. // let discountId = 0;
  1253. // cartINfo.forEach(function(value, index, cartINfo) {
  1254. // BargainId = cartINfo[index].bargain_id,
  1255. // combinationId = cartINfo[index].combination_id,
  1256. // discountId = cartINfo[index].discount_id
  1257. // })
  1258. // that.$set(that, 'BargainId', parseInt(BargainId));
  1259. // that.$set(that, 'combinationId', parseInt(combinationId));
  1260. // that.$set(that, 'discountId', parseInt(discountId));
  1261. if (that.cartArr.length == 3 && (that.BargainId || that.combinationId || that.seckillId || that.discountId)) {
  1262. that.cartArr[2].payStatus = 0;
  1263. that.$set(that, 'cartArr', that.cartArr);
  1264. }
  1265. },
  1266. /**
  1267. * 获取当前金额可用优惠券
  1268. *
  1269. */
  1270. getCouponList: function() {
  1271. let that = this;
  1272. let data = {
  1273. cartId: this.cartId,
  1274. 'new': this.news,
  1275. shipping_type: that.$util.$h.Add(that.shippingType, 1),
  1276. store_id: that.system_store ? that.system_store.id : 0
  1277. }
  1278. getCouponsOrderPrice(this.totalPrice, data).then(res => {
  1279. that.$set(that.coupon, 'list', res.data);
  1280. that.openType = 1;
  1281. });
  1282. },
  1283. /*
  1284. * 获取默认收货地址或者获取某条地址信息
  1285. */
  1286. getaddressInfo: function() {
  1287. let that = this;
  1288. if (that.addressId) {
  1289. getAddressDetail(that.addressId).then(res => {
  1290. res.data.is_default = parseInt(res.data.is_default);
  1291. that.addressInfo = res.data || {};
  1292. that.addressId = res.data.id || 0;
  1293. that.address.addressId = res.data.id || 0;
  1294. })
  1295. } else {
  1296. getAddressDefault().then(res => {
  1297. res.data.is_default = parseInt(res.data.is_default);
  1298. that.addressInfo = res.data || {};
  1299. that.addressId = res.data.id || 0;
  1300. that.address.addressId = res.data.id || 0;
  1301. })
  1302. }
  1303. },
  1304. payItem: function(e) {
  1305. let that = this;
  1306. let active = e;
  1307. that.active = active;
  1308. that.animated = true;
  1309. that.payType = that.cartArr[active].value;
  1310. that.computedPrice();
  1311. setTimeout(function() {
  1312. that.car();
  1313. }, 500);
  1314. },
  1315. couponTap: function() {
  1316. this.coupon.coupon = true;
  1317. this.coupon.list.forEach((item, index) => {
  1318. if (item.id == this.couponId) {
  1319. item.is_use = 1
  1320. } else {
  1321. item.is_use = 0
  1322. }
  1323. })
  1324. this.$set(this.coupon, 'list', this.coupon.list);
  1325. },
  1326. car: function() {
  1327. let that = this;
  1328. that.animated = false;
  1329. },
  1330. onAddress: function(name) {
  1331. let that = this;
  1332. if(name){
  1333. that.textareaStatus = false;
  1334. that.address.address = true;
  1335. that.pagesUrl = '/pages/users/user_address_list/index?news=' + this.news + '&cartId=' + this.cartId +
  1336. '&pinkId=' +
  1337. this.pinkId +
  1338. '&couponId=' +
  1339. this.couponId +'&delivery_type='+this.deliveryType+'&addressId='+this.addressId+'&store_id='+this.storeId+'&store_name='+ this.system_store.name+'&product_id='+this.product_id
  1340. }else{
  1341. uni.navigateTo({
  1342. url: '/pages/users/user_address/index?new=' + this.news + '&cartId=' + this.cartId +
  1343. '&pinkId=' +
  1344. this.pinkId +
  1345. '&couponId=' +
  1346. this.couponId +'&delivery_type='+this.deliveryType+'&addressId='+this.addressId+'&store_id='+this.storeId+'&store_name='+ this.system_store.name+'&product_id='+this.product_id
  1347. })
  1348. }
  1349. },
  1350. payment: function(data) {
  1351. let that = this;
  1352. console.log(data,'data')
  1353. orderCreate(that.orderKey, data).then(res => {
  1354. console.log(res,'resres')
  1355. let status = res.data.status,
  1356. orderId = res.data.result.orderId,
  1357. jsConfig = res.data.result.jsConfig,
  1358. goPages = '/pages/goods/order_pay_status/index?order_id=' + orderId + '&msg=' + res.msg +
  1359. '&type=3' + '&totalPrice=' + this.totalPrice
  1360. switch (status) {
  1361. case 'ORDER_EXIST':
  1362. case 'EXTEND_ORDER':
  1363. case 'PAY_ERROR':
  1364. uni.hideLoading();
  1365. return that.$util.Tips({
  1366. title: res.msg
  1367. }, {
  1368. tab: 5,
  1369. url: goPages
  1370. });
  1371. break;
  1372. case 'SUCCESS':
  1373. uni.hideLoading();
  1374. if (that.BargainId || that.combinationId || that.pinkId || that.seckillId || that
  1375. .discountId)
  1376. return that.$util.Tips({
  1377. title: res.msg,
  1378. icon: 'success'
  1379. }, {
  1380. tab: 4,
  1381. url: goPages
  1382. });
  1383. return that.$util.Tips({
  1384. title: res.msg,
  1385. icon: 'success'
  1386. }, {
  1387. tab: 5,
  1388. url: goPages
  1389. });
  1390. break;
  1391. case 'WECHAT_PAY':
  1392. that.toPay = true;
  1393. // #ifdef MP
  1394. /* that.toPay = true; */
  1395. let mp_pay_name=''
  1396. if(uni.requestOrderPayment){
  1397. mp_pay_name='requestOrderPayment'
  1398. }else{
  1399. mp_pay_name='requestPayment'
  1400. }
  1401. uni[mp_pay_name]({
  1402. timeStamp: jsConfig.timestamp,
  1403. nonceStr: jsConfig.nonceStr,
  1404. package: jsConfig.package,
  1405. signType: jsConfig.signType,
  1406. paySign: jsConfig.paySign,
  1407. success: function(res) {
  1408. uni.hideLoading();
  1409. if (that.BargainId || that.combinationId || that.pinkId || that
  1410. .seckillId || that.discountId)
  1411. return that.$util.Tips({
  1412. title: '支付成功',
  1413. icon: 'success'
  1414. }, {
  1415. tab: 4,
  1416. url: goPages
  1417. });
  1418. return that.$util.Tips({
  1419. title: '支付成功',
  1420. icon: 'success'
  1421. }, {
  1422. tab: 5,
  1423. url: goPages
  1424. });
  1425. },
  1426. fail: function(e) {
  1427. uni.hideLoading();
  1428. return that.$util.Tips({
  1429. title: '取消支付'
  1430. }, {
  1431. tab: 5,
  1432. url: goPages + '&status=2'
  1433. });
  1434. },
  1435. complete: function(e) {
  1436. uni.hideLoading();
  1437. //关闭当前页面跳转至订单状态
  1438. if (res.errMsg == 'requestPayment:cancel') return that.$util
  1439. .Tips({
  1440. title: '取消支付'
  1441. }, {
  1442. tab: 5,
  1443. url: goPages + '&status=2'
  1444. });
  1445. },
  1446. })
  1447. // #endif
  1448. // #ifdef H5
  1449. this.$wechat.pay(res.data.result.jsConfig).then(res => {
  1450. return that.$util.Tips({
  1451. title: '支付成功',
  1452. icon: 'success'
  1453. }, {
  1454. tab: 5,
  1455. url: goPages
  1456. });
  1457. }).catch(res => {
  1458. if (!this.$wechat.isWeixin()) {
  1459. uni.redirectTo({
  1460. url: goPages +
  1461. '&msg=支付失败&status=2'
  1462. })
  1463. }
  1464. if (res.errMsg == 'chooseWXPay:cancel') return that.$util.Tips({
  1465. title: '取消支付'
  1466. }, {
  1467. tab: 5,
  1468. url: goPages + '&status=2'
  1469. });
  1470. })
  1471. // #endif
  1472. // #ifdef APP-PLUS
  1473. uni.requestPayment({
  1474. provider: 'wxpay',
  1475. orderInfo: jsConfig,
  1476. success: (e) => {
  1477. let url = goPages;
  1478. uni.showToast({
  1479. title: "支付成功"
  1480. })
  1481. setTimeout(res => {
  1482. uni.redirectTo({
  1483. url: url
  1484. })
  1485. }, 2000)
  1486. },
  1487. fail: (e) => {
  1488. console.log(e,'ee')
  1489. let url = '/pages/goods/order_pay_status/index?order_id=' + orderId +
  1490. '&msg=支付失败';
  1491. uni.showModal({
  1492. content: "支付失败",
  1493. showCancel: false,
  1494. success: function(res) {
  1495. if (res.confirm) {
  1496. uni.redirectTo({
  1497. url: url
  1498. })
  1499. } else if (res.cancel) {
  1500. console.log('用户点击取消');
  1501. }
  1502. }
  1503. })
  1504. },
  1505. complete: () => {
  1506. uni.hideLoading();
  1507. },
  1508. });
  1509. // #endif
  1510. break;
  1511. case 'PAY_DEFICIENCY':
  1512. uni.hideLoading();
  1513. //余额不足
  1514. return that.$util.Tips({
  1515. title: res.msg
  1516. }, {
  1517. tab: 5,
  1518. url: goPages + '&status=1'
  1519. });
  1520. break;
  1521. case "WECHAT_H5_PAY":
  1522. uni.hideLoading();
  1523. that.$util.Tips({
  1524. title: '订单创建成功!'
  1525. }, {
  1526. tab: 4,
  1527. url: goPages + '&status=0'
  1528. });
  1529. setTimeout(() => {
  1530. location.href = res.data.result.jsConfig.mweb_url;
  1531. }, 2000);
  1532. break;
  1533. case 'ALIPAY_PAY':
  1534. //#ifdef H5
  1535. if (this.from === 'weixin') {
  1536. uni.redirectTo({
  1537. url: `/pages/users/alipay_invoke/index?id=${orderId}&pay_key=${res.data.result.pay_key}`
  1538. });
  1539. } else {
  1540. uni.hideLoading();
  1541. that.formContent = res.data.result.jsConfig;
  1542. that.$nextTick(() => {
  1543. document.getElementById('alipaysubmit').submit();
  1544. })
  1545. }
  1546. //#endif
  1547. // #ifdef MP
  1548. uni.navigateTo({
  1549. url: `/pages/users/alipay_invoke/index?id=${orderId}&link=${jsConfig.qrCode}`
  1550. });
  1551. // #endif
  1552. // #ifdef APP-PLUS
  1553. uni.requestPayment({
  1554. provider: 'alipay',
  1555. orderInfo: jsConfig,
  1556. success: (e) => {
  1557. uni.showToast({
  1558. title: "支付成功"
  1559. })
  1560. let url = '/pages/goods/order_pay_status/index?order_id=' + orderId +
  1561. '&msg=支付成功';
  1562. setTimeout(res => {
  1563. uni.redirectTo({
  1564. url: url
  1565. })
  1566. }, 2000)
  1567. },
  1568. fail: (e) => {
  1569. let url = '/pages/goods/order_pay_status/index?order_id=' + orderId +
  1570. '&msg=支付失败';
  1571. uni.showModal({
  1572. content: "支付失败",
  1573. showCancel: false,
  1574. success: function(res) {
  1575. if (res.confirm) {
  1576. uni.redirectTo({
  1577. url: url
  1578. })
  1579. } else if (res.cancel) {
  1580. console.log('用户点击取消');
  1581. }
  1582. }
  1583. })
  1584. },
  1585. complete: () => {
  1586. uni.hideLoading();
  1587. },
  1588. });
  1589. // #endif
  1590. break;
  1591. }
  1592. }).catch(err => {
  1593. uni.hideLoading();
  1594. return that.$util.Tips({
  1595. title: err
  1596. });
  1597. });
  1598. },
  1599. clickTextArea() {
  1600. this.$refs.textarea.focus()
  1601. },
  1602. bindDateChange: function(e, index) {
  1603. this.confirm[index].value = e.target.value
  1604. },
  1605. bindTimeChange: function(e, index) {
  1606. this.confirm[index].value = e.target.value
  1607. },
  1608. bindSelectChange: function(e, index, item) {
  1609. this.confirm[index].value = item.wordsConfig.list[e.detail.value].val
  1610. },
  1611. getTimeranges(index){
  1612. this.isShow = true
  1613. this.timerangesIndex = index
  1614. },
  1615. confrim(e){
  1616. this.isShow = false;
  1617. this.confirm[this.timerangesIndex].value = e.time;
  1618. let arrayNew = [];
  1619. e.val.forEach(item=>{
  1620. arrayNew.push(Number(item))
  1621. })
  1622. this.timeranges = arrayNew;
  1623. },
  1624. cancels(){
  1625. this.isShow = false;
  1626. },
  1627. // 单选
  1628. radioChange(e, index, item){
  1629. this.confirm[index].value = item.wordsConfig.list[e.detail.value].val
  1630. },
  1631. // 多选
  1632. checkboxChange(e, index, item){
  1633. let obj = e.detail.value;
  1634. let val = '';
  1635. item.wordsConfig.list.forEach((j,jindex)=>{
  1636. obj.forEach(x=>{
  1637. if(jindex == x){
  1638. val = val +(val?',':'') + j.val;
  1639. }
  1640. })
  1641. })
  1642. this.confirm[index].value = val
  1643. },
  1644. formVerify(){
  1645. let that = this;
  1646. if (!that.addressId && !that.shippingType && !that.product_type && !that.tableId) return that.$util.Tips({
  1647. title: '请选择收货地址'
  1648. });
  1649. if (that.shippingType == 1) {
  1650. if (that.contacts == "" || that.contactsTel == "") {
  1651. return that.$util.Tips({
  1652. title: '请填写联系人或联系人电话'
  1653. });
  1654. }
  1655. if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(that.contactsTel)) {
  1656. return that.$util.Tips({
  1657. title: '请填写正确的手机号'
  1658. });
  1659. }
  1660. if (!/^[\u4e00-\u9fa5\w]{2,16}$/.test(that.contacts)) {
  1661. return that.$util.Tips({
  1662. title: '请填写您的真实姓名'
  1663. });
  1664. }
  1665. if (that.storeList.length == 0) return that.$util.Tips({
  1666. title: '暂无门店,请选择其他方式'
  1667. });
  1668. }
  1669. for (var i = 0; i < that.confirm.length; i++) {
  1670. let data = that.confirm[i]
  1671. if (['radios'].indexOf(data.name) == -1 && (data.titleShow.val || (['uploadPicture','dateranges'].indexOf(data.name) == -1 && data.value && data.value.trim()))) {
  1672. if ((data.name === 'texts' && data.valConfig.tabVal == 0) || ['dates','times','selects','citys','checkboxs'].indexOf(data.name) != -1) {
  1673. if (!data.value || (data.value && !data.value.trim())) {
  1674. return that.$util.Tips({
  1675. title: `请填写${data.titleConfig.value}`
  1676. });
  1677. }
  1678. }
  1679. if(data.name === 'timeranges'){
  1680. if(!data.value){
  1681. return that.$util.Tips({
  1682. title: `请选择${data.titleConfig.value}`
  1683. });
  1684. }
  1685. }
  1686. if (data.name === 'dateranges') {
  1687. if (!data.value.length) {
  1688. return that.$util.Tips({
  1689. title: `请选择${data.titleConfig.value}`
  1690. });
  1691. }
  1692. }
  1693. if (data.name === 'texts' && data.valConfig.tabVal == 4) {
  1694. if (data.value <= 0) {
  1695. return that.$util.Tips({
  1696. title: `请填写大于0的${data.titleConfig.value}`
  1697. });
  1698. }
  1699. }
  1700. if (data.name === 'texts' && data.valConfig.tabVal == 3) {
  1701. if (!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(data.value)) {
  1702. return that.$util.Tips({
  1703. title: `请填写正确的${data.titleConfig.value}`
  1704. });
  1705. }
  1706. }
  1707. if (data.name === 'texts' && data.valConfig.tabVal == 1) {
  1708. if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(data.value)) {
  1709. return that.$util.Tips({
  1710. title: `请填写正确的${data.titleConfig.value}`
  1711. });
  1712. }
  1713. }
  1714. if (data.name === 'texts' && data.valConfig.tabVal == 2) {
  1715. if (!
  1716. /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/i
  1717. .test(data.value)) {
  1718. return that.$util.Tips({
  1719. title: `请填写正确的${data.titleConfig.value}`
  1720. });
  1721. }
  1722. }
  1723. if (data.name === 'uploadPicture') {
  1724. if (!data.value.length) {
  1725. return that.$util.Tips({
  1726. title: `请上传${data.titleConfig.value}`
  1727. });
  1728. }
  1729. }
  1730. }
  1731. }
  1732. this.pay_close = true;
  1733. },
  1734. SubOrder: function(e) {
  1735. let that = this,
  1736. data = {};
  1737. if (!that.payType) return that.$util.Tips({
  1738. title: '请选择支付方式'
  1739. });
  1740. data = {
  1741. collate_code_id: that.collage_id || that.tableId,
  1742. custom_form: that.confirm,
  1743. real_name: that.contacts,
  1744. phone: that.contactsTel,
  1745. addressId: that.addressId,
  1746. formId: '',
  1747. couponId: that.priceGroup.couponPrice == 0 ? 0 : that.couponId,
  1748. payType: that.payType,
  1749. useIntegral: that.useIntegral,
  1750. bargainId: that.BargainId,
  1751. combinationId: that.combinationId,
  1752. discountId: that.discountId,
  1753. pinkId: that.pinkId,
  1754. seckill_id: that.seckillId,
  1755. mark: that.mark,
  1756. store_id: that.deliveryType==1? 0 : that.system_store.id||0,
  1757. 'from': that.from,
  1758. shipping_type: that.tableId ? 4 : that.$util.$h.Add(that.shippingType, 1),
  1759. 'new': that.news,
  1760. 'invoice_id': that.invChecked,
  1761. // #ifdef H5
  1762. quitUrl: location.protocol + '//' + location.hostname +
  1763. '/pages/goods/order_pay_status/index?' +
  1764. '&type=3' + '&totalPrice=' + this.totalPrice
  1765. // #endif
  1766. // #ifdef APP-PLUS
  1767. quitUrl: '/pages/goods/order_details/index?order_id=' + this.order_id
  1768. // #endif
  1769. };
  1770. if (data.payType == 'yue' && parseFloat(that.userInfo.now_money) < parseFloat(that.totalPrice))
  1771. return that.$util.Tips({
  1772. title: '余额不足!'
  1773. });
  1774. uni.showLoading({
  1775. title: '订单支付中'
  1776. });
  1777. // #ifdef MP
  1778. openPaySubscribe().then(() => {
  1779. that.payment(data);
  1780. });
  1781. // #endif
  1782. // #ifndef MP
  1783. that.payment(data);
  1784. // #endif
  1785. }
  1786. }
  1787. }
  1788. </script>
  1789. <style lang="scss" scoped>
  1790. /deep/.uni-date-x--border{
  1791. border: 0;
  1792. }
  1793. /deep/.uni-icons{
  1794. font-size: 0 !important;
  1795. }
  1796. /deep/.uni-date-x{
  1797. color: #999;
  1798. font-size: 15px;
  1799. }
  1800. /deep/.uni-date__x-input{
  1801. font-size: 15px;
  1802. }
  1803. .height-add {
  1804. height: calc(120rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  1805. height: calc(120rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  1806. }
  1807. /deep/uni-checkbox[disabled] .uni-checkbox-input {
  1808. background-color: #eee;
  1809. }
  1810. .confirmImg {
  1811. width: 100%;
  1812. }
  1813. /deep/.orderGoods {
  1814. margin-top: 20rpx;
  1815. border-radius: 14rpx;
  1816. }
  1817. .confirmImg .upload {
  1818. padding-bottom: 36rpx;
  1819. }
  1820. .confirmImg .upload .pictrue {
  1821. margin: 22rpx 23rpx 0 0;
  1822. width: 146rpx;
  1823. height: 146rpx;
  1824. position: relative;
  1825. font-size: 24rpx;
  1826. color: #bbb;
  1827. }
  1828. .confirmImg .upload .pictrue:nth-of-type(4n) {
  1829. margin-right: 0;
  1830. }
  1831. .confirmImg .upload .pictrue image {
  1832. width: 100%;
  1833. height: 100%;
  1834. border-radius: 8rpx;
  1835. }
  1836. .confirmImg .upload .pictrue .icon-guanbi1 {
  1837. position: absolute;
  1838. font-size: 45rpx;
  1839. top: -10rpx;
  1840. right: -10rpx;
  1841. }
  1842. .confirmImg .upload .pictrue .close{
  1843. position: absolute;
  1844. width: 26rpx;
  1845. height: 26rpx;
  1846. border-radius: 0 8rpx 0 8rpx;
  1847. background-color: rgba(0, 0, 0, 0.6);
  1848. top: 0;
  1849. right: 0;
  1850. }
  1851. .confirmImg .upload .pictrue .close .iconfont{
  1852. font-size: 24rpx;
  1853. }
  1854. .confirmImg .upload .pictrue .icon-icon25201 {
  1855. color: #bfbfbf;
  1856. font-size: 50rpx;
  1857. }
  1858. .confirmImg .upload .pictrue:nth-last-child(1) {
  1859. border: 1rpx solid #ddd;
  1860. box-sizing: border-box;
  1861. }
  1862. .alipaysubmit {
  1863. display: none;
  1864. }
  1865. .order-submission .line {
  1866. width: 100%;
  1867. height: 4rpx;
  1868. }
  1869. .order-submission .line image {
  1870. width: 100%;
  1871. height: 100%;
  1872. display: block;
  1873. }
  1874. .order-submission .headerCon {
  1875. background-color: #fff;
  1876. box-sizing: border-box;
  1877. .icon-s-bianji {
  1878. width: 44rpx;
  1879. height: 44rpx;
  1880. background: #F5F5F5;
  1881. border-radius: 50%;
  1882. text-align: center;
  1883. line-height: 44rpx;
  1884. font-size: 17rpx;
  1885. color: #666;
  1886. }
  1887. .add-title {
  1888. height: 72rpx;
  1889. padding: 0 26rpx;
  1890. border-bottom: 1px solid #eee;
  1891. .icon {
  1892. height: 32rpx;
  1893. background: #1890FF;
  1894. border-radius: 4rpx;
  1895. font-size: 20rpx;
  1896. font-weight: 400;
  1897. color: #FFFFFF;
  1898. text-align: center;
  1899. line-height: 32rpx;
  1900. padding: 0 6rpx;
  1901. &.orange{
  1902. background: #FE960F;
  1903. }
  1904. &.red{
  1905. background: #E93323;
  1906. }
  1907. }
  1908. .add-text {
  1909. margin-left: 14rpx;
  1910. width: 360rpx;
  1911. }
  1912. .text {
  1913. font-size: 24rpx;
  1914. font-weight: 400;
  1915. color: #999999;
  1916. .icon-jiantou {
  1917. display: inline-block;
  1918. font-size: 20rpx;
  1919. }
  1920. }
  1921. }
  1922. }
  1923. .order-submission .address{
  1924. padding: 0 26rpx;
  1925. height: 130rpx;
  1926. .icon{
  1927. .iconfont{
  1928. width: 44rpx;
  1929. height: 44rpx;
  1930. background: var(--view-minorColorT);
  1931. font-size: 20rpx;
  1932. border-radius: 50%;
  1933. text-align: center;
  1934. line-height: 44rpx;
  1935. color: var(--view-theme);
  1936. margin-left: 26rpx;
  1937. }
  1938. }
  1939. }
  1940. .order-submission .address .addressCon {
  1941. width: 502rpx;
  1942. font-size: 26rpx;
  1943. color: #666;
  1944. }
  1945. .order-submission .address .addressCon .name {
  1946. font-size: 30rpx;
  1947. color: #282828;
  1948. font-weight: bold;
  1949. margin-bottom: 10rpx;
  1950. .nameCon{
  1951. max-width: 244rpx;
  1952. &.on{
  1953. max-width: unset;
  1954. }
  1955. }
  1956. }
  1957. .order-submission .address .addressCon .name .phone {
  1958. margin-left: 50rpx;
  1959. }
  1960. .order-submission .address .addressCon .default {
  1961. margin-right: 12rpx;
  1962. }
  1963. .order-submission .address .addressCon .setaddress {
  1964. color: #333;
  1965. font-size: 28rpx;
  1966. }
  1967. .order-submission .allAddress {
  1968. width: 100%;
  1969. background: linear-gradient(to bottom, var(--view-theme) 0%, #f5f5f5 100%);
  1970. display: flex;
  1971. flex-direction: column;
  1972. justify-content: center;
  1973. align-items: center;
  1974. padding-top: 24rpx;
  1975. }
  1976. .order-submission .allAddress .nav {
  1977. width: 710rpx;
  1978. // margin: 0 auto;
  1979. }
  1980. .order-submission .allAddress .nav .item {
  1981. width: 355rpx;
  1982. }
  1983. .order-submission .allAddress .nav .item.on {
  1984. position: relative;
  1985. width: 250rpx;
  1986. }
  1987. .order-submission .allAddress .nav .item.on::before {
  1988. position: absolute;
  1989. bottom: 0;
  1990. content: "快递配送";
  1991. font-size: 28rpx;
  1992. display: block;
  1993. height: 0;
  1994. width: 336rpx;
  1995. border-width: 0 20rpx 80rpx 0;
  1996. border-style: none solid solid;
  1997. border-color: transparent transparent #fff;
  1998. z-index: 2;
  1999. border-radius: 7rpx 30rpx 0 0;
  2000. text-align: center;
  2001. // line-height: 80rpx;
  2002. }
  2003. .header-title {
  2004. font-size: 36rpx;
  2005. font-weight: 600;
  2006. color: #FFFFFF;
  2007. }
  2008. .order-submission .allAddress .nav .item:nth-of-type(2).on::before {
  2009. content: "到店自提";
  2010. border-width: 0 0 80rpx 20rpx;
  2011. border-radius: 30rpx 7rpx 0 0;
  2012. }
  2013. .order-submission .allAddress .nav .item.on2 {
  2014. position: relative;
  2015. }
  2016. .order-submission .allAddress .nav .item.on2::before {
  2017. position: absolute;
  2018. bottom: 0;
  2019. content: "到店自提";
  2020. font-size: 28rpx;
  2021. display: block;
  2022. height: 0;
  2023. width: 400rpx;
  2024. border-width: 0 0 60rpx 60rpx;
  2025. border-style: none solid solid;
  2026. border-color: transparent transparent rgba(255, 255, 255, 0.6);
  2027. border-radius: 40rpx 6rpx 0 0;
  2028. text-align: center;
  2029. // line-height: 60rpx;
  2030. }
  2031. .order-submission .allAddress .nav .item:nth-of-type(1).on2::before {
  2032. content: "快递配送";
  2033. border-width: 0 60rpx 60rpx 0;
  2034. border-radius: 6rpx 40rpx 0 0;
  2035. }
  2036. .order-submission .allAddress .headerCon{
  2037. width: 710rpx;
  2038. margin: 0 auto;
  2039. border-radius: 14rpx;
  2040. background-color: #fff;
  2041. }
  2042. .order-submission .allAddress .line {
  2043. width: 710rpx;
  2044. margin: 0 auto;
  2045. }
  2046. .order-submission .wrapper .item .discount .placeholder {
  2047. color: #ccc;
  2048. }
  2049. .placeholder-textarea {
  2050. position: relative;
  2051. .placeholder {
  2052. position: absolute;
  2053. color: #ccc;
  2054. top: 26rpx;
  2055. left: 30rpx;
  2056. }
  2057. }
  2058. .order-submission .wrapper {
  2059. background-color: #fff;
  2060. width: 710rpx;
  2061. border-radius: 14rpx;
  2062. margin: 0 auto;
  2063. margin-top: 14rpx;
  2064. }
  2065. .order-submission .wrapper .item .name {
  2066. position: relative;
  2067. width: 190rpx;
  2068. }
  2069. .order-submission .wrapper .item .asterisk {
  2070. position: absolute;
  2071. color: red;
  2072. left: -15rpx
  2073. }
  2074. .order-submission .wrapper .item {
  2075. padding: 27rpx 30rpx;
  2076. font-size: 30rpx;
  2077. color: #282828;
  2078. border-bottom: 1px solid #f0f0f0;
  2079. }
  2080. .order-submission .wrapper .item.on{
  2081. padding: 17rpx 14rpx 17rpx 30rpx;
  2082. align-items: baseline;
  2083. }
  2084. .order-submission .wrapper .item.on3{
  2085. align-items: baseline;
  2086. }
  2087. .order-submission .wrapper .item.on2{
  2088. padding: 17rpx 30rpx;
  2089. }
  2090. .order-submission .wrapper .item .discount {
  2091. font-size: 30rpx;
  2092. color: #999;
  2093. }
  2094. .order-submission .wrapper .item.on .discount,
  2095. .order-submission .wrapper .item.on3 .discount{
  2096. width: 460rpx;
  2097. text-align: right;
  2098. }
  2099. .order-submission .wrapper .item.on3 .discount .city{
  2100. width: 400rpx;
  2101. }
  2102. .order-submission .wrapper .item .discount input {
  2103. text-align: right;
  2104. width: 450rpx;
  2105. }
  2106. .order-submission .wrapper .item .discount .iconfont {
  2107. color: #515151;
  2108. font-size: 30rpx;
  2109. margin-left: 15rpx;
  2110. }
  2111. .order-submission .wrapper .item .discount .num {
  2112. font-size: 32rpx;
  2113. margin-right: 20rpx;
  2114. }
  2115. .order-submission .wrapper .item .discount .radio{
  2116. margin: 0 22rpx 0 22rpx;
  2117. padding: 10rpx 0;
  2118. }
  2119. .order-submission .wrapper .item .discount .radio /deep/uni-checkbox .uni-checkbox-input{
  2120. border-radius: 0 }
  2121. .order-submission .wrapper .item .shipping {
  2122. font-size: 30rpx;
  2123. color: #999;
  2124. position: relative;
  2125. padding-right: 58rpx;
  2126. }
  2127. .order-submission .wrapper .item .shipping .iconfont {
  2128. font-size: 35rpx;
  2129. color: #707070;
  2130. position: absolute;
  2131. right: 0;
  2132. top: 50%;
  2133. transform: translateY(-50%);
  2134. margin-left: 30rpx;
  2135. }
  2136. .order-submission .wrapper .item textarea {
  2137. background-color: #f9f9f9;
  2138. width: 650rpx;
  2139. height: 140rpx;
  2140. border-radius: 3rpx;
  2141. margin-top: 30rpx;
  2142. padding: 25rpx 28rpx;
  2143. box-sizing: border-box;
  2144. }
  2145. .order-submission .wrapper .item .placeholder {
  2146. color: #ccc;
  2147. }
  2148. .order-submission .wrapper .item .list {
  2149. margin-top: 35rpx;
  2150. }
  2151. .order-submission .wrapper .item .list .payItem {
  2152. border: 1px solid #eee;
  2153. border-radius: 6rpx;
  2154. height: 86rpx;
  2155. width: 100%;
  2156. box-sizing: border-box;
  2157. margin-top: 20rpx;
  2158. font-size: 28rpx;
  2159. color: #282828;
  2160. }
  2161. .order-submission .wrapper .item .list .payItem.on {
  2162. border-color: #fc5445;
  2163. color: #e93323;
  2164. }
  2165. .order-submission .wrapper .item .list .payItem .name {
  2166. width: 50%;
  2167. text-align: center;
  2168. border-right: 1px solid #eee;
  2169. padding-left: 80rpx;
  2170. }
  2171. .order-submission .wrapper .item .list .payItem .name .iconfont {
  2172. width: 44rpx;
  2173. height: 44rpx;
  2174. border-radius: 50%;
  2175. text-align: center;
  2176. line-height: 44rpx;
  2177. background-color: #fe960f;
  2178. color: #fff;
  2179. font-size: 30rpx;
  2180. margin-right: 15rpx;
  2181. }
  2182. .order-submission .wrapper .item .list .payItem .name .iconfont.icon-weixin2 {
  2183. background-color: #41b035;
  2184. }
  2185. .order-submission .wrapper .item .list .payItem .name .iconfont.icon-zhifubao {
  2186. background-color: #1677FF;
  2187. }
  2188. .order-submission .wrapper .item .list .payItem .tip {
  2189. width: 49%;
  2190. text-align: center;
  2191. font-size: 26rpx;
  2192. color: #aaa;
  2193. }
  2194. .order-submission .moneyList {
  2195. background-color: #fff;
  2196. padding: 30rpx;
  2197. width: 710rpx;
  2198. border-radius: 14rpx;
  2199. margin: 0 auto;
  2200. margin-top: 14rpx;
  2201. }
  2202. .order-submission .moneyList .item {
  2203. font-size: 28rpx;
  2204. color: #282828;
  2205. }
  2206. .order-submission .moneyList .item~.item {
  2207. margin-top: 20rpx;
  2208. }
  2209. .order-submission .moneyList .item .money {
  2210. color: #868686;
  2211. }
  2212. .order-submission .footer {
  2213. width: 100%;
  2214. height: 100rpx;
  2215. background-color: #fff;
  2216. padding: 0 30rpx;
  2217. font-size: 28rpx;
  2218. color: #333;
  2219. box-sizing: border-box;
  2220. position: fixed;
  2221. bottom: 0;
  2222. left: 0;
  2223. z-index: 9;
  2224. height: calc(100rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  2225. height: calc(100rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  2226. padding-bottom: calc(0rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  2227. padding-bottom: calc(0rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  2228. }
  2229. .order-submission .footer .settlement {
  2230. font-size: 30rpx;
  2231. color: #fff;
  2232. width: 240rpx;
  2233. height: 70rpx;
  2234. background-color: var(--view-theme);
  2235. border-radius: 50rpx;
  2236. text-align: center;
  2237. line-height: 70rpx;
  2238. }
  2239. .footer .transparent {
  2240. opacity: 0
  2241. }
  2242. .tipaddress {
  2243. position: fixed;
  2244. left: 13%;
  2245. top: 25%;
  2246. // margin-left: -283rpx;
  2247. width: 560rpx;
  2248. height: 614rpx;
  2249. background-color: #fff;
  2250. border-radius: 10rpx;
  2251. z-index: 100;
  2252. text-align: center;
  2253. .top {
  2254. width: 560rpx;
  2255. height: 270rpx;
  2256. border-top-left-radius: 10rpx;
  2257. border-top-right-radius: 10rpx;
  2258. background-image: url(../../../static/images/address.png);
  2259. background-repeat: round;
  2260. background-color: var(--view-theme);
  2261. .tipsphoto {
  2262. display: inline-block;
  2263. width: 200rpx;
  2264. height: 200rpx;
  2265. margin-top: 73rpx;
  2266. }
  2267. }
  2268. .bottom {
  2269. font-size: 32rpx;
  2270. font-weight: 400;
  2271. .font1 {
  2272. font-size: 36rpx;
  2273. font-weight: 600;
  2274. color: #333333;
  2275. margin: 32rpx 0rpx 22rpx;
  2276. }
  2277. .font2 {
  2278. color: #666666;
  2279. margin-bottom: 48rpx;
  2280. }
  2281. .btn {
  2282. width: 360rpx;
  2283. height: 82rpx;
  2284. border-radius: 42rpx;
  2285. background: linear-gradient(to left, var(--view-theme) 0%, #f5f5f5 100%);
  2286. color: #FFFFFF;
  2287. line-height: 82rpx;
  2288. margin: 0 auto;
  2289. }
  2290. }
  2291. }
  2292. .mark {
  2293. position: fixed;
  2294. top: 0;
  2295. left: 0;
  2296. bottom: 0;
  2297. right: 0;
  2298. background: rgba(0, 0, 0, 0.5);
  2299. z-index: 99;
  2300. }
  2301. .table-header {
  2302. width: 710rpx;
  2303. padding: 52rpx 24rpx 46rpx;
  2304. border-radius: 14rpx;
  2305. margin: 0 30rpx;
  2306. background-color: #FFFFFF;
  2307. font-size: 24rpx;
  2308. color: #999999;
  2309. .top {
  2310. display: flex;
  2311. margin-bottom: 18rpx;
  2312. }
  2313. .name {
  2314. flex: 1;
  2315. min-width: 0;
  2316. font-weight: 600;
  2317. font-size: 34rpx;
  2318. color: #333333;
  2319. }
  2320. .number {
  2321. color: #333333;
  2322. }
  2323. .light {
  2324. margin-right: 6rpx;
  2325. font-weight: 600;
  2326. font-size: 34rpx;
  2327. color: var(--view-theme);
  2328. }
  2329. }
  2330. </style>