affirmSh.vue 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744
  1. <template>
  2. <view class="affirm-page">
  3. <view class="affirm-view overscroll">
  4. <form>
  5. <view class="module-com">
  6. <view class="flex-space ghs-msg">
  7. {{ghsInfo.name}} {{ ghsInfo.telephone }}
  8. <i class="iconfont icondianhua1" @tap="toPhone(ghsInfo.telephone)"></i>
  9. </view>
  10. <view class="flex ghs-msg active">
  11. {{ ghsInfo.fullAddress }}
  12. </view>
  13. </view>
  14. <view class="module-com">
  15. <view class="commodity-view">
  16. <view class="commodity-list">
  17. <view class="commodity-item" :class="{'limit-exceed-item': isLimitExceededItem(item)}" v-for="(item, index) in selectList" :key="index">
  18. <image class="item-icon" :src="item.cover" mode="aspectFill" />
  19. <view class="item-info">
  20. <view class="item-row-top">
  21. <text class="item-name">{{ item.itemName }}</text>
  22. <view class="item-price-block">
  23. <view class="item-price-line">
  24. <text class="price-current">{{ affirmCommodityPriceParts[index].main }}</text>
  25. <text v-if="affirmCommodityPriceParts[index].showStrike" class="price-original">{{ affirmCommodityPriceParts[index].strike }}</text>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="item-row-qty">
  30. <text v-if="item.bigCount > 0" class="qty-part qty-big">{{ item.bigCount }}{{ item.bigUnit }}</text>
  31. <text v-if="item.bigCount > 0 && item.smallCount > 0" class="qty-sep">·</text>
  32. <text v-if="item.smallCount > 0" class="qty-part qty-small">{{ item.smallCount }}{{ item.smallUnit }}</text>
  33. </view>
  34. <view v-if="isLimitExceededItem(item) || getLimitBuyPriceTip(item) || item.presell == 1" class="item-row-tips">
  35. <text v-if="isLimitExceededItem(item)" class="limit-exceed-tip">限购 {{ limitExceedLimitBuy }},超出 {{ limitExceedNum }}</text>
  36. <text v-if="getLimitBuyPriceTip(item)" class="limit-buy-price-tip">{{ getLimitBuyPriceTip(item) }}</text>
  37. <text v-if="item.presell == 1" class="presell-tip">预售花材下单不能退款</text>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="summary-bar">
  43. <view class="operate-view" @click="gobackEvent">
  44. <text class="iconfont icongouwuche"></text>返回修改
  45. </view>
  46. <view class="describe-view">
  47. <text class="price">共{{ allCountFun.bigLength }}扎,{{ allCountFun.weight }}公斤,合计 ¥{{ allPriceFun }}</text>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. <block v-if="ghsInfoLoaded">
  53. <view class="module-com input-line-wrap">
  54. <!-- 配送方式选择 -->
  55. <tui-list-cell class="line-cell" :hover="false" :arrow="false">
  56. <button
  57. v-for="(item, index) in visibleMethodList"
  58. :key="item.style"
  59. class="admin-button-com middle sh-method-btn"
  60. :class="[
  61. selectedMethodIndex === index ? 'blue' : 'default',
  62. item.name && item.name.length <= 2 ? 'sh-method-btn--short' : 'sh-method-btn--long'
  63. ]"
  64. @click="selectMethodByIndex(index)"
  65. >{{ item.name }}</button>
  66. </tui-list-cell>
  67. <!-- 配送方式说明 -->
  68. <tui-list-cell
  69. v-if="currentMethodExplains.length > 0"
  70. class="line-cell"
  71. :hover="false"
  72. :arrow="false"
  73. >
  74. <view>
  75. <view v-for="(exp, index) in currentMethodExplains" :key="index">
  76. <text :style="'width:100%;color:' + (Number(exp.color) === 2 ? 'red' : Number(exp.color) === 3 ? '#3385FF' : '#333333') + ';font-weight:' + (Number(exp.fontWeight) === 2 ? 'bold' : 'normal') + ';'">{{ exp.explain }}</text>
  77. </view>
  78. </view>
  79. </tui-list-cell>
  80. <!-- 物流填写/选择 -->
  81. <tui-list-cell class="line-cell" :hover="false" v-if="form.sendType == 3">
  82. <view class="tui-title">配送物流</view>
  83. <view class="wl-field-row">
  84. <input
  85. type="text"
  86. placeholder="请填写物流"
  87. v-model="form.wlName"
  88. @focus="onWlNameFocus"
  89. @input="onWlNameInput"
  90. placeholder-class="tui-placeholder"
  91. class="wl-name-input"
  92. />
  93. <button
  94. v-if="wlList.length > 0"
  95. class="admin-button-com middle wl-select-btn"
  96. @click="openWlSelect"
  97. >选择物流</button>
  98. </view>
  99. </tui-list-cell>
  100. <!-- 未达标提示:加运费/加包装费/不能下单 -->
  101. <tui-list-cell class="line-cell" :hover="false" :arrow="false" v-if="showShMethodUnMeetWarning">
  102. <view>
  103. <text style="color: red;width:100%;font-weight: bold;font-size: 30upx;text-decoration: underline;">{{ shMethodUnMeetWarningText }}</text>
  104. </view>
  105. </tui-list-cell>
  106. <!-- 配送地址状态提示 -->
  107. <tui-list-cell v-if="form.sendType == 2 && ghsInfo.openIntraCity != 1" class="line-cell" :hover="false" :arrow="false">
  108. <view>
  109. <text v-if="ghsInfo.openIntraCity == 0" style="color: #3385FF;width:100%;font-size:30upx;font-weight:bold;">运费自理或到付(请联系客服)</text>
  110. <text v-if="ghsInfo.openIntraCity == 2" style="color: red;width:100%;font-size:30upx;font-weight:bold;">跑腿配送暂不可用,请选其它方式</text>
  111. </view>
  112. </tui-list-cell>
  113. <!-- 收货地址 -->
  114. <tui-list-cell class="line-cell" :hover="false" :arrow="true" v-if="displayAddress" @click="modifyAddress">
  115. <view class="tui-title">收花地址</view>
  116. <view v-if="validAddress || ghsInfo.shopId==10649 || ghsInfo.shopId ==33668">
  117. <view style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width:420upx;"><text>{{ shopInfo.address }}</text></view>
  118. <view v-if="shopInfo.showAddress!=shopInfo.fullAddress" style="color:#848181;"><text>{{ shopInfo.showAddress }}</text></view>
  119. </view>
  120. <view v-else>
  121. <view><text style="color:red;font-weight:bold;font-size:30upx;">请填写您的地址</text></view>
  122. </view>
  123. </tui-list-cell>
  124. <!-- 跑腿平台报价列表 -->
  125. <tui-list-cell v-if="form.sendType == 2 && currentShMethod && Number(currentShMethod.calcType) == 0 && ghsInfo.openIntraCity == 1" class="line-cell" :hover="false">
  126. <view v-if="ghsInfo.openIntraCity == 1 && deliveryQuotes.length > 0" class="delivery-quotes-container">
  127. <view class="delivery-quotes-grid">
  128. <view
  129. v-for="(item, index) in deliveryQuotes"
  130. :key="index"
  131. class="delivery-quote-item"
  132. :class="{
  133. 'active': selectedDeliveryIndex === index,
  134. 'disabled': !item.isAble,
  135. 'fixed-width': deliveryQuotes.length <= 2
  136. }"
  137. @click="selectDelivery(item, index)"
  138. >
  139. <view class="platform-name">{{ item.displayName || item.name }}</view>
  140. <view class="platform-price">{{ item.priceText }}元</view>
  141. <view v-if="item.type" class="platform-type">{{ item.type }}</view>
  142. </view>
  143. </view>
  144. </view>
  145. <view v-else style="text-align: center; padding: 20upx 0;">
  146. <text v-if="validAddress">正在获取运费...</text>
  147. <text v-else style="color:red;font-weight:bold;font-size:32upx;" @click="modifyAddress">请完善收货地址</text>
  148. </view>
  149. </tui-list-cell>
  150. <!-- 距离展示 -->
  151. <tui-list-cell class="line-cell" :hover="false" v-if="form.sendType == 2 && Number(showDistance)>0">
  152. <view class="tui-title">距离</view>
  153. <text v-if="showDistance > 100" style="color: #3385FF">{{ (showDistance/1000).toFixed(1) }}公里</text>
  154. <text v-else style="color: #3385FF">{{ showDistance }} 米</text>
  155. </tui-list-cell>
  156. <!-- 跑腿费 -->
  157. <tui-list-cell class="line-cell" :hover="false" v-if="form.sendType == 2">
  158. <view class="tui-title">跑腿费</view>
  159. <view>
  160. <text :class="isFreePt ? 'delivery-price-free' : 'delivery-price-normal'">¥{{ form.sendCost }}</text>
  161. <text v-if="isFreePt" class="free-delivery-tag">¥0</text>
  162. <text class="delivery-policy-link" @click="showDeliveryPolicyModal">免运费条件</text>
  163. </view>
  164. </tui-list-cell>
  165. <!-- 额外费用(包装费/运费) -->
  166. <tui-list-cell class="line-cell" :hover="false" v-if="showShMethodExtraFee">
  167. <view class="tui-title">{{ shMethodExtraFeeLabel }}</view>
  168. <text style="color: #3385FF">¥{{ shMethodExtraFeeAmount }}</text>
  169. </tui-list-cell>
  170. <!-- 总金额 -->
  171. <tui-list-cell class="line-cell" :hover="false" :arrow="false">
  172. <view class="tui-title">总金额</view>
  173. <text style="color: #3385FF">¥ {{ panelTotalPrice }}</text>
  174. </tui-list-cell>
  175. <!-- 配送日期 -->
  176. <tui-list-cell class="line-cell" :hover="false" :arrow="true">
  177. <view class="tui-title">配送日期</view>
  178. <picker mode="date" :value="sendTimeWant" @change="bindDateChange" style="width:400upx;">
  179. <view class="uni-input" v-if="sendTimeWant==''" style="color:#CCCCCC;">请选日期,默认当天</view>
  180. <view class="uni-input">{{ sendTimeWant }}</view>
  181. </picker>
  182. </tui-list-cell>
  183. <!-- 备注 -->
  184. <tui-list-cell class="line-cell" :hover="false" :arrow="false">
  185. <textarea style="height: 80upx" v-model="remark" placeholder="这里写备注"/>
  186. </tui-list-cell>
  187. </view>
  188. </block>
  189. </form>
  190. </view>
  191. <view class="under-bar">
  192. <view class="price-view">
  193. <text class="price-title">合计</text>
  194. <text class="price-number">¥<text class="large">{{ modifyPrice}}</text></text>
  195. <text v-if="allReachDiscountAmount > 0" class="price-discount-tip">省¥{{ parseFloat(allReachDiscountAmount) }}</text>
  196. </view>
  197. <button class="admin-button-com blue big" @click="affirmFormSubmit(0)">提交</button>
  198. </view>
  199. <uni-popup ref="selectFlowerNumRef" background-color="#fff" type="center" :animation="false" class="class-popup-style">
  200. <view style="font-size:32upx;margin:30upx 0 10upx 30upx;width:90vw;font-weight:bold;">以下库存不足,剩余的库存,是否都要?</view>
  201. <view v-if="!$util.isEmpty(lackList)" style="display:flex;padding:10upx 20upx 20upx 30upx;height:auto;justify-content: space-between;align-items:center;flex-wrap:wrap;max-height:80vh;overflow:auto;width:90vw;font-size:32upx;">
  202. <view v-for="(item, index) in lackList" :key="index" style="width:100%;margin-top:10upx;">{{ item.name }}<text style="margin-left:20upx;font-weight:bold;color:red;">剩{{item.stock}}个</text></view>
  203. </view>
  204. <view style="width:90vw;margin:20upx 0 20upx 0;display:flex;align-items: center; justify-content: center;">
  205. <button class="admin-button-com big blue" style="width:190upx;" @click="gobackEvent">返回修改</button>
  206. <button class="admin-button-com big blue" style="width:190upx;" @click="closeRemind()">取消</button>
  207. <button class="admin-button-com big blue" style="width:190upx;" @click="affirmFormSubmit(1)">要</button>
  208. </view>
  209. </uni-popup>
  210. <uni-popup ref="deliveryPolicyPopup" type="center" background-color="#fff">
  211. <view class="policy-popup-content">
  212. <view class="policy-title">免运费条件</view>
  213. <scroll-view scroll-y="true" class="policy-scroll">
  214. <view class="policy-list">
  215. <block v-for="(item, index) in deliveryPolicyList" :key="index">
  216. <view class="policy-item">{{ item }}</view>
  217. </block>
  218. </view>
  219. </scroll-view>
  220. <view class="policy-btn" @click="closeDeliveryPolicy">知道了</view>
  221. </view>
  222. </uni-popup>
  223. <!-- 物流选择弹框:展示供货商配置的物流列表,选中后回填输入框 -->
  224. <uni-popup ref="wlPopupRef" background-color="#fff" type="center" :animation="false" class="wl-popup-wrap">
  225. <view class="wl-popup-content">
  226. <view class="wl-popup-title">请选择物流</view>
  227. <scroll-view scroll-y="true" class="wl-popup-scroll">
  228. <view class="wl-popup-list">
  229. <view v-for="(item, index) in wlList" :key="index" class="wl-popup-item">
  230. <button
  231. class="admin-button-com wl-option-btn"
  232. @click.stop="selectWl(item)"
  233. :class="{ selected: form.wlName === item.name }"
  234. >{{ item.name }}</button>
  235. </view>
  236. </view>
  237. </scroll-view>
  238. <view class="wl-popup-footer">
  239. <button class="admin-button-com big blue wl-popup-cancel-btn" @click="cancelWlSelect">取消</button>
  240. </view>
  241. </view>
  242. </uni-popup>
  243. </view>
  244. </template>
  245. <script>
  246. import TuiListCell from "@/components/plugin/list-cell";
  247. import AppAvatarModule from "@/components/module/app-avatar";
  248. import SimpleAddress from "@/components/plugin/simple-address";
  249. import AppAreaSel from "@/components/app-area-sel";
  250. import AppCustomerSel from "@/components/app-customer-sel";
  251. import productMins from "@/mixins/cgProduct";
  252. import appFormRadioBtn from "@/components/app-formRadio-btn";
  253. import appAddressGroup from "@/components/app-address-group";
  254. import appFormSend from "@/components/app-form-send";
  255. import appSendTime from "@/components/app-send-time";
  256. const formUtil = require("@/utils/formValidation.js");
  257. import AppDatePicker from "@/components/app-date-picker";
  258. import { getGhsDataApi,getWlList,calcCustomPtFee } from "@/api/ghs";
  259. import { createOrder,getShMethod } from "@/api/purchase";
  260. import { mapActions, mapGetters } from "vuex";
  261. import { shopHouponHas } from '@/api/coupon'
  262. import {currentShop} from "@/api/shop"
  263. import { allDeliveryQuotes } from "@/api/express/delivery";
  264. import ModalModule from "@/components/plugin/modal";
  265. export default {
  266. name: "affirmGhs",
  267. components: {
  268. TuiListCell,
  269. AppAvatarModule,
  270. SimpleAddress,
  271. AppAreaSel,
  272. appSendTime,
  273. AppCustomerSel,
  274. appFormRadioBtn,
  275. appAddressGroup,
  276. appFormSend,
  277. AppDatePicker,
  278. ModalModule
  279. },
  280. mixins: [productMins],
  281. data() {
  282. return {
  283. isModel: false,
  284. pageType: "cg",
  285. ghsInfo:'',
  286. sendTimeWant:'',
  287. remark:'',
  288. form: {
  289. debt:1,//结算方式 1欠款订单 0正常订单
  290. shopId: "",
  291. shopName: "",
  292. receiveProvince: "",
  293. receiveCity: "",
  294. receiveFloor: "",
  295. receiveAddress: "",
  296. receiveLong: "",
  297. receiveLat: "",
  298. sendType: 0,
  299. transType:4,
  300. sendSide: "2",
  301. sendDate: "",
  302. sendCost: 0,
  303. customId: "",
  304. product: "",
  305. hbId: '0',
  306. packCost:0,
  307. wlName:'',
  308. wlId:0
  309. },
  310. lackExpend:0,
  311. hasHb:0,
  312. selectedHb:{couponAmount:0,hbId:0,couponSelInx:0},
  313. customData: {
  314. bigCount: 0,
  315. smallCount: 0
  316. },
  317. shopInfo:{
  318. lat:'',
  319. long:'',
  320. fullAddress:'',
  321. showAddress:'',
  322. address:''
  323. },
  324. wlList:[],
  325. wlSelData: {id:0,name:''},
  326. needAddPackCost:false,
  327. transCost:[],
  328. lackList:[],
  329. limitExceedProductId:'',
  330. limitExceedLimitBuy:'',
  331. limitExceedNum:'',
  332. showDistance:0,
  333. deliveryQuotes: [], // 跑腿平台报价列表
  334. selectedDeliveryIndex: -1, // 选中的报价索引
  335. selectedDeliveryData: null, // 选中的报价数据
  336. deliveryPolicyList: [], // 包配送政策列表
  337. validAddress:false,
  338. ghsInfoLoaded: false,
  339. methodList: [],
  340. /** 当前选中的配送方式下标,默认加载后选中第一项 */
  341. selectedMethodIndex: -1
  342. };
  343. },
  344. onLoad() {
  345. this.getGhsData(this.option.id)
  346. },
  347. onShow() {
  348. if(this.selectedHb.hbId && this.selectedHb.hbId > 0) {
  349. this.form.hbId = this.selectedHb.hbId
  350. }else{
  351. this.form.hbId = 0
  352. this.hasCoupon()
  353. }
  354. //修改地址重新返回页面时,重新获取当前门店信息
  355. this.modifyAddressToggle()
  356. },
  357. computed: {
  358. ...mapGetters(["getMerchantInfo", "getLoginInfo","getDictionariesInfo"]),
  359. visibleMethodList() {
  360. return (this.methodList || [])
  361. .filter(item => Number(item.status) === 1)
  362. .sort((a, b) => Number(a.sort) - Number(b.sort))
  363. },
  364. currentShMethod() {
  365. const list = this.visibleMethodList
  366. if (this.selectedMethodIndex >= 0 && this.selectedMethodIndex < list.length) {
  367. return list[this.selectedMethodIndex]
  368. }
  369. return null
  370. },
  371. showDeliveryPolicy() {
  372. const method = this.currentShMethod
  373. if (!method) return false
  374. let rules = method.reduceRules
  375. if (typeof rules === 'string') {
  376. try {
  377. rules = JSON.parse(rules)
  378. } catch (e) {
  379. rules = []
  380. }
  381. }
  382. return Array.isArray(rules) && rules.length > 0
  383. },
  384. showShMethodExtraFee() {
  385. const method = this.currentShMethod
  386. if (!method || !this.checkShMethodBelowMinimum(method)) {
  387. return false
  388. }
  389. const unMeet = Number(method.unMeet) || 0
  390. const fee = Number(method.unMeetFee) || 0
  391. return (unMeet === 0 || unMeet === 1) && fee > 0
  392. },
  393. /**
  394. * 未达配送方式最低消费时是否展示红色提示
  395. * unMeet:0 加运费、1 加包装费、2 不能下单
  396. */
  397. showShMethodUnMeetWarning() {
  398. const method = this.currentShMethod
  399. if (!method || !this.checkShMethodBelowMinimum(method)) {
  400. return false
  401. }
  402. const unMeet = Number(method.unMeet) || 0
  403. // 不能下单:直接提示
  404. if (unMeet === 2) {
  405. return true
  406. }
  407. // 加运费 / 加包装费:有费用时提示
  408. const fee = Number(method.unMeetFee) || 0
  409. return (unMeet === 0 || unMeet === 1) && fee > 0
  410. },
  411. shMethodExtraFeeLabel() {
  412. const method = this.currentShMethod
  413. if (!method) {
  414. return "包装费"
  415. }
  416. return Number(method.unMeet) === 1 ? "包装费" : "运费"
  417. },
  418. shMethodExtraFeeAmount() {
  419. if (!this.showShMethodExtraFee) {
  420. return 0
  421. }
  422. const method = this.currentShMethod
  423. return parseFloat(Number(method && method.unMeetFee) || 0)
  424. },
  425. /** 未达标红色文案:加运费/包装费金额,或不能下单 */
  426. shMethodUnMeetWarningText() {
  427. const method = this.currentShMethod
  428. if (!method) {
  429. return ""
  430. }
  431. const tips = []
  432. const minAmount = Number(method.minAmount) || 0
  433. const minNum = Number(method.minNum) || 0
  434. if (minAmount > 0) {
  435. tips.push("未满" + minAmount + "元")
  436. }
  437. if (minNum > 0) {
  438. tips.push("未满" + minNum + "扎")
  439. }
  440. const conditionText = tips.length > 0 ? tips.join("或") : "未达最低消费"
  441. const unMeet = Number(method.unMeet) || 0
  442. // unMeet=2:未满最低消费则禁止下单
  443. if (unMeet === 2) {
  444. return conditionText + ",不能下单"
  445. }
  446. // unMeet=0 加运费;unMeet=1 加包装费,并写出具体金额
  447. const fee = parseFloat(Number(method.unMeetFee) || 0)
  448. const feeLabel = unMeet === 1 ? "包装费" : "运费"
  449. return conditionText + ",加" + feeLabel + fee + "元"
  450. },
  451. currentMethodExplains() {
  452. const method = this.currentShMethod
  453. if (!method || !Array.isArray(method.explains)) {
  454. return []
  455. }
  456. return method.explains
  457. .filter(exp => exp && exp.explain)
  458. .sort((a, b) => Number(a.sort) - Number(b.sort))
  459. },
  460. runnerFeeAmount() {
  461. if (this.isFreePt) {
  462. return 0
  463. }
  464. return Number(this.form.sendCost) || 0
  465. },
  466. panelTotalPrice() {
  467. let price = Number(this.allPriceFun) || 0
  468. price += this.runnerFeeAmount
  469. price += this.shMethodExtraFeeAmount
  470. return parseFloat(price.toFixed(2))
  471. },
  472. /** 确认页列表每行价格展示(与 selectList 顺序一致) */
  473. affirmCommodityPriceParts() {
  474. const list = this.selectList || [];
  475. return list.map(item => this.getLimitBuyPriceDisplayParts(item));
  476. },
  477. displayAddress(){
  478. if(this.form.sendType != 1){
  479. return true
  480. }
  481. if(this.ghsInfo.pfLevel && this.ghsInfo.pfLevel == 1){
  482. return true
  483. }
  484. return false
  485. },
  486. //判断是否免跑腿费
  487. isFreePt(){
  488. const method = this.currentShMethod
  489. if (!method) return false
  490. let rules = method.reduceRules
  491. if (typeof rules === 'string') {
  492. try {
  493. rules = JSON.parse(rules)
  494. } catch (e) {
  495. rules = []
  496. }
  497. }
  498. if (!Array.isArray(rules) || rules.length === 0) {
  499. return false
  500. }
  501. const flowerCount = Number(this.allCountFun.bigLength) || 0
  502. const flowerPrice = Number(this.allPriceFun) || 0
  503. const distanceInMeters = Number(this.showDistance) || 0
  504. for (const rule of rules) {
  505. const meetNum = Number(rule.meetNum) || 0
  506. const meetAmount = Number(rule.meetAmount) || 0
  507. const freeKm = Number(rule.freeKm) || 0
  508. const freeKmInMeters = freeKm * 1000
  509. if (freeKmInMeters > 0 && flowerCount >= meetNum && flowerPrice >= meetAmount && distanceInMeters <= freeKmInMeters) {
  510. return true
  511. }
  512. }
  513. return false
  514. },
  515. /**
  516. * 计算总金额
  517. * @returns {number}
  518. */
  519. modifyPrice(){
  520. return this.panelTotalPrice
  521. }
  522. },
  523. methods: {
  524. //初始化配送业务面板:拉取配送配置
  525. loadShMethods(ghsId) {
  526. getShMethod({ ghsId: ghsId }).then(res => {
  527. if (res.code == 1) {
  528. this.methodList = res.data && res.data.method ? res.data.method : []
  529. if (this.visibleMethodList.length > 0) {
  530. this.selectMethodByIndex(0)
  531. } else {
  532. this.selectedMethodIndex = -1
  533. }
  534. }
  535. })
  536. },
  537. checkShMethodBelowMinimum(method) {
  538. if (!method) {
  539. return false
  540. }
  541. const minAmount = Number(method.minAmount) || 0
  542. const minNum = Number(method.minNum) || 0
  543. if (minAmount <= 0 && minNum <= 0) {
  544. return false
  545. }
  546. const allPrice = Number(this.allPriceFun) || 0
  547. const bigLength = Number(this.allCountFun.bigLength) || 0
  548. return (minAmount > 0 && allPrice < minAmount) || (minNum > 0 && bigLength < minNum)
  549. },
  550. /** 按列表下标切换配送方式,并同步 sendType 供下单与条件展示 */
  551. selectMethodByIndex(index) {
  552. const list = this.visibleMethodList
  553. if (!list[index]) {
  554. return
  555. }
  556. this.selectedMethodIndex = index
  557. const sendType = Number(list[index].style)
  558. this.form.sendType = sendType
  559. //计算跑腿费,二种方式,一个通过跑腿接口,一个通过自定义计费
  560. this.calcPtFee()
  561. this.syncPackCostByMethod()
  562. },
  563. modifyAddressToggle(){
  564. currentShop().then(res=>{
  565. if(res.code == 1){
  566. this.shopInfo = res.data
  567. if(!this.$util.isEmpty(this.shopInfo.lat) && !this.$util.isEmpty(this.shopInfo.long) && !this.$util.isEmpty(this.shopInfo.address)){
  568. this.validAddress = true
  569. //计算跑腿费,二种方式,一个通过跑腿接口,一个通过自定义计费
  570. this.calcPtFee()
  571. }
  572. }
  573. })
  574. },
  575. //计算跑腿费,二种方式,一个通过跑腿接口,一个通过自定义计费
  576. calcPtFee(){
  577. if(this.form.sendType == 2 && this.validAddress && this.currentShMethod){
  578. if(Number(this.currentShMethod.calcType) == 0){
  579. this.getDeliveryQuotes()
  580. }else{
  581. this.getCustomPtFee()
  582. }
  583. }else{
  584. this.deliveryQuotes = []
  585. this.selectedDeliveryIndex = -1
  586. this.selectedDeliveryData = null
  587. this.form.sendCost = 0
  588. this.showDistance = 0
  589. }
  590. },
  591. /** 获取自定义计费跑腿费用与距离 */
  592. getCustomPtFee(){
  593. this.deliveryQuotes = []
  594. this.selectedDeliveryIndex = -1
  595. this.selectedDeliveryData = null
  596. const ghsId = this.option.id || (this.ghsInfo && this.ghsInfo.id) || 0
  597. calcCustomPtFee({ id: ghsId, sendType: 2 }).then(res => {
  598. if (res.code == 1 && res.data) {
  599. this.form.sendCost = parseFloat(res.data.sendCost) || 0
  600. this.showDistance = Number(res.data.distance) || 0
  601. } else {
  602. this.form.sendCost = 0
  603. this.showDistance = 0
  604. if (res.msg) {
  605. uni.showToast({ title: res.msg, icon: 'none' })
  606. }
  607. }
  608. }).catch(() => {
  609. this.form.sendCost = 0
  610. this.showDistance = 0
  611. uni.showToast({ title: '获取自定义运费失败', icon: 'none' })
  612. })
  613. },
  614. // 展示包配送政策弹窗
  615. showDeliveryPolicyModal() {
  616. this.deliveryPolicyList = []
  617. const method = this.currentShMethod
  618. if (method) {
  619. let rules = method.reduceRules
  620. if (typeof rules === 'string') {
  621. try {
  622. rules = JSON.parse(rules)
  623. } catch (e) {
  624. rules = []
  625. }
  626. }
  627. if (Array.isArray(rules) && rules.length > 0) {
  628. rules.forEach(rule => {
  629. const meetNum = Number(rule.meetNum) || 0
  630. const meetAmount = Number(rule.meetAmount) || 0
  631. const freeKm = Number(rule.freeKm) || 0
  632. let text = ''
  633. if (meetNum > 0 && meetAmount > 0) {
  634. text = `满${meetNum}扎和${meetAmount}元,${freeKm}公里内免跑腿费`
  635. } else if (meetNum > 0) {
  636. text = `满${meetNum}扎,${freeKm}公里内免跑腿费`
  637. } else if (meetAmount > 0) {
  638. text = `满${meetAmount}元,${freeKm}公里内免跑腿费`
  639. } else if (freeKm > 0) {
  640. text = `${freeKm}公里内免跑腿费`
  641. }
  642. if (text) {
  643. this.deliveryPolicyList.push(text)
  644. }
  645. })
  646. }
  647. }
  648. if (this.deliveryPolicyList.length === 0) {
  649. uni.showToast({
  650. title: '暂无详细配送政策',
  651. icon: 'none'
  652. })
  653. return
  654. }
  655. this.$refs.deliveryPolicyPopup.open()
  656. },
  657. syncPackCostByMethod() {
  658. const method = this.currentShMethod
  659. if (method && this.checkShMethodBelowMinimum(method)) {
  660. const unMeet = Number(method.unMeet) || 0
  661. const fee = parseFloat(Number(method.unMeetFee) || 0)
  662. if ((unMeet === 0 || unMeet === 1) && fee > 0) {
  663. this.form.packCost = fee
  664. return
  665. }
  666. }
  667. this.form.packCost = 0
  668. },
  669. /** 聚焦物流输入框时清空,便于重新填写 */
  670. onWlNameFocus() {
  671. this.form.wlName = ""
  672. this.form.wlId = 0
  673. this.wlSelData = { id: 0, name: "" }
  674. },
  675. /** 手动输入物流名称时清除已选物流 id,避免与列表选项不一致 */
  676. onWlNameInput() {
  677. this.form.wlId = 0
  678. this.wlSelData = { id: 0, name: "" }
  679. },
  680. /** 打开物流选择弹框 */
  681. openWlSelect() {
  682. if (!this.wlList.length) {
  683. uni.showToast({ title: "暂无物流可选", icon: "none" })
  684. return
  685. }
  686. this.$refs.wlPopupRef.open("center")
  687. },
  688. /** 弹框内选中物流后回填到输入框 */
  689. selectWl(item) {
  690. this.wlSelData = item || { id: 0, name: "" }
  691. this.form.wlId = this.wlSelData.id
  692. this.form.wlName = this.wlSelData.name
  693. this.$refs.wlPopupRef.close()
  694. },
  695. /** 关闭物流选择弹框 */
  696. cancelWlSelect() {
  697. this.$refs.wlPopupRef.close()
  698. },
  699. ...mapActions(["initMerchantInfo"]),
  700. closeDeliveryPolicy() {
  701. this.$refs.deliveryPolicyPopup.close()
  702. },
  703. closeRemind(){
  704. this.$refs.selectFlowerNumRef.close()
  705. this.lackList = []
  706. },
  707. // 获取跑腿平台报价
  708. getDeliveryQuotes() {
  709. this.deliveryQuotes = []
  710. this.selectedDeliveryIndex = -1
  711. this.selectedDeliveryData = null
  712. allDeliveryQuotes({
  713. ghsId: this.option.id,
  714. totalPrice: this.allPriceFun,
  715. weight: this.allCountFun.weight,
  716. selectList: this.selectList,
  717. weight: 1, // 固定重量1kg,请后期根据实际需求修改。测试过后,所有平台都能在5kg的重量下,不会产生额外费用。
  718. remark: '',
  719. }).then(res => {
  720. if (res.code === 1 && res.data && res.data.deliveryList) {
  721. // 处理报价数据
  722. this.deliveryQuotes = res.data.deliveryList
  723. .filter(item => item.isAble !== false)
  724. .map(item => {
  725. // 价格从分转换为元
  726. const price = item.price ? (item.price / 100).toFixed(1) : '0.0'
  727. // 提取平台名称(去掉括号内的内容)
  728. let displayName = item.name
  729. let bracketContent = ''
  730. if (displayName && displayName.includes('(')) {
  731. bracketContent = displayName.split('(')[1].replace(')', '')
  732. displayName = displayName.split('(')[0].trim()
  733. }
  734. //滴滴特殊处理,括号里的内容作为类型
  735. if(item.en_name == 'didi' && bracketContent != ''){
  736. item.type = bracketContent
  737. }
  738. return {
  739. ...item,
  740. displayName: displayName,
  741. priceText: price,
  742. priceNumber: parseFloat(price),
  743. bracketContent: bracketContent
  744. }
  745. })
  746. // 自动选中第一个可用的报价
  747. const firstAvailableIndex = this.deliveryQuotes.findIndex(item => item.isAble)
  748. if (firstAvailableIndex !== -1) {
  749. this.selectDelivery(this.deliveryQuotes[firstAvailableIndex], firstAvailableIndex)
  750. }
  751. } else {
  752. uni.showToast({ title: '暂无跑腿可用', icon: 'none' })
  753. }
  754. }).catch(err => {
  755. uni.showToast({ title: '没有获取到跑腿费用', icon: 'none' })
  756. })
  757. },
  758. // 选择跑腿平台
  759. selectDelivery(item, index) {
  760. this.selectedDeliveryIndex = index
  761. this.selectedDeliveryData = item
  762. this.form.sendCost = item.priceNumber
  763. this.showDistance = item.distance || 0
  764. },
  765. modifyAddress(){
  766. this.$util.pageTo({ url: '/admin/shop/add?id='+this.getLoginInfo.admin.currentShopId})
  767. },
  768. customUpdate(item) {
  769. if(item.variety == 0){
  770. if(item.stock<=0){
  771. uni.showToast({title:'没有货了',icon:'none'})
  772. return
  773. }
  774. this.customNum({ ...item, bigCount: item.bigCount, smallCount: item.smallCount })
  775. }else{
  776. this.$msg('多颜色请返回列表修改')
  777. }
  778. },
  779. //自定义数量
  780. customNum(info) {
  781. this.isModel = true;
  782. this.customData = info;
  783. this.$nextTick(()=>{
  784. this.customData.smallCount = this.customData.smallCount==0?null:this.customData.smallCount;
  785. this.customData.bigCount = this.customData.bigCount==0?null:this.customData.bigCount;
  786. this.isFocus = true;
  787. if(Number(info.smallCount)>0){
  788. this.globalUnitType = 1
  789. }else{
  790. this.globalUnitType = 0
  791. }
  792. })
  793. },
  794. modalCancel() {
  795. this.isModel = false;
  796. this.customData = {};
  797. },
  798. affirm(val) {
  799. this.isFocus = false;
  800. this.isFocusOne = false;
  801. this.$nextTick(()=>{
  802. //取消
  803. if (val.index === 0) {
  804. if(this.customData.bigCount>0 || this.customData.smallCount>0){
  805. }else{
  806. this.delAllEvent(this.customData)
  807. }
  808. this.modalCancel();
  809. return false
  810. }
  811. //二个都不是数值
  812. if(/(^[1-9]\d*$)/.test(this.customData.bigCount) == false && /(^[1-9]\d*$)/.test(this.customData.smallCount) == false){
  813. this.delAllEvent(this.customData)
  814. this.modalCancel();
  815. return;
  816. }
  817. if(/(^[1-9]\d*$)/.test(this.customData.bigCount)){
  818. if(this.customData.bigCount<=0){
  819. uni.showToast({title:"数量要大于0",icon:"none"})
  820. return;
  821. }
  822. }
  823. if(/(^[1-9]\d*$)/.test(this.customData.smallCount)){
  824. if(this.customData.smallCount<=0){
  825. uni.showToast({title:"数量要大于0",icon:"none"})
  826. return;
  827. }
  828. }
  829. const { bigCount,smallCount,bigNum,bigUnit,smallNum,smallUnit,ratio} = this.customData;
  830. const ratioNum = Number(ratio);
  831. //超过库存时 设置为库存最大值 1
  832. if (Number(bigCount) * ratioNum + Number(smallCount) > Number(bigNum) * ratioNum + Number(smallNum)) {
  833. uni.showToast({
  834. title: '库存还剩'+bigNum,
  835. icon: "none"
  836. });
  837. } else {
  838. this.updateItemEvent(this.customData)
  839. this.modalCancel()
  840. }
  841. })
  842. },
  843. init() {
  844. let that = this
  845. this.getDetailData()
  846. getWlList({id:this.option.id}).then(res=>{
  847. if(res.code == 1){
  848. that.wlList = res.data.list ? res.data.list : []
  849. }
  850. })
  851. },
  852. addEvents(item) {
  853. if(item.variety == 0){
  854. const ratio = Number(item.ratio);
  855. if(this.offVerifyRepertory){
  856. if(item.stock<=0){
  857. uni.showToast({title:'没有货了',icon:'none'})
  858. return
  859. }
  860. if (Number(this.bigCount) * ratio + Number(this.smallCount) >Number(item.bigNum) * ratio + Number(item.smallNum)) {
  861. this.$msg("库存只剩"+item.bigNum);
  862. return
  863. }
  864. }
  865. this.addEvent(item)
  866. }else{
  867. this.$msg('多颜色请返回列表修改')
  868. }
  869. },
  870. delItem(item) {
  871. if(item.variety == 0){
  872. this.delEvent(item)
  873. }else{
  874. this.$msg('多颜色请返回列表修改')
  875. }
  876. },
  877. bindDateChange(e){
  878. let date = e.detail.value
  879. this.sendTimeWant = date
  880. },
  881. toPhone(phone){
  882. uni.makePhoneCall({
  883. phoneNumber: phone
  884. });
  885. },
  886. hasCoupon() {
  887. let amount = this.allPrice
  888. shopHouponHas({amount:amount,ghsId:this.option.id}).then(res => {
  889. this.hasHb = res.data.has
  890. }).catch(err => {})
  891. },
  892. getGhsData(id) {
  893. let that = this
  894. getGhsDataApi({id:id}).then(res => {
  895. that.ghsInfo = res.data
  896. that.transCost = that.ghsInfo.transCost ? that.ghsInfo.transCost : []
  897. if(that.ghsInfo.pfLevel && that.ghsInfo.pfLevel == 1){
  898. //昆明发货到全国
  899. let packCost = 0
  900. let weight = this.allCountFun.weight ? this.allCountFun.weight : 0
  901. if (that.ghsInfo.kmPackCost && !this.$util.isEmpty(that.ghsInfo.kmPackCost)){
  902. for (const ele of that.ghsInfo.kmPackCost) {
  903. let flagWeight = ele.num?ele.num:0
  904. if(Number(flagWeight)>=Number(weight)){
  905. that.form.packCost = ele.amount?parseFloat(Number(ele.amount)):0
  906. break
  907. }
  908. }
  909. }
  910. }else{
  911. //同城配送
  912. that.form.packCost = res.data.packCost?parseFloat(res.data.packCost):0
  913. }
  914. that.lackExpend = res.data.lackExpend?parseFloat(res.data.lackExpend):0
  915. that.form.wlName = res.data.customWlName ? res.data.customWlName : ''
  916. this.loadShMethods(id)
  917. that.ghsInfoLoaded = true
  918. })
  919. },
  920. countAllPrices(e){
  921. this.allPrices = this.allPrices+Number(this.form.sendCost)
  922. },
  923. getDetailData() {
  924. let data = uni.getStorageSync("modifyShopB")
  925. if (this.$util.isEmpty(data)){
  926. return
  927. }
  928. Object.keys(this.form).forEach((i, index) => {
  929. this.form[i] = data[i];
  930. });
  931. },
  932. confirmFn(options) {
  933. createOrder(options).then(res => {
  934. this.resetSelectInfoByType(this.pageType);
  935. this.resetLimitBuyInfoByType(this.pageType);
  936. const { data: { id, orderSn } } = res;
  937. let url = `/admin/billing/result?orderId=${id}&orderSn=${orderSn}`;
  938. uni.redirectTo({ url: url })
  939. });
  940. },
  941. affirmFormSubmit(direct){
  942. const product = this.selectList.map(ele => {
  943. return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount,classId:ele.classId,itemId:ele.itemId,weight:ele.weight,name:ele.name };
  944. })
  945. if(this.ghsInfo.pfLevel == 0){
  946. /** 提交前校验,失败时提示并返回 false */
  947. if (Number(this.form.sendType) === 3 && this.$util.isEmpty(this.form.wlName)) {
  948. this.$msg("请填选物流")
  949. return false
  950. }
  951. const method = this.currentShMethod
  952. if (method && Number(method.unMeet) === 2 && this.checkShMethodBelowMinimum(method)) {
  953. // 未满最低消费且不可下单时,提示具体需要的最低金额与数量
  954. const minAmount = Number(method.minAmount) || 0
  955. const minNum = Number(method.minNum) || 0
  956. const tips = []
  957. if (minAmount > 0) {
  958. tips.push(`满${minAmount}元`)
  959. }
  960. if (minNum > 0) {
  961. tips.push(`满${minNum}扎`)
  962. }
  963. const tipStr = tips.length > 0 ? `${tips.join("并且")}才能下单` : "未达到最低消费,不能下单"
  964. this.$msg(tipStr)
  965. return false
  966. }
  967. }
  968. //多颜色
  969. let xj = uni.getStorageSync("ghsColorItem"+this.ghsInfo.id)
  970. let getType = this.form.sendType == 2 ? 1 : 2
  971. //用于计划是否要包装费
  972. let itemTotalAmount = this.allPriceFun
  973. let params = {
  974. getType:getType,
  975. sendTimeWant:this.sendTimeWant,
  976. sendType:this.form.sendType,
  977. transType:this.form.transType,
  978. remark:this.remark,
  979. product:JSON.stringify(product),
  980. ghsId:this.ghsInfo.id,
  981. hbId: this.form.hbId,
  982. wlName:this.form.wlName,
  983. xj:JSON.stringify(xj),
  984. itemTotalAmount:itemTotalAmount,
  985. version:10,
  986. direct:direct
  987. }
  988. // 如果选择了跑腿配送并且有选中的平台数据,则添加配送平台信息
  989. if (this.form.sendType == 2 && this.selectedDeliveryData) {
  990. params.deliveryPlatform = this.selectedDeliveryData.en_name // 平台名称
  991. params.deliveryPrice = this.selectedDeliveryData.priceNumber // 报价金额
  992. params.deliveryDistance = this.showDistance // 配送距离
  993. params.deliveryBracketContent = this.selectedDeliveryData.bracketContent // 配送平台括号里的内容
  994. }
  995. let self = this;
  996. self.$util.confirmModal({content:'确认提交?'}, async () => {
  997. let pendingMsg = '';
  998. uni.showLoading({title: '加载中',mask:true})
  999. try {
  1000. // hideError:避免 luch-request 在 showLoading 期间 showToast 被挡住
  1001. const res = await createOrder(params, { hideError: true })
  1002. if (!res || typeof res !== 'object') {
  1003. pendingMsg = '提交失败,请重试'
  1004. return
  1005. }
  1006. if(res.code == 1){
  1007. this.limitExceedProductId = ''
  1008. this.limitExceedLimitBuy = ''
  1009. this.limitExceedNum = ''
  1010. if(res.data.hasLackError && res.data.hasLackError == 1){
  1011. this.lackList = res.data.lackList ? res.data.lackList : []
  1012. this.$refs.selectFlowerNumRef.open('center')
  1013. return
  1014. }
  1015. const {orderSn,realPrice,id} = res.data
  1016. self.pageTo({url: '/pagesPurchase/wechatPay',query:{orderSn,realPrice,id}, type: 2})
  1017. setTimeout(() => {
  1018. self.removeMemory(self.ghsInfo.id)
  1019. self.resetLimitBuyInfoByType(self.pageType)
  1020. }, 600)
  1021. return
  1022. }
  1023. if(res.code == -1 && res.data && String(res.data.productId || '') !== ''){
  1024. this.limitExceedProductId = res.data.productId ? String(res.data.productId) : ''
  1025. this.limitExceedLimitBuy = res.data.limitBuy ? String(res.data.limitBuy) : '0'
  1026. this.limitExceedNum = res.data.exceed ? String(res.data.exceed) : '0'
  1027. pendingMsg = res.msg || '累计已超出限购数'
  1028. return
  1029. }
  1030. this.limitExceedProductId = ''
  1031. this.limitExceedLimitBuy = ''
  1032. this.limitExceedNum = ''
  1033. if(res.msg){
  1034. pendingMsg = res.msg
  1035. }
  1036. } catch (err) {
  1037. pendingMsg = '提交失败,请重试'
  1038. } finally {
  1039. uni.hideLoading()
  1040. if (pendingMsg) {
  1041. // 小程序 hideLoading 后立即 showToast 可能不显示,需短暂延迟
  1042. setTimeout(() => {
  1043. self.$msg(pendingMsg)
  1044. }, 100)
  1045. }
  1046. }
  1047. })
  1048. },
  1049. isLimitExceededItem(item){
  1050. if(!item || !this.limitExceedProductId){
  1051. return false
  1052. }
  1053. return String(item.id) === String(this.limitExceedProductId)
  1054. },
  1055. numberAdd(arg1, arg2) {
  1056. var r1, r2, m, n;
  1057. try {
  1058. r1 = arg1.toString().split(".")[1].length
  1059. } catch (e) {
  1060. r1 = 0
  1061. }
  1062. try {
  1063. r2 = arg2.toString().split(".")[1].length
  1064. } catch (e) {
  1065. r2 = 0
  1066. }
  1067. m = Math.pow(10, Math.max(r1, r2))
  1068. n = (r1 >= r2) ? r1 : r2;
  1069. return ((arg1 * m + arg2 * m) / m).toFixed(n);
  1070. },
  1071. NumberSub(arg1, arg2) {
  1072. var re1, re2, m, n;
  1073. try {
  1074. re1 = arg1.toString().split(".")[1].length;
  1075. } catch (e) {
  1076. re1 = 0;
  1077. }
  1078. try {
  1079. re2 = arg2.toString().split(".")[1].length;
  1080. } catch (e) {
  1081. re2 = 0;
  1082. }
  1083. m = Math.pow(10, Math.max(re1, re2));
  1084. n = (re1 >= re2) ? re1 : re2;
  1085. return ((arg1 * m - arg2 * m) / m).toFixed(n);
  1086. },
  1087. // 表单验证
  1088. async formSubmit(e) {
  1089. try {
  1090. // 进行表单检查
  1091. let formData = this.form;
  1092. const product = this.selectList.map(ele => {
  1093. return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount };
  1094. });
  1095. formData.product = JSON.stringify(product);
  1096. if (!this.getMerchantInfo) {
  1097. await this.initMerchantInfo();
  1098. }
  1099. formData.shopId = this.getMerchantInfo.id;
  1100. let checkRes = formUtil.validation(formData, []);
  1101. // 验证通过!
  1102. if (!checkRes) {
  1103. this.confirmFn(formData);
  1104. } else {
  1105. this.$msg(checkRes);
  1106. }
  1107. } catch (error) {
  1108. console.log(999999, error);
  1109. }
  1110. },
  1111. gobackEvent() {
  1112. this.$util.pageTo({url: "/pagesPurchase/ghsProduct?id="+this.options.id,type: 2})
  1113. }
  1114. }
  1115. };
  1116. </script>
  1117. <style lang="scss" scoped>
  1118. .admin-button-com {
  1119. margin-right: 15upx;
  1120. }
  1121. .affirm-page {
  1122. position: relative;
  1123. height: 100%;
  1124. display: flex;
  1125. flex-direction: column;
  1126. /* #ifdef APP-PLUS */
  1127. padding-bottom: 100upx;
  1128. /* #endif */
  1129. .affirm-view {
  1130. flex: 1;
  1131. padding: 20upx 20upx 100upx 20upx;
  1132. background-color: #f0f2f6;
  1133. .commodity-view {
  1134. display: flex;
  1135. flex-direction: column;
  1136. .commodity-list {
  1137. padding: 20upx;
  1138. .commodity-item {
  1139. display: flex;
  1140. margin-bottom: 20upx;
  1141. &.limit-exceed-item {
  1142. border: 2upx solid #ff4d4f;
  1143. border-radius: 12upx;
  1144. padding: 12upx;
  1145. box-sizing: border-box;
  1146. }
  1147. .item-icon {
  1148. flex-shrink: 0;
  1149. width: 140upx;
  1150. height: 140upx;
  1151. border-radius: 4upx;
  1152. background-color: #f5f5f5;
  1153. }
  1154. .item-info {
  1155. display: flex;
  1156. flex-direction: column;
  1157. justify-content: flex-start;
  1158. flex: 1;
  1159. margin-left: 20upx;
  1160. min-width: 0;
  1161. .item-row-top {
  1162. display: flex;
  1163. flex-direction: row;
  1164. align-items: center;
  1165. justify-content: space-between;
  1166. width: 100%;
  1167. }
  1168. .item-name {
  1169. flex: 1;
  1170. min-width: 0;
  1171. padding-right: 16upx;
  1172. color: #333333;
  1173. font-size: 30upx;
  1174. font-weight: bold;
  1175. overflow: hidden;
  1176. white-space: nowrap;
  1177. text-overflow: ellipsis;
  1178. line-height: 1.3;
  1179. }
  1180. .item-price-block {
  1181. flex-shrink: 0;
  1182. display: flex;
  1183. flex-direction: row;
  1184. align-items: baseline;
  1185. max-width: 48%;
  1186. }
  1187. .item-price-line {
  1188. display: flex;
  1189. flex-direction: row;
  1190. align-items: baseline;
  1191. }
  1192. .price-current {
  1193. font-size: 32upx;
  1194. font-weight: bold;
  1195. color: #333333;
  1196. white-space: nowrap;
  1197. line-height: 1.2;
  1198. }
  1199. .price-original {
  1200. margin-left: 12upx;
  1201. margin-top: 0;
  1202. font-size: 29upx;
  1203. color: #999999;
  1204. text-decoration: line-through;
  1205. white-space: nowrap;
  1206. line-height: 1.2;
  1207. }
  1208. .item-row-qty {
  1209. display: flex;
  1210. flex-direction: row;
  1211. justify-content: flex-end;
  1212. align-items: center;
  1213. margin-top: 10upx;
  1214. flex-wrap: wrap;
  1215. }
  1216. .qty-sep {
  1217. margin: 0 8upx;
  1218. color: #cccccc;
  1219. font-size: 28upx;
  1220. }
  1221. .qty-part {
  1222. font-size: 28upx;
  1223. color: #666666;
  1224. }
  1225. .qty-big {
  1226. font-size: 30upx;
  1227. font-weight: bold;
  1228. color: #3385ff;
  1229. }
  1230. .item-row-tips {
  1231. display: flex;
  1232. flex-direction: column;
  1233. margin-top: 10upx;
  1234. }
  1235. .limit-exceed-tip {
  1236. margin-top: 4upx;
  1237. color: #ff4d4f;
  1238. font-size: 24upx;
  1239. font-weight: bold;
  1240. line-height: 1.45;
  1241. }
  1242. .limit-buy-price-tip {
  1243. margin-top: 4upx;
  1244. color: #ff7a00;
  1245. font-size: 24upx;
  1246. font-weight: bold;
  1247. line-height: 1.45;
  1248. }
  1249. .presell-tip {
  1250. margin-top: 4upx;
  1251. color: #e53935;
  1252. font-size: 26upx;
  1253. font-weight: bold;
  1254. line-height: 1.45;
  1255. }
  1256. }
  1257. }
  1258. }
  1259. .summary-bar {
  1260. padding: 0 20upx;
  1261. height: 90upx;
  1262. display: flex;
  1263. align-items: center;
  1264. justify-content: space-between;
  1265. border-top: 1px solid #eeeeee;
  1266. .operate-view {
  1267. display: flex;
  1268. align-items: center;
  1269. color: #3385ff;
  1270. font-size: 30upx;
  1271. font-weight:bold;
  1272. .iconfont {
  1273. margin-right: 20upx;
  1274. font-size: 40upx;
  1275. }
  1276. }
  1277. .describe-view {
  1278. display: flex;
  1279. align-items: center;
  1280. color: #333;
  1281. font-size: 24upx;
  1282. .price {
  1283. font-weight: bold;
  1284. font-size: 30upx;
  1285. }
  1286. }
  1287. }
  1288. }
  1289. .module-com {
  1290. background-color: #fff;
  1291. margin-bottom: 20upx;
  1292. border-radius: 10upx;
  1293. overflow: hidden;
  1294. padding-top: 20upx;
  1295. .ghs-msg{
  1296. padding: 0 20upx 20upx;
  1297. font-size: 32upx;
  1298. &.active{
  1299. color: #868686;
  1300. font-size: 24upx;
  1301. }
  1302. i{color: #62ed73;font-size: 48upx}
  1303. }
  1304. .member-wrap {
  1305. .member-det {
  1306. font-size: 24upx;
  1307. margin-left: 20upx;
  1308. }
  1309. }
  1310. .remark-wrap {
  1311. align-items: flex-start;
  1312. .remark {
  1313. height: 240upx;
  1314. }
  1315. }
  1316. }
  1317. }
  1318. .under-bar {
  1319. display: flex;
  1320. justify-content: space-between;
  1321. align-items: center;
  1322. padding: 0 20upx;
  1323. width: 100%;
  1324. height: 100upx;
  1325. background-color: #fff;
  1326. box-shadow: 0upx -1px 6upx 0upx rgba(4, 0, 0, 0.06);
  1327. /* #ifdef APP-PLUS */
  1328. position: fixed;
  1329. bottom: 0;
  1330. left: 0;
  1331. right: 0;
  1332. z-index: 999;
  1333. /* #endif */
  1334. /* #ifdef MP-WEIXIN */
  1335. position: fixed;
  1336. bottom: 0;
  1337. left: 0;
  1338. right: 0;
  1339. z-index: 999;
  1340. /* #endif */
  1341. .price-view {
  1342. display: flex;
  1343. align-items: center;
  1344. font-size: 24upx;
  1345. .price-title {
  1346. color: #333;
  1347. }
  1348. .price-number {
  1349. margin: 0 20upx;
  1350. color: #ff2842;
  1351. .large {
  1352. font-size: 40upx;
  1353. }
  1354. }
  1355. .price-discount-tip {
  1356. font-size: 28upx;
  1357. color: #ff7a00;
  1358. font-weight: bold;
  1359. white-space: nowrap;
  1360. }
  1361. }
  1362. .admin-button-com {
  1363. width: 200upx;
  1364. }
  1365. }
  1366. .coupon_box{
  1367. flex: 1;
  1368. text-align: right;
  1369. padding-right: 45upx;
  1370. .has-hb{
  1371. background:red;
  1372. color:white;
  1373. border:1upx solid red;
  1374. border-radius: 30upx;
  1375. font-size:20upx;
  1376. padding:5upx 15upx 5upx 15upx;
  1377. }
  1378. .selected{
  1379. color:red;
  1380. float:left;
  1381. }
  1382. }
  1383. .select-cmd_bx {
  1384. & .kc {
  1385. color: #999999;
  1386. font-size: 28upx;
  1387. font-weight: 400;
  1388. margin-bottom: 60upx;
  1389. text-align: center;
  1390. margin-top: 10upx;
  1391. }
  1392. & .num_bx {
  1393. display: flex;
  1394. align-items: center;
  1395. justify-content:center;
  1396. margin-bottom: 80upx;
  1397. & > input {
  1398. width: 280upx;
  1399. height: 80upx;
  1400. border: 1px solid #dddddd;
  1401. border-radius: 4upx;
  1402. text-align: center;
  1403. font-size: 40upx;
  1404. }
  1405. }
  1406. }
  1407. }
  1408. /* 跑腿平台报价样式 */
  1409. .delivery-quotes-container {
  1410. width: 100%;
  1411. margin-top: 20upx;
  1412. }
  1413. .delivery-quotes-grid {
  1414. display: flex;
  1415. flex-wrap: wrap;
  1416. gap: 10upx;
  1417. padding: 0;
  1418. width: 100%;
  1419. }
  1420. .delivery-quote-item {
  1421. display: flex;
  1422. flex-direction: column;
  1423. align-items: center;
  1424. justify-content: center;
  1425. flex: 0 0 calc(33% - 7upx);
  1426. width: calc(33% - 7upx);
  1427. min-height: 140upx;
  1428. padding: 16upx 10upx;
  1429. margin-bottom: 5upx;
  1430. background: #FFFFFF;
  1431. border: 2upx solid #DDDDDD;
  1432. border-radius: 8upx;
  1433. box-sizing: border-box;
  1434. transition: all 0.3s;
  1435. // 当只有1-2项时使用固定宽度
  1436. &.fixed-width {
  1437. flex: 0 0 220rpx;
  1438. width: 220rpx;
  1439. }
  1440. .platform-name {
  1441. font-size: 26upx;
  1442. color: #333;
  1443. font-weight: bold;
  1444. margin-bottom: 8upx;
  1445. text-align: center;
  1446. line-height: 1.3;
  1447. max-width: 100%;
  1448. overflow: hidden;
  1449. text-overflow: ellipsis;
  1450. display: -webkit-box;
  1451. -webkit-line-clamp: 2;
  1452. line-clamp: 2;
  1453. -webkit-box-orient: vertical;
  1454. word-break: break-all;
  1455. }
  1456. .platform-price {
  1457. font-size: 30upx;
  1458. color: #333;
  1459. font-weight: bold;
  1460. margin-bottom: 4upx;
  1461. }
  1462. .platform-type {
  1463. font-size: 20upx;
  1464. color: #868686;
  1465. margin-top: 4upx;
  1466. text-align: center;
  1467. line-height: 1.3;
  1468. max-width: 100%;
  1469. overflow: hidden;
  1470. text-overflow: ellipsis;
  1471. display: -webkit-box;
  1472. -webkit-line-clamp: 2;
  1473. line-clamp: 2;
  1474. -webkit-box-orient: vertical;
  1475. word-break: break-all;
  1476. }
  1477. // 选中状态
  1478. &.active {
  1479. background: #09C567;
  1480. border-color: #09C567;
  1481. .platform-name,
  1482. .platform-price {
  1483. color: #FFFFFF;
  1484. }
  1485. .platform-type {
  1486. color: rgba(255, 255, 255, 0.85);
  1487. }
  1488. }
  1489. // 不可用状态
  1490. &.disabled {
  1491. opacity: 0.5;
  1492. background: #F5F5F5;
  1493. .platform-name,
  1494. .platform-price,
  1495. .platform-type {
  1496. color: #CCCCCC;
  1497. }
  1498. }
  1499. }
  1500. /* 跑腿费价格样式 */
  1501. .delivery-price-normal {
  1502. color: #3385FF;
  1503. }
  1504. .delivery-price-free {
  1505. color: #999;
  1506. text-decoration: line-through;
  1507. }
  1508. .free-delivery-tag {
  1509. color: #3385FF;
  1510. margin-left: 20upx;
  1511. }
  1512. .delivery-policy-link {
  1513. color: rgb(201, 52, 52);
  1514. font-size: 30upx;
  1515. margin-left: 20upx;
  1516. font-weight: bold;
  1517. text-decoration: underline;
  1518. }
  1519. .policy-icon {
  1520. font-size: 28upx;
  1521. margin-left: 4upx;
  1522. }
  1523. .policy-popup-content {
  1524. width: 600upx;
  1525. background-color: #fff;
  1526. border-radius: 20upx;
  1527. padding: 30upx;
  1528. display: flex;
  1529. flex-direction: column;
  1530. align-items: center;
  1531. }
  1532. .policy-title {
  1533. font-size: 34upx;
  1534. font-weight: bold;
  1535. color: #333;
  1536. margin-bottom: 30upx;
  1537. }
  1538. .policy-scroll {
  1539. width: 100%;
  1540. max-height: 50vh;
  1541. margin-bottom: 30upx;
  1542. }
  1543. .policy-list {
  1544. width: 100%;
  1545. }
  1546. .policy-item {
  1547. font-size: 30upx;
  1548. color: #666;
  1549. margin-bottom: 20upx;
  1550. text-align: left;
  1551. line-height: 1.5;
  1552. display: list-item;
  1553. list-style-type: disc;
  1554. margin-left: 40upx;
  1555. }
  1556. .policy-btn {
  1557. width: 50%;
  1558. height: 80upx;
  1559. line-height: 80upx;
  1560. text-align: center;
  1561. background-color: #3385ff;
  1562. color: #fff;
  1563. font-size: 32upx;
  1564. border-radius: 40upx;
  1565. }
  1566. /* 配送业务面板样式 */
  1567. .wl-field-row {
  1568. display: flex;
  1569. flex-direction: row;
  1570. align-items: center;
  1571. flex: 1;
  1572. justify-content: flex-end;
  1573. min-width: 0;
  1574. }
  1575. .wl-name-input {
  1576. flex: 1;
  1577. min-width: 0;
  1578. text-align: left;
  1579. }
  1580. .wl-select-btn {
  1581. margin-left: 16upx;
  1582. flex-shrink: 0;
  1583. }
  1584. .wl-popup-content {
  1585. width: 680upx;
  1586. max-width: 90vw;
  1587. background: #fff;
  1588. border-radius: 20upx;
  1589. overflow: hidden;
  1590. }
  1591. .wl-popup-title {
  1592. padding: 30upx 30upx 10upx;
  1593. font-size: 30upx;
  1594. font-weight: bold;
  1595. color: #333;
  1596. }
  1597. .wl-popup-scroll {
  1598. max-height: 60vh;
  1599. }
  1600. .wl-popup-list {
  1601. display: flex;
  1602. flex-direction: row;
  1603. flex-wrap: wrap;
  1604. padding: 20upx 20upx 10upx;
  1605. }
  1606. .wl-popup-item {
  1607. margin-bottom: 20upx;
  1608. margin-right: 12upx;
  1609. }
  1610. .wl-option-btn {
  1611. min-width: 160upx;
  1612. padding: 0 27upx;
  1613. height: 80upx;
  1614. font-size: 32upx;
  1615. font-weight: bold;
  1616. border-radius: 16upx;
  1617. background: #f0f2f6;
  1618. color: #333;
  1619. border: 2upx solid #e0e0e0;
  1620. display: flex;
  1621. align-items: center;
  1622. justify-content: center;
  1623. }
  1624. .wl-option-btn.selected,
  1625. .wl-option-btn:active {
  1626. background: #3385ff;
  1627. color: #fff;
  1628. border-color: #3385ff;
  1629. }
  1630. .wl-popup-footer {
  1631. padding: 10upx 0 30upx;
  1632. text-align: center;
  1633. }
  1634. .wl-popup-cancel-btn {
  1635. width: 210upx;
  1636. }
  1637. .sh-method-btn {
  1638. width: 115upx;
  1639. height: 100upx;
  1640. margin-right: 15upx;
  1641. }
  1642. .sh-method-btn:last-child {
  1643. margin-right: 0;
  1644. }
  1645. .sh-method-btn--short {
  1646. line-height: 60upx;
  1647. }
  1648. .sh-method-btn--long {
  1649. line-height: 32upx;
  1650. }
  1651. .wl-popup-wrap {
  1652. z-index: 99999;
  1653. }
  1654. </style>