index.vue 76 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437
  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. console.log(type,'type')
  908. this.payType = type;
  909. this.SubOrder();
  910. },
  911. payAddress() {
  912. uni.navigateTo({
  913. // /pages/users/user_address/index?id=25&cartId=76179610656654229504&pinkId=0&couponId=0&new=1
  914. url: '/pages/users/user_address/index?id=' + this.id + '&new=' + this.news + '&cartId=' + this.cartId +
  915. '&pinkId=' +
  916. this.pinkId +
  917. '&couponId=' +
  918. this.couponId +'&delivery_type='+this.deliveryType+'&addressId='+this.addressId+'&store_id='+this.storeId+'&store_name='+ this.system_store.name+'&product_id='+this.product_id
  919. })
  920. },
  921. /**
  922. * 获取门店列表数据
  923. */
  924. getList: function(fromType,index) {
  925. let longitude = uni.getStorageSync("user_longitude"); //经度
  926. let latitude = uni.getStorageSync("user_latitude"); //纬度
  927. let data = {
  928. latitude: latitude, //纬度
  929. longitude: longitude, //经度
  930. page: 1,
  931. limit: 100,
  932. type: this.seckillId>0?1:0,
  933. product_id: this.product_id,
  934. is_store: index
  935. }
  936. storeListApi(data).then(res => {
  937. let list = res.data.list.list || [];
  938. this.$set(this, 'storeList', list);
  939. this.$set(this, 'storeId', this.storeId !=0?this.storeId:list[0].id);
  940. list.forEach(item=>{
  941. if(this.storeId == item.id){
  942. this.$set(this, 'system_store', item);
  943. }
  944. })
  945. if(fromType !=1 ){
  946. this.getConfirm();
  947. }
  948. }).catch(err => {})
  949. },
  950. // 关闭地址弹窗;
  951. changeClose: function() {
  952. this.$set(this.address, 'address', false);
  953. },
  954. /*
  955. * 跳转门店列表
  956. */
  957. showStoreList: function() {
  958. let _this = this
  959. if (this.storeList.length > 0) {
  960. uni.navigateTo({
  961. url: `/pages/store/store_list/index?type=1&cartId=${_this.cartId}&new=${_this.news}&pinkId=${_this.pinkId}&couponId=${_this.couponId}`
  962. })
  963. }
  964. },
  965. changePayType(type) {
  966. this.payType = type
  967. this.computedPrice()
  968. },
  969. computedPrice: function() {
  970. let shippingType = this.shippingType;
  971. postOrderComputed(this.orderKey, {
  972. addressId: this.addressId,
  973. useIntegral: this.useIntegral ? 1 : 0,
  974. couponId: this.priceGroup.couponPrice == 0 ? 0 : this.couponId,
  975. shipping_type: this.tableId ? 4 : parseInt(shippingType) + 1,
  976. payType: this.payType
  977. }).then(res => {
  978. let result = res.data.result;
  979. if (result) {
  980. this.totalPrice = result.pay_price;
  981. this.integral_price = result.deduction_price;
  982. this.coupon_price = result.coupon_price;
  983. this.promotions_detail = result.promotions_detail;
  984. this.integral = this.useIntegral ? result.SurplusIntegral : this.userInfo.integral;
  985. this.$set(this.priceGroup, 'storePostage', shippingType == 1 ? 0 : result.pay_postage);
  986. this.$set(this.priceGroup, 'storePostageDiscount', result.storePostageDiscount);
  987. }
  988. }).catch(err => {
  989. return that.$util.Tips({
  990. title: err
  991. });
  992. })
  993. },
  994. addressType: function(e,type) {
  995. let index = e;
  996. this.shippingType = parseInt(index);
  997. // this.computedPrice();
  998. if (index == 1) {
  999. this.getList(0,type);
  1000. } else {
  1001. this.getConfirm();
  1002. }
  1003. },
  1004. bindPickerChange: function(e) {
  1005. let value = e.detail.value;
  1006. this.shippingType = value;
  1007. this.computedPrice();
  1008. },
  1009. ChangCouponsClone: function() {
  1010. this.$set(this.coupon, 'coupon', false);
  1011. },
  1012. changeTextareaStatus: function() {
  1013. for (let i = 0, len = this.coupon.list.length; i < len; i++) {
  1014. this.coupon.list[i].use_title = '';
  1015. this.coupon.list[i].is_use = 0;
  1016. }
  1017. this.textareaStatus = true;
  1018. this.status = 0;
  1019. this.$set(this.coupon, 'list', this.coupon.list);
  1020. },
  1021. /**
  1022. * 处理点击优惠券后的事件
  1023. *
  1024. */
  1025. ChangCoupons: function(e) {
  1026. // this.usableCoupon = e
  1027. // this.coupon.coupon = false
  1028. let index = e,
  1029. list = this.coupon.list,
  1030. couponTitle = '请选择',
  1031. couponId = 0;
  1032. for (let i = 0, len = list.length; i < len; i++) {
  1033. if (i != index) {
  1034. list[i].use_title = '';
  1035. list[i].is_use = 0;
  1036. }
  1037. }
  1038. if (list[index].is_use) {
  1039. //不使用优惠券
  1040. list[index].use_title = '';
  1041. list[index].is_use = 0;
  1042. } else {
  1043. //使用优惠券
  1044. list[index].use_title = '不使用';
  1045. list[index].is_use = 1;
  1046. couponTitle = list[index].coupon_title;
  1047. couponId = list[index].id;
  1048. }
  1049. this.couponTitle = couponTitle;
  1050. this.couponId = couponId;
  1051. this.$set(this.coupon, 'coupon', false);
  1052. this.$set(this.coupon, 'list', list);
  1053. this.getConfirm(1);
  1054. },
  1055. /**
  1056. * 使用积分抵扣
  1057. */
  1058. ChangeIntegral: function() {
  1059. this.useIntegral = !this.useIntegral;
  1060. this.computedPrice();
  1061. },
  1062. /**
  1063. * 选择地址后改变事件
  1064. * @param object e
  1065. */
  1066. OnChangeAddress: function(e) {
  1067. this.textareaStatus = true;
  1068. this.addressId = e;
  1069. this.address.address = false;
  1070. this.getConfirm()
  1071. this.getaddressInfo();
  1072. this.computedPrice();
  1073. },
  1074. bindHideKeyboard: function(e) {
  1075. this.mark = e.detail.value;
  1076. },
  1077. // 对象转数组
  1078. objToArr(data) {
  1079. let obj = Object.keys(data);
  1080. let m = obj.map(key => data[key]);
  1081. return m;
  1082. },
  1083. /**
  1084. * 获取当前订单详细信息
  1085. *
  1086. */
  1087. getConfirm: function(numType) {
  1088. let that = this;
  1089. let shippingType = parseInt(this.shippingType) + 1;
  1090. let addressId = 0,storeid;
  1091. if (this.tableId) {
  1092. shippingType = 4;
  1093. }
  1094. if (shippingType == 1) {
  1095. addressId = that.addressId
  1096. if(this.deliveryType == 1){
  1097. storeid = 0
  1098. }else{
  1099. storeid = that.storeId
  1100. }
  1101. } else {
  1102. addressId = ''
  1103. storeid = that.storeId
  1104. }
  1105. orderConfirm(that.cartId, that.news, addressId, shippingType, storeid, that.couponId).then(res => {
  1106. if (res.data.upgrade_addr == 1) {
  1107. that.id = res.data.addressInfo.id
  1108. this.isaddress = true
  1109. }
  1110. if (numType != 1) {
  1111. let confirm = this.objToArr(res.data.custom_form);
  1112. confirm.forEach((item, index, arr)=>{
  1113. CACHE_CITY[index] = ''; //清空省市区
  1114. if(item.name == 'texts'){
  1115. if(item.defaultValConfig.value){
  1116. item.value = item.defaultValConfig.value
  1117. }else{
  1118. item.value = ''
  1119. }
  1120. }else if(item.name == 'radios'){
  1121. item.value = item.wordsConfig.list[0].val
  1122. }else if(item.name == 'uploadPicture'){
  1123. item.value = [];
  1124. }else if(item.name == 'dateranges'){
  1125. if(item.valConfig.tabVal==0){
  1126. if(item.valConfig.tabData==0){
  1127. let obj = dayjs(new Date(Number(new Date().getTime()))).format('YYYY-MM-DD');
  1128. item.value = [obj,obj]
  1129. }else{
  1130. let data1 = dayjs(new Date(Number(new Date(item.valConfig.specifyDate[0]).getTime()))).format('YYYY-MM-DD');
  1131. let data2 = dayjs(new Date(Number(new Date(item.valConfig.specifyDate[1]).getTime()))).format('YYYY-MM-DD');
  1132. item.value = [data1,data2];
  1133. }
  1134. }else{
  1135. item.value = [];
  1136. }
  1137. }else{
  1138. if(['times','dates','timeranges'].indexOf(item.name) != -1){
  1139. if(item.valConfig.tabVal==0){
  1140. if(item.valConfig.tabData==0){
  1141. if(item.name == 'times'){
  1142. item.value = dayjs(new Date(Number(new Date().getTime()))).format('HH:mm');
  1143. }else if(item.name == 'dates'){
  1144. item.value = dayjs(new Date(Number(new Date().getTime()))).format('YYYY-MM-DD');
  1145. }else{
  1146. let current = dayjs(new Date(Number(new Date().getTime()))).format('HH:mm');
  1147. item.value = current+' - '+current;
  1148. }
  1149. }else{
  1150. if(item.name == 'times' || item.name == 'dates'){
  1151. item.value = item.valConfig.specifyDate;
  1152. }else{
  1153. item.value = item.valConfig.specifyDate[0]+' - '+item.valConfig.specifyDate[1];
  1154. }
  1155. }
  1156. }else{
  1157. item.value = '';
  1158. }
  1159. }else{
  1160. item.value = '';
  1161. }
  1162. }
  1163. })
  1164. function sortNumber(a, b) {
  1165. return a.timestamp - b.timestamp;
  1166. }
  1167. confirm.sort(sortNumber);
  1168. that.$set(that, 'confirm', confirm);
  1169. }
  1170. that.$set(that, 'goodsType', res.data.type);
  1171. that.$set(that, 'userInfo', res.data.userInfo);
  1172. that.$set(that, 'integral', res.data.userInfo.integral);
  1173. that.$set(that, 'contacts', res.data.userInfo.real_name);
  1174. that.$set(that, 'contactsTel', res.data.userInfo.record_phone || '');
  1175. that.$set(that, 'integralRatio', res.data.integralRatio);
  1176. that.$set(that, 'offlinePostage', res.data.offlinePostage);
  1177. that.$set(that, 'orderKey', res.data.orderKey);
  1178. that.$set(that, 'valid_count', res.data.valid_count);
  1179. that.$set(that, 'discount_id', res.data.discount_id)
  1180. that.$set(that, 'priceGroup', res.data.priceGroup);
  1181. that.$set(that, 'seckillId', parseInt(res.data.seckill_id));
  1182. that.$set(that, 'BargainId', parseInt(res.data.bargain_id));
  1183. that.$set(that, 'combinationId', parseInt(res.data.combination_id));
  1184. that.$set(that, 'discountId', parseInt(res.data.discount_id));
  1185. that.$set(that, 'invoice_func', res.data.invoice_func);
  1186. that.$set(that, 'special_invoice', res.data.special_invoice);
  1187. that.$set(that, 'integral_ratio_status', res.data.integral_ratio_status);
  1188. that.$set(that, 'store_self_mention', res.data.store_self_mention);
  1189. that.$set(that, 'store_func_status', res.data.store_func_status);
  1190. that.giveData.give_integral = res.data.give_integral;
  1191. that.giveData.give_coupon = res.data.give_coupon;
  1192. let cartInfo = res.data.cartInfo;
  1193. let cartObj = [],
  1194. giftObj = [];
  1195. cartInfo.forEach(item => {
  1196. if (item.is_gift == 1) {
  1197. giftObj.push(item)
  1198. } else {
  1199. cartObj.push(item)
  1200. }
  1201. })
  1202. that.$set(that, 'cartInfo', cartObj);
  1203. that.$set(that, 'giveCartInfo', giftObj);
  1204. let giveType = -1;
  1205. giftObj.forEach(item => {
  1206. if (item.product_type == 0 || item.product_type == 4) {
  1207. return giveType = 0
  1208. }
  1209. })
  1210. that.$set(that, 'product_type', (res.data.product_type == 0 || giveType == 0 || res.data.product_type == 4) ? 0 : 1);
  1211. //微信支付是否开启
  1212. that.cartArr[0].payStatus = res.data.pay_weixin_open || 0
  1213. //支付宝是否开启
  1214. that.cartArr[1].payStatus = res.data.ali_pay_status || 0;
  1215. //#ifdef MP
  1216. that.cartArr[1].payStatus = 0;
  1217. //#endif
  1218. //余额支付是否开启
  1219. // that.cartArr[2].title = '可用余额:' + res.data.userInfo.now_money;
  1220. that.cartArr[2].number = res.data.userInfo.now_money;
  1221. that.cartArr[2].payStatus = res.data.yue_pay_status == 1 ? res.data.yue_pay_status : 0
  1222. if (res.data.offline_pay_status == 2) {
  1223. that.cartArr[3].payStatus = 0
  1224. } else {
  1225. that.cartArr[3].payStatus = 1
  1226. }
  1227. // that.$set(that, 'cartArr', that.cartArr);
  1228. that.$set(that, 'ChangePrice', that.totalPrice);
  1229. that.getBargainId();
  1230. that.getCouponList();
  1231. that.computedPrice();
  1232. if (this.addressId || this.couponId) {
  1233. // this.computedPrice();
  1234. } else {
  1235. that.$set(that, 'totalPrice', that.$util.$h.Add(parseFloat(res.data.priceGroup.totalPrice),
  1236. parseFloat(res.data
  1237. .priceGroup.storePostage)));
  1238. }
  1239. }).catch(err => {
  1240. return this.$util.Tips({
  1241. title: err
  1242. });
  1243. });
  1244. },
  1245. /*
  1246. * 提取砍价和拼团id
  1247. */
  1248. getBargainId: function() {
  1249. let that = this;
  1250. // let cartINfo = that.cartInfo;
  1251. // let BargainId = 0;
  1252. // let combinationId = 0;
  1253. // let discountId = 0;
  1254. // cartINfo.forEach(function(value, index, cartINfo) {
  1255. // BargainId = cartINfo[index].bargain_id,
  1256. // combinationId = cartINfo[index].combination_id,
  1257. // discountId = cartINfo[index].discount_id
  1258. // })
  1259. // that.$set(that, 'BargainId', parseInt(BargainId));
  1260. // that.$set(that, 'combinationId', parseInt(combinationId));
  1261. // that.$set(that, 'discountId', parseInt(discountId));
  1262. if (that.cartArr.length == 3 && (that.BargainId || that.combinationId || that.seckillId || that.discountId)) {
  1263. that.cartArr[2].payStatus = 0;
  1264. that.$set(that, 'cartArr', that.cartArr);
  1265. }
  1266. },
  1267. /**
  1268. * 获取当前金额可用优惠券
  1269. *
  1270. */
  1271. getCouponList: function() {
  1272. let that = this;
  1273. let data = {
  1274. cartId: this.cartId,
  1275. 'new': this.news,
  1276. shipping_type: that.$util.$h.Add(that.shippingType, 1),
  1277. store_id: that.system_store ? that.system_store.id : 0
  1278. }
  1279. getCouponsOrderPrice(this.totalPrice, data).then(res => {
  1280. that.$set(that.coupon, 'list', res.data);
  1281. that.openType = 1;
  1282. });
  1283. },
  1284. /*
  1285. * 获取默认收货地址或者获取某条地址信息
  1286. */
  1287. getaddressInfo: function() {
  1288. let that = this;
  1289. if (that.addressId) {
  1290. getAddressDetail(that.addressId).then(res => {
  1291. res.data.is_default = parseInt(res.data.is_default);
  1292. that.addressInfo = res.data || {};
  1293. that.addressId = res.data.id || 0;
  1294. that.address.addressId = res.data.id || 0;
  1295. })
  1296. } else {
  1297. getAddressDefault().then(res => {
  1298. res.data.is_default = parseInt(res.data.is_default);
  1299. that.addressInfo = res.data || {};
  1300. that.addressId = res.data.id || 0;
  1301. that.address.addressId = res.data.id || 0;
  1302. })
  1303. }
  1304. },
  1305. payItem: function(e) {
  1306. let that = this;
  1307. let active = e;
  1308. that.active = active;
  1309. that.animated = true;
  1310. that.payType = that.cartArr[active].value;
  1311. that.computedPrice();
  1312. setTimeout(function() {
  1313. that.car();
  1314. }, 500);
  1315. },
  1316. couponTap: function() {
  1317. this.coupon.coupon = true;
  1318. this.coupon.list.forEach((item, index) => {
  1319. if (item.id == this.couponId) {
  1320. item.is_use = 1
  1321. } else {
  1322. item.is_use = 0
  1323. }
  1324. })
  1325. this.$set(this.coupon, 'list', this.coupon.list);
  1326. },
  1327. car: function() {
  1328. let that = this;
  1329. that.animated = false;
  1330. },
  1331. onAddress: function(name) {
  1332. let that = this;
  1333. if(name){
  1334. that.textareaStatus = false;
  1335. that.address.address = true;
  1336. that.pagesUrl = '/pages/users/user_address_list/index?news=' + this.news + '&cartId=' + this.cartId +
  1337. '&pinkId=' +
  1338. this.pinkId +
  1339. '&couponId=' +
  1340. this.couponId +'&delivery_type='+this.deliveryType+'&addressId='+this.addressId+'&store_id='+this.storeId+'&store_name='+ this.system_store.name+'&product_id='+this.product_id
  1341. }else{
  1342. uni.navigateTo({
  1343. url: '/pages/users/user_address/index?new=' + this.news + '&cartId=' + this.cartId +
  1344. '&pinkId=' +
  1345. this.pinkId +
  1346. '&couponId=' +
  1347. this.couponId +'&delivery_type='+this.deliveryType+'&addressId='+this.addressId+'&store_id='+this.storeId+'&store_name='+ this.system_store.name+'&product_id='+this.product_id
  1348. })
  1349. }
  1350. },
  1351. payment: function(data) {
  1352. let that = this;
  1353. console.log(data,'data')
  1354. orderCreate(that.orderKey, data).then(res => {
  1355. console.log(res,'resres')
  1356. let status = res.data.status,
  1357. orderId = res.data.result.orderId,
  1358. jsConfig = res.data.result.jsConfig,
  1359. goPages = '/pages/goods/order_pay_status/index?order_id=' + orderId + '&msg=' + res.msg +
  1360. '&type=3' + '&totalPrice=' + this.totalPrice
  1361. switch (status) {
  1362. case 'NOTICE':
  1363. case 'ORDER_EXIST':
  1364. case 'EXTEND_ORDER':
  1365. case 'PAY_ERROR':
  1366. uni.hideLoading();
  1367. return that.$util.Tips({
  1368. title: res.msg
  1369. }, {
  1370. tab: 5,
  1371. url: goPages
  1372. });
  1373. break;
  1374. case 'SUCCESS':
  1375. uni.hideLoading();
  1376. if (that.BargainId || that.combinationId || that.pinkId || that.seckillId || that
  1377. .discountId)
  1378. return that.$util.Tips({
  1379. title: res.msg,
  1380. icon: 'success'
  1381. }, {
  1382. tab: 4,
  1383. url: goPages
  1384. });
  1385. return that.$util.Tips({
  1386. title: res.msg,
  1387. icon: 'success'
  1388. }, {
  1389. tab: 5,
  1390. url: goPages
  1391. });
  1392. break;
  1393. case 'WECHAT_PAY':
  1394. that.toPay = true;
  1395. // #ifdef MP
  1396. /* that.toPay = true; */
  1397. let mp_pay_name=''
  1398. if(uni.requestOrderPayment){
  1399. mp_pay_name='requestOrderPayment'
  1400. }else{
  1401. mp_pay_name='requestPayment'
  1402. }
  1403. uni[mp_pay_name]({
  1404. timeStamp: jsConfig.timestamp,
  1405. nonceStr: jsConfig.nonceStr,
  1406. package: jsConfig.package,
  1407. signType: jsConfig.signType,
  1408. paySign: jsConfig.paySign,
  1409. success: function(res) {
  1410. uni.hideLoading();
  1411. if (that.BargainId || that.combinationId || that.pinkId || that
  1412. .seckillId || that.discountId)
  1413. return that.$util.Tips({
  1414. title: '支付成功',
  1415. icon: 'success'
  1416. }, {
  1417. tab: 4,
  1418. url: goPages
  1419. });
  1420. return that.$util.Tips({
  1421. title: '支付成功',
  1422. icon: 'success'
  1423. }, {
  1424. tab: 5,
  1425. url: goPages
  1426. });
  1427. },
  1428. fail: function(e) {
  1429. uni.hideLoading();
  1430. return that.$util.Tips({
  1431. title: '取消支付'
  1432. }, {
  1433. tab: 5,
  1434. url: goPages + '&status=2'
  1435. });
  1436. },
  1437. complete: function(e) {
  1438. uni.hideLoading();
  1439. //关闭当前页面跳转至订单状态
  1440. if (res.errMsg == 'requestPayment:cancel') return that.$util
  1441. .Tips({
  1442. title: '取消支付'
  1443. }, {
  1444. tab: 5,
  1445. url: goPages + '&status=2'
  1446. });
  1447. },
  1448. })
  1449. // #endif
  1450. // #ifdef H5
  1451. this.$wechat.pay(res.data.result.jsConfig).then(res => {
  1452. return that.$util.Tips({
  1453. title: '支付成功',
  1454. icon: 'success'
  1455. }, {
  1456. tab: 5,
  1457. url: goPages
  1458. });
  1459. }).catch(res => {
  1460. if (!this.$wechat.isWeixin()) {
  1461. uni.redirectTo({
  1462. url: goPages +
  1463. '&msg=支付失败&status=2'
  1464. })
  1465. }
  1466. if (res.errMsg == 'chooseWXPay:cancel') return that.$util.Tips({
  1467. title: '取消支付'
  1468. }, {
  1469. tab: 5,
  1470. url: goPages + '&status=2'
  1471. });
  1472. })
  1473. // #endif
  1474. // #ifdef APP-PLUS
  1475. uni.requestPayment({
  1476. provider: 'wxpay',
  1477. orderInfo: jsConfig,
  1478. success: (e) => {
  1479. let url = goPages;
  1480. uni.showToast({
  1481. title: "支付成功"
  1482. })
  1483. setTimeout(res => {
  1484. uni.redirectTo({
  1485. url: url
  1486. })
  1487. }, 2000)
  1488. },
  1489. fail: (e) => {
  1490. console.log(e,'ee')
  1491. let url = '/pages/goods/order_pay_status/index?order_id=' + orderId +
  1492. '&msg=支付失败';
  1493. uni.showModal({
  1494. content: "支付失败",
  1495. showCancel: false,
  1496. success: function(res) {
  1497. if (res.confirm) {
  1498. uni.redirectTo({
  1499. url: url
  1500. })
  1501. } else if (res.cancel) {
  1502. console.log('用户点击取消');
  1503. }
  1504. }
  1505. })
  1506. },
  1507. complete: () => {
  1508. uni.hideLoading();
  1509. },
  1510. });
  1511. // #endif
  1512. break;
  1513. case 'PAY_DEFICIENCY':
  1514. uni.hideLoading();
  1515. //余额不足
  1516. return that.$util.Tips({
  1517. title: res.msg
  1518. }, {
  1519. tab: 5,
  1520. url: goPages + '&status=1'
  1521. });
  1522. break;
  1523. case "WECHAT_H5_PAY":
  1524. uni.hideLoading();
  1525. that.$util.Tips({
  1526. title: '订单创建成功!'
  1527. }, {
  1528. tab: 4,
  1529. url: goPages + '&status=0'
  1530. });
  1531. setTimeout(() => {
  1532. location.href = res.data.result.jsConfig.mweb_url;
  1533. }, 2000);
  1534. break;
  1535. case 'ALIPAY_PAY':
  1536. //#ifdef H5
  1537. if (this.from === 'weixin') {
  1538. uni.redirectTo({
  1539. url: `/pages/users/alipay_invoke/index?id=${orderId}&pay_key=${res.data.result.pay_key}`
  1540. });
  1541. } else {
  1542. uni.hideLoading();
  1543. that.formContent = res.data.result.jsConfig;
  1544. that.$nextTick(() => {
  1545. document.getElementById('alipaysubmit').submit();
  1546. })
  1547. }
  1548. //#endif
  1549. // #ifdef MP
  1550. uni.navigateTo({
  1551. url: `/pages/users/alipay_invoke/index?id=${orderId}&link=${jsConfig.qrCode}`
  1552. });
  1553. // #endif
  1554. // #ifdef APP-PLUS
  1555. uni.requestPayment({
  1556. provider: 'alipay',
  1557. orderInfo: jsConfig,
  1558. success: (e) => {
  1559. uni.showToast({
  1560. title: "支付成功"
  1561. })
  1562. let url = '/pages/goods/order_pay_status/index?order_id=' + orderId +
  1563. '&msg=支付成功';
  1564. setTimeout(res => {
  1565. uni.redirectTo({
  1566. url: url
  1567. })
  1568. }, 2000)
  1569. },
  1570. fail: (e) => {
  1571. let url = '/pages/goods/order_pay_status/index?order_id=' + orderId +
  1572. '&msg=支付失败';
  1573. uni.showModal({
  1574. content: "支付失败",
  1575. showCancel: false,
  1576. success: function(res) {
  1577. if (res.confirm) {
  1578. uni.redirectTo({
  1579. url: url
  1580. })
  1581. } else if (res.cancel) {
  1582. console.log('用户点击取消');
  1583. }
  1584. }
  1585. })
  1586. },
  1587. complete: () => {
  1588. uni.hideLoading();
  1589. },
  1590. });
  1591. // #endif
  1592. break;
  1593. }
  1594. }).catch(err => {
  1595. uni.hideLoading();
  1596. return that.$util.Tips({
  1597. title: err
  1598. });
  1599. });
  1600. },
  1601. clickTextArea() {
  1602. this.$refs.textarea.focus()
  1603. },
  1604. bindDateChange: function(e, index) {
  1605. this.confirm[index].value = e.target.value
  1606. },
  1607. bindTimeChange: function(e, index) {
  1608. this.confirm[index].value = e.target.value
  1609. },
  1610. bindSelectChange: function(e, index, item) {
  1611. this.confirm[index].value = item.wordsConfig.list[e.detail.value].val
  1612. },
  1613. getTimeranges(index){
  1614. this.isShow = true
  1615. this.timerangesIndex = index
  1616. },
  1617. confrim(e){
  1618. this.isShow = false;
  1619. this.confirm[this.timerangesIndex].value = e.time;
  1620. let arrayNew = [];
  1621. e.val.forEach(item=>{
  1622. arrayNew.push(Number(item))
  1623. })
  1624. this.timeranges = arrayNew;
  1625. },
  1626. cancels(){
  1627. this.isShow = false;
  1628. },
  1629. // 单选
  1630. radioChange(e, index, item){
  1631. this.confirm[index].value = item.wordsConfig.list[e.detail.value].val
  1632. },
  1633. // 多选
  1634. checkboxChange(e, index, item){
  1635. let obj = e.detail.value;
  1636. let val = '';
  1637. item.wordsConfig.list.forEach((j,jindex)=>{
  1638. obj.forEach(x=>{
  1639. if(jindex == x){
  1640. val = val +(val?',':'') + j.val;
  1641. }
  1642. })
  1643. })
  1644. this.confirm[index].value = val
  1645. },
  1646. formVerify(){
  1647. let that = this;
  1648. if (!that.addressId && !that.shippingType && !that.product_type && !that.tableId) return that.$util.Tips({
  1649. title: '请选择收货地址'
  1650. });
  1651. if (that.shippingType == 1) {
  1652. if (that.contacts == "" || that.contactsTel == "") {
  1653. return that.$util.Tips({
  1654. title: '请填写联系人或联系人电话'
  1655. });
  1656. }
  1657. if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(that.contactsTel)) {
  1658. return that.$util.Tips({
  1659. title: '请填写正确的手机号'
  1660. });
  1661. }
  1662. if (!/^[\u4e00-\u9fa5\w]{2,16}$/.test(that.contacts)) {
  1663. return that.$util.Tips({
  1664. title: '请填写您的真实姓名'
  1665. });
  1666. }
  1667. if (that.storeList.length == 0) return that.$util.Tips({
  1668. title: '暂无门店,请选择其他方式'
  1669. });
  1670. }
  1671. for (var i = 0; i < that.confirm.length; i++) {
  1672. let data = that.confirm[i]
  1673. if (['radios'].indexOf(data.name) == -1 && (data.titleShow.val || (['uploadPicture','dateranges'].indexOf(data.name) == -1 && data.value && data.value.trim()))) {
  1674. if ((data.name === 'texts' && data.valConfig.tabVal == 0) || ['dates','times','selects','citys','checkboxs'].indexOf(data.name) != -1) {
  1675. if (!data.value || (data.value && !data.value.trim())) {
  1676. return that.$util.Tips({
  1677. title: `请填写${data.titleConfig.value}`
  1678. });
  1679. }
  1680. }
  1681. if(data.name === 'timeranges'){
  1682. if(!data.value){
  1683. return that.$util.Tips({
  1684. title: `请选择${data.titleConfig.value}`
  1685. });
  1686. }
  1687. }
  1688. if (data.name === 'dateranges') {
  1689. if (!data.value.length) {
  1690. return that.$util.Tips({
  1691. title: `请选择${data.titleConfig.value}`
  1692. });
  1693. }
  1694. }
  1695. if (data.name === 'texts' && data.valConfig.tabVal == 4) {
  1696. if (data.value <= 0) {
  1697. return that.$util.Tips({
  1698. title: `请填写大于0的${data.titleConfig.value}`
  1699. });
  1700. }
  1701. }
  1702. if (data.name === 'texts' && data.valConfig.tabVal == 3) {
  1703. if (!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(data.value)) {
  1704. return that.$util.Tips({
  1705. title: `请填写正确的${data.titleConfig.value}`
  1706. });
  1707. }
  1708. }
  1709. if (data.name === 'texts' && data.valConfig.tabVal == 1) {
  1710. if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(data.value)) {
  1711. return that.$util.Tips({
  1712. title: `请填写正确的${data.titleConfig.value}`
  1713. });
  1714. }
  1715. }
  1716. if (data.name === 'texts' && data.valConfig.tabVal == 2) {
  1717. if (!
  1718. /^[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
  1719. .test(data.value)) {
  1720. return that.$util.Tips({
  1721. title: `请填写正确的${data.titleConfig.value}`
  1722. });
  1723. }
  1724. }
  1725. if (data.name === 'uploadPicture') {
  1726. if (!data.value.length) {
  1727. return that.$util.Tips({
  1728. title: `请上传${data.titleConfig.value}`
  1729. });
  1730. }
  1731. }
  1732. }
  1733. }
  1734. this.pay_close = true;
  1735. },
  1736. SubOrder: function(e) {
  1737. let that = this,
  1738. data = {};
  1739. if (!that.payType) return that.$util.Tips({
  1740. title: '请选择支付方式'
  1741. });
  1742. data = {
  1743. collate_code_id: that.collage_id || that.tableId,
  1744. custom_form: that.confirm,
  1745. real_name: that.contacts,
  1746. phone: that.contactsTel,
  1747. addressId: that.addressId,
  1748. formId: '',
  1749. couponId: that.priceGroup.couponPrice == 0 ? 0 : that.couponId,
  1750. payType: that.payType,
  1751. useIntegral: that.useIntegral,
  1752. bargainId: that.BargainId,
  1753. combinationId: that.combinationId,
  1754. discountId: that.discountId,
  1755. pinkId: that.pinkId,
  1756. seckill_id: that.seckillId,
  1757. mark: that.mark,
  1758. store_id: that.deliveryType==1? 0 : that.system_store.id||0,
  1759. 'from': that.from,
  1760. shipping_type: that.tableId ? 4 : that.$util.$h.Add(that.shippingType, 1),
  1761. 'new': that.news,
  1762. 'invoice_id': that.invChecked,
  1763. // #ifdef H5
  1764. quitUrl: location.protocol + '//' + location.hostname +
  1765. '/pages/goods/order_pay_status/index?' +
  1766. '&type=3' + '&totalPrice=' + this.totalPrice
  1767. // #endif
  1768. // #ifdef APP-PLUS
  1769. quitUrl: '/pages/goods/order_details/index?order_id=' + this.order_id
  1770. // #endif
  1771. };
  1772. if (data.payType == 'yue' && parseFloat(that.userInfo.now_money) < parseFloat(that.totalPrice))
  1773. return that.$util.Tips({
  1774. title: '余额不足!'
  1775. });
  1776. uni.showLoading({
  1777. title: '订单支付中'
  1778. });
  1779. // #ifdef MP
  1780. openPaySubscribe().then(() => {
  1781. that.payment(data);
  1782. });
  1783. // #endif
  1784. // #ifndef MP
  1785. that.payment(data);
  1786. // #endif
  1787. }
  1788. }
  1789. }
  1790. </script>
  1791. <style lang="scss" scoped>
  1792. /deep/.uni-date-x--border{
  1793. border: 0;
  1794. }
  1795. /deep/.uni-icons{
  1796. font-size: 0 !important;
  1797. }
  1798. /deep/.uni-date-x{
  1799. color: #999;
  1800. font-size: 15px;
  1801. }
  1802. /deep/.uni-date__x-input{
  1803. font-size: 15px;
  1804. }
  1805. .height-add {
  1806. height: calc(120rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  1807. height: calc(120rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  1808. }
  1809. /deep/uni-checkbox[disabled] .uni-checkbox-input {
  1810. background-color: #eee;
  1811. }
  1812. .confirmImg {
  1813. width: 100%;
  1814. }
  1815. /deep/.orderGoods {
  1816. margin-top: 20rpx;
  1817. border-radius: 14rpx;
  1818. }
  1819. .confirmImg .upload {
  1820. padding-bottom: 36rpx;
  1821. }
  1822. .confirmImg .upload .pictrue {
  1823. margin: 22rpx 23rpx 0 0;
  1824. width: 146rpx;
  1825. height: 146rpx;
  1826. position: relative;
  1827. font-size: 24rpx;
  1828. color: #bbb;
  1829. }
  1830. .confirmImg .upload .pictrue:nth-of-type(4n) {
  1831. margin-right: 0;
  1832. }
  1833. .confirmImg .upload .pictrue image {
  1834. width: 100%;
  1835. height: 100%;
  1836. border-radius: 8rpx;
  1837. }
  1838. .confirmImg .upload .pictrue .icon-guanbi1 {
  1839. position: absolute;
  1840. font-size: 45rpx;
  1841. top: -10rpx;
  1842. right: -10rpx;
  1843. }
  1844. .confirmImg .upload .pictrue .close{
  1845. position: absolute;
  1846. width: 26rpx;
  1847. height: 26rpx;
  1848. border-radius: 0 8rpx 0 8rpx;
  1849. background-color: rgba(0, 0, 0, 0.6);
  1850. top: 0;
  1851. right: 0;
  1852. }
  1853. .confirmImg .upload .pictrue .close .iconfont{
  1854. font-size: 24rpx;
  1855. }
  1856. .confirmImg .upload .pictrue .icon-icon25201 {
  1857. color: #bfbfbf;
  1858. font-size: 50rpx;
  1859. }
  1860. .confirmImg .upload .pictrue:nth-last-child(1) {
  1861. border: 1rpx solid #ddd;
  1862. box-sizing: border-box;
  1863. }
  1864. .alipaysubmit {
  1865. display: none;
  1866. }
  1867. .order-submission .line {
  1868. width: 100%;
  1869. height: 4rpx;
  1870. }
  1871. .order-submission .line image {
  1872. width: 100%;
  1873. height: 100%;
  1874. display: block;
  1875. }
  1876. .order-submission .headerCon {
  1877. background-color: #fff;
  1878. box-sizing: border-box;
  1879. .icon-s-bianji {
  1880. width: 44rpx;
  1881. height: 44rpx;
  1882. background: #F5F5F5;
  1883. border-radius: 50%;
  1884. text-align: center;
  1885. line-height: 44rpx;
  1886. font-size: 17rpx;
  1887. color: #666;
  1888. }
  1889. .add-title {
  1890. height: 72rpx;
  1891. padding: 0 26rpx;
  1892. border-bottom: 1px solid #eee;
  1893. .icon {
  1894. height: 32rpx;
  1895. background: #1890FF;
  1896. border-radius: 4rpx;
  1897. font-size: 20rpx;
  1898. font-weight: 400;
  1899. color: #FFFFFF;
  1900. text-align: center;
  1901. line-height: 32rpx;
  1902. padding: 0 6rpx;
  1903. &.orange{
  1904. background: #FE960F;
  1905. }
  1906. &.red{
  1907. background: #E93323;
  1908. }
  1909. }
  1910. .add-text {
  1911. margin-left: 14rpx;
  1912. width: 360rpx;
  1913. }
  1914. .text {
  1915. font-size: 24rpx;
  1916. font-weight: 400;
  1917. color: #999999;
  1918. .icon-jiantou {
  1919. display: inline-block;
  1920. font-size: 20rpx;
  1921. }
  1922. }
  1923. }
  1924. }
  1925. .order-submission .address{
  1926. padding: 0 26rpx;
  1927. height: 130rpx;
  1928. .icon{
  1929. .iconfont{
  1930. width: 44rpx;
  1931. height: 44rpx;
  1932. background: var(--view-minorColorT);
  1933. font-size: 20rpx;
  1934. border-radius: 50%;
  1935. text-align: center;
  1936. line-height: 44rpx;
  1937. color: var(--view-theme);
  1938. margin-left: 26rpx;
  1939. }
  1940. }
  1941. }
  1942. .order-submission .address .addressCon {
  1943. width: 502rpx;
  1944. font-size: 26rpx;
  1945. color: #666;
  1946. }
  1947. .order-submission .address .addressCon .name {
  1948. font-size: 30rpx;
  1949. color: #282828;
  1950. font-weight: bold;
  1951. margin-bottom: 10rpx;
  1952. .nameCon{
  1953. max-width: 244rpx;
  1954. &.on{
  1955. max-width: unset;
  1956. }
  1957. }
  1958. }
  1959. .order-submission .address .addressCon .name .phone {
  1960. margin-left: 50rpx;
  1961. }
  1962. .order-submission .address .addressCon .default {
  1963. margin-right: 12rpx;
  1964. }
  1965. .order-submission .address .addressCon .setaddress {
  1966. color: #333;
  1967. font-size: 28rpx;
  1968. }
  1969. .order-submission .allAddress {
  1970. width: 100%;
  1971. background: linear-gradient(to bottom, var(--view-theme) 0%, #f5f5f5 100%);
  1972. display: flex;
  1973. flex-direction: column;
  1974. justify-content: center;
  1975. align-items: center;
  1976. padding-top: 24rpx;
  1977. }
  1978. .order-submission .allAddress .nav {
  1979. width: 710rpx;
  1980. // margin: 0 auto;
  1981. }
  1982. .order-submission .allAddress .nav .item {
  1983. width: 355rpx;
  1984. }
  1985. .order-submission .allAddress .nav .item.on {
  1986. position: relative;
  1987. width: 250rpx;
  1988. }
  1989. .order-submission .allAddress .nav .item.on::before {
  1990. position: absolute;
  1991. bottom: 0;
  1992. content: "快递配送";
  1993. font-size: 28rpx;
  1994. display: block;
  1995. height: 0;
  1996. width: 336rpx;
  1997. border-width: 0 20rpx 80rpx 0;
  1998. border-style: none solid solid;
  1999. border-color: transparent transparent #fff;
  2000. z-index: 2;
  2001. border-radius: 7rpx 30rpx 0 0;
  2002. text-align: center;
  2003. // line-height: 80rpx;
  2004. }
  2005. .header-title {
  2006. font-size: 36rpx;
  2007. font-weight: 600;
  2008. color: #FFFFFF;
  2009. }
  2010. .order-submission .allAddress .nav .item:nth-of-type(2).on::before {
  2011. content: "到店自提";
  2012. border-width: 0 0 80rpx 20rpx;
  2013. border-radius: 30rpx 7rpx 0 0;
  2014. }
  2015. .order-submission .allAddress .nav .item.on2 {
  2016. position: relative;
  2017. }
  2018. .order-submission .allAddress .nav .item.on2::before {
  2019. position: absolute;
  2020. bottom: 0;
  2021. content: "到店自提";
  2022. font-size: 28rpx;
  2023. display: block;
  2024. height: 0;
  2025. width: 400rpx;
  2026. border-width: 0 0 60rpx 60rpx;
  2027. border-style: none solid solid;
  2028. border-color: transparent transparent rgba(255, 255, 255, 0.6);
  2029. border-radius: 40rpx 6rpx 0 0;
  2030. text-align: center;
  2031. // line-height: 60rpx;
  2032. }
  2033. .order-submission .allAddress .nav .item:nth-of-type(1).on2::before {
  2034. content: "快递配送";
  2035. border-width: 0 60rpx 60rpx 0;
  2036. border-radius: 6rpx 40rpx 0 0;
  2037. }
  2038. .order-submission .allAddress .headerCon{
  2039. width: 710rpx;
  2040. margin: 0 auto;
  2041. border-radius: 14rpx;
  2042. background-color: #fff;
  2043. }
  2044. .order-submission .allAddress .line {
  2045. width: 710rpx;
  2046. margin: 0 auto;
  2047. }
  2048. .order-submission .wrapper .item .discount .placeholder {
  2049. color: #ccc;
  2050. }
  2051. .placeholder-textarea {
  2052. position: relative;
  2053. .placeholder {
  2054. position: absolute;
  2055. color: #ccc;
  2056. top: 26rpx;
  2057. left: 30rpx;
  2058. }
  2059. }
  2060. .order-submission .wrapper {
  2061. background-color: #fff;
  2062. width: 710rpx;
  2063. border-radius: 14rpx;
  2064. margin: 0 auto;
  2065. margin-top: 14rpx;
  2066. }
  2067. .order-submission .wrapper .item .name {
  2068. position: relative;
  2069. width: 190rpx;
  2070. }
  2071. .order-submission .wrapper .item .asterisk {
  2072. position: absolute;
  2073. color: red;
  2074. left: -15rpx
  2075. }
  2076. .order-submission .wrapper .item {
  2077. padding: 27rpx 30rpx;
  2078. font-size: 30rpx;
  2079. color: #282828;
  2080. border-bottom: 1px solid #f0f0f0;
  2081. }
  2082. .order-submission .wrapper .item.on{
  2083. padding: 17rpx 14rpx 17rpx 30rpx;
  2084. align-items: baseline;
  2085. }
  2086. .order-submission .wrapper .item.on3{
  2087. align-items: baseline;
  2088. }
  2089. .order-submission .wrapper .item.on2{
  2090. padding: 17rpx 30rpx;
  2091. }
  2092. .order-submission .wrapper .item .discount {
  2093. font-size: 30rpx;
  2094. color: #999;
  2095. }
  2096. .order-submission .wrapper .item.on .discount,
  2097. .order-submission .wrapper .item.on3 .discount{
  2098. width: 460rpx;
  2099. text-align: right;
  2100. }
  2101. .order-submission .wrapper .item.on3 .discount .city{
  2102. width: 400rpx;
  2103. }
  2104. .order-submission .wrapper .item .discount input {
  2105. text-align: right;
  2106. width: 450rpx;
  2107. }
  2108. .order-submission .wrapper .item .discount .iconfont {
  2109. color: #515151;
  2110. font-size: 30rpx;
  2111. margin-left: 15rpx;
  2112. }
  2113. .order-submission .wrapper .item .discount .num {
  2114. font-size: 32rpx;
  2115. margin-right: 20rpx;
  2116. }
  2117. .order-submission .wrapper .item .discount .radio{
  2118. margin: 0 22rpx 0 22rpx;
  2119. padding: 10rpx 0;
  2120. }
  2121. .order-submission .wrapper .item .discount .radio /deep/uni-checkbox .uni-checkbox-input{
  2122. border-radius: 0 }
  2123. .order-submission .wrapper .item .shipping {
  2124. font-size: 30rpx;
  2125. color: #999;
  2126. position: relative;
  2127. padding-right: 58rpx;
  2128. }
  2129. .order-submission .wrapper .item .shipping .iconfont {
  2130. font-size: 35rpx;
  2131. color: #707070;
  2132. position: absolute;
  2133. right: 0;
  2134. top: 50%;
  2135. transform: translateY(-50%);
  2136. margin-left: 30rpx;
  2137. }
  2138. .order-submission .wrapper .item textarea {
  2139. background-color: #f9f9f9;
  2140. width: 650rpx;
  2141. height: 140rpx;
  2142. border-radius: 3rpx;
  2143. margin-top: 30rpx;
  2144. padding: 25rpx 28rpx;
  2145. box-sizing: border-box;
  2146. }
  2147. .order-submission .wrapper .item .placeholder {
  2148. color: #ccc;
  2149. }
  2150. .order-submission .wrapper .item .list {
  2151. margin-top: 35rpx;
  2152. }
  2153. .order-submission .wrapper .item .list .payItem {
  2154. border: 1px solid #eee;
  2155. border-radius: 6rpx;
  2156. height: 86rpx;
  2157. width: 100%;
  2158. box-sizing: border-box;
  2159. margin-top: 20rpx;
  2160. font-size: 28rpx;
  2161. color: #282828;
  2162. }
  2163. .order-submission .wrapper .item .list .payItem.on {
  2164. border-color: #fc5445;
  2165. color: #e93323;
  2166. }
  2167. .order-submission .wrapper .item .list .payItem .name {
  2168. width: 50%;
  2169. text-align: center;
  2170. border-right: 1px solid #eee;
  2171. padding-left: 80rpx;
  2172. }
  2173. .order-submission .wrapper .item .list .payItem .name .iconfont {
  2174. width: 44rpx;
  2175. height: 44rpx;
  2176. border-radius: 50%;
  2177. text-align: center;
  2178. line-height: 44rpx;
  2179. background-color: #fe960f;
  2180. color: #fff;
  2181. font-size: 30rpx;
  2182. margin-right: 15rpx;
  2183. }
  2184. .order-submission .wrapper .item .list .payItem .name .iconfont.icon-weixin2 {
  2185. background-color: #41b035;
  2186. }
  2187. .order-submission .wrapper .item .list .payItem .name .iconfont.icon-zhifubao {
  2188. background-color: #1677FF;
  2189. }
  2190. .order-submission .wrapper .item .list .payItem .tip {
  2191. width: 49%;
  2192. text-align: center;
  2193. font-size: 26rpx;
  2194. color: #aaa;
  2195. }
  2196. .order-submission .moneyList {
  2197. background-color: #fff;
  2198. padding: 30rpx;
  2199. width: 710rpx;
  2200. border-radius: 14rpx;
  2201. margin: 0 auto;
  2202. margin-top: 14rpx;
  2203. }
  2204. .order-submission .moneyList .item {
  2205. font-size: 28rpx;
  2206. color: #282828;
  2207. }
  2208. .order-submission .moneyList .item~.item {
  2209. margin-top: 20rpx;
  2210. }
  2211. .order-submission .moneyList .item .money {
  2212. color: #868686;
  2213. }
  2214. .order-submission .footer {
  2215. width: 100%;
  2216. height: 100rpx;
  2217. background-color: #fff;
  2218. padding: 0 30rpx;
  2219. font-size: 28rpx;
  2220. color: #333;
  2221. box-sizing: border-box;
  2222. position: fixed;
  2223. bottom: 0;
  2224. left: 0;
  2225. z-index: 9;
  2226. height: calc(100rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  2227. height: calc(100rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  2228. padding-bottom: calc(0rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  2229. padding-bottom: calc(0rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  2230. }
  2231. .order-submission .footer .settlement {
  2232. font-size: 30rpx;
  2233. color: #fff;
  2234. width: 240rpx;
  2235. height: 70rpx;
  2236. background-color: var(--view-theme);
  2237. border-radius: 50rpx;
  2238. text-align: center;
  2239. line-height: 70rpx;
  2240. }
  2241. .footer .transparent {
  2242. opacity: 0
  2243. }
  2244. .tipaddress {
  2245. position: fixed;
  2246. left: 13%;
  2247. top: 25%;
  2248. // margin-left: -283rpx;
  2249. width: 560rpx;
  2250. height: 614rpx;
  2251. background-color: #fff;
  2252. border-radius: 10rpx;
  2253. z-index: 100;
  2254. text-align: center;
  2255. .top {
  2256. width: 560rpx;
  2257. height: 270rpx;
  2258. border-top-left-radius: 10rpx;
  2259. border-top-right-radius: 10rpx;
  2260. background-image: url(../../../static/images/address.png);
  2261. background-repeat: round;
  2262. background-color: var(--view-theme);
  2263. .tipsphoto {
  2264. display: inline-block;
  2265. width: 200rpx;
  2266. height: 200rpx;
  2267. margin-top: 73rpx;
  2268. }
  2269. }
  2270. .bottom {
  2271. font-size: 32rpx;
  2272. font-weight: 400;
  2273. .font1 {
  2274. font-size: 36rpx;
  2275. font-weight: 600;
  2276. color: #333333;
  2277. margin: 32rpx 0rpx 22rpx;
  2278. }
  2279. .font2 {
  2280. color: #666666;
  2281. margin-bottom: 48rpx;
  2282. }
  2283. .btn {
  2284. width: 360rpx;
  2285. height: 82rpx;
  2286. border-radius: 42rpx;
  2287. background: linear-gradient(to left, var(--view-theme) 0%, #f5f5f5 100%);
  2288. color: #FFFFFF;
  2289. line-height: 82rpx;
  2290. margin: 0 auto;
  2291. }
  2292. }
  2293. }
  2294. .mark {
  2295. position: fixed;
  2296. top: 0;
  2297. left: 0;
  2298. bottom: 0;
  2299. right: 0;
  2300. background: rgba(0, 0, 0, 0.5);
  2301. z-index: 99;
  2302. }
  2303. .table-header {
  2304. width: 710rpx;
  2305. padding: 52rpx 24rpx 46rpx;
  2306. border-radius: 14rpx;
  2307. margin: 0 30rpx;
  2308. background-color: #FFFFFF;
  2309. font-size: 24rpx;
  2310. color: #999999;
  2311. .top {
  2312. display: flex;
  2313. margin-bottom: 18rpx;
  2314. }
  2315. .name {
  2316. flex: 1;
  2317. min-width: 0;
  2318. font-weight: 600;
  2319. font-size: 34rpx;
  2320. color: #333333;
  2321. }
  2322. .number {
  2323. color: #333333;
  2324. }
  2325. .light {
  2326. margin-right: 6rpx;
  2327. font-weight: 600;
  2328. font-size: 34rpx;
  2329. color: var(--view-theme);
  2330. }
  2331. }
  2332. </style>