jufubao-base 1.0.162-beta6 → 1.0.162-beta7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jufubao-base",
3
- "version": "1.0.162-beta6",
3
+ "version": "1.0.162-beta7",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -63,7 +63,7 @@
63
63
 
64
64
  <script>
65
65
  import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
66
- import { jfbRootExec } from "@/utils/xd.event";
66
+ import { jfbRootExec, jfbRootFnExec } from "@/utils/xd.event";
67
67
  import JfbBaseCardSweepInfoMixin from "./JfbBaseCardSweepInfoMixin";
68
68
  import XdButton from "@/components/XdButton/XdButton";
69
69
  import XdUnit from "@/components/XdUnit/XdUnit";
@@ -109,6 +109,7 @@ export default {
109
109
 
110
110
  inCallbackUrlOrg:'',//是否带有回调地址
111
111
  is_show_balance: "N", //是否显示余额
112
+ hasCon: "", //是否有优惠券
112
113
  };
113
114
  },
114
115
  watch: {
@@ -141,6 +142,11 @@ export default {
141
142
 
142
143
  },
143
144
  methods: {
145
+ toShowCouponDialog(){
146
+ if(this.info){
147
+ jfbRootFnExec(this, 'onCustomEvent')("@showBaseConDialog", {user_card_number: this.info.card_number})
148
+ }
149
+ },
144
150
  handleToLink(path) {
145
151
  if (this.pa) {
146
152
  jfbRootExec("qrCardBind", {
@@ -150,30 +156,56 @@ export default {
150
156
  },
151
157
  })
152
158
  .then((res) => {
153
- this.$xdAlert({
154
- content: "绑定成功",
155
- close: () => {
156
- //#ifdef H5
157
- let base = this.jfbAuthorize.getBasePath(this);
158
- let url = `${location.origin}${base}${this.backUrl}`;
159
- url = this.getUrlCallback(url)
160
- this.$xdLog.setARMSInfo({url}, 'static_qr_card_bind');
159
+ //有优惠券处理
160
+ if(this.hasCon){
161
+ this.toShowCouponDialog();
162
+ this.$bus.$on("onCloseConDialog",(container_id) => {
163
+ if(container_id === this.hasCon){
164
+ //#ifdef H5
165
+ let base = this.jfbAuthorize.getBasePath(this);
166
+ let url = `${location.origin}${base}${this.backUrl}`;
167
+ url = this.getUrlCallback(url)
168
+ this.$xdLog.setARMSInfo({url}, 'static_qr_card_bind');
161
169
 
162
- setTimeout(()=>{
163
- window.location.href = url;
164
- },50);
165
- // #endif
170
+ setTimeout(()=>{
171
+ window.location.href = url;
172
+ },50);
173
+ // #endif
166
174
 
167
- //#ifndef H5
168
- let wPath = this.getUrlCallback(this.backUrl)
169
- this.$xdUniHelper.redirectTo({
170
- url:wPath,
171
- });
172
- // #endif
175
+ //#ifndef H5
176
+ let wPath = this.getUrlCallback(this.backUrl)
177
+ this.$xdUniHelper.redirectTo({
178
+ url:wPath,
179
+ });
180
+ // #endif
181
+ }
182
+ })
183
+ } else {
184
+ this.$xdAlert({
185
+ content: "绑定成功",
186
+ close: () => {
187
+ //#ifdef H5
188
+ let base = this.jfbAuthorize.getBasePath(this);
189
+ let url = `${location.origin}${base}${this.backUrl}`;
190
+ url = this.getUrlCallback(url)
191
+ this.$xdLog.setARMSInfo({url}, 'static_qr_card_bind');
173
192
 
193
+ setTimeout(()=>{
194
+ window.location.href = url;
195
+ },50);
196
+ // #endif
174
197
 
175
- },
176
- });
198
+ //#ifndef H5
199
+ let wPath = this.getUrlCallback(this.backUrl)
200
+ this.$xdUniHelper.redirectTo({
201
+ url:wPath,
202
+ });
203
+ // #endif
204
+
205
+
206
+ },
207
+ });
208
+ }
177
209
  })
178
210
  .catch();
179
211
  }
@@ -232,6 +264,12 @@ export default {
232
264
  onJfbShow(options) {
233
265
  this.onJfbLoad(options);
234
266
  },
267
+ onJfbCustomEvent({action, data}){
268
+ if(action === 'baseConDialog@hasCon'){
269
+ this.hasCon = data;
270
+ }
271
+ console.log('onJfbCustomEvent',action, data);
272
+ }
235
273
  },
236
274
  };
237
275
  </script>
@@ -69,11 +69,23 @@
69
69
  :color="item.iconColor"
70
70
  :icon="item.icon"
71
71
  ></xd-font-icon>
72
- <view class="btn">
72
+ <view class="btn" v-if="item.can_take_num!=='Y'">
73
73
  <xd-button
74
+ v-if="item.remain_card_count == 0"
75
+ size="small"
76
+ type="primary"
77
+ :disabled="true"
78
+ :style="{
79
+ backgroundImage: item.btnImage,
80
+ backgroundSize: '100% 100%',
81
+ }"
82
+ @click="getCoupont(item)"
83
+ >{{ item.btn_txt }}</xd-button
84
+ >
85
+ <xd-button
86
+ v-else
74
87
  size="small"
75
88
  type="primary"
76
- :disabled="item.remain_card_count == 0"
77
89
  :style="{
78
90
  backgroundImage: item.btnImage,
79
91
  backgroundSize: '100% 100%',
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @description API模型
5
+ * 建议:Ffff=>模块 Xxxx=>自定义名字
6
+ * 获取单记录(getByIdFfffXxxx)
7
+ * 获取列表记录(getByListFfffXxxx)
8
+ * 添加列表记录(addFfffXxxxx)
9
+ * 删除列表记录(removeFfffXxxxx|deleteFfffXxxx)
10
+ * 更新列表记录(updateFfffXxxxx)
11
+ * @type {*[]}
12
+ */
13
+ module.exports = [];
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ export default {
4
+ style: [],
5
+ advanced: [],
6
+ content: (data) => {
7
+ return [
8
+ {
9
+ label: '门店核销首页:',
10
+ ele: 'xd-select-pages-path',
11
+ valueKey: 'change_url',
12
+ groupKey:'advanced',
13
+ placeholder: '请选择门店核销首页跳转路径',
14
+ value: data.change_url || null,
15
+ setting: {
16
+ router: XdBus.getParentApi('getPagesTree'),
17
+ },
18
+ inline: false,
19
+ },
20
+ {
21
+ label: '卡绑定:',
22
+ ele: 'xd-select-pages-path',
23
+ valueKey: 'bind_url',
24
+ groupKey:'advanced',
25
+ placeholder: '请选择卡绑定跳转路径',
26
+ value: data.bind_url || null,
27
+ setting: {
28
+ router: XdBus.getParentApi('getPagesTree'),
29
+ },
30
+ inline: false,
31
+ },
32
+ ].filter(i => i)
33
+ },
34
+ };
@@ -0,0 +1,317 @@
1
+ <template>
2
+ <view
3
+ class="jfb-base-sweep"
4
+ @click="handleEditxSelect"
5
+ :class="{ editx: isEditx && active }"
6
+ >
7
+ <!--#ifdef H5-->
8
+ <view
9
+ class="jfb-base-sweep__edit"
10
+ :class="{ editx: isEditx && active }"
11
+ v-if="isEditx && active"
12
+ >
13
+ <view class="jfb-base-sweep__edit-icon" @click="delEdit">删除</view>
14
+ </view>
15
+ <!-- #endif -->
16
+ <view
17
+ :style="{ height: layoutInfo.bodyMinHeightRpx + 'rpx' }"
18
+ class="jfb-base-sweep__body"
19
+ >
20
+ <view
21
+ :style="{ background: backgroundColor, color: warningColor }"
22
+ class="jfb-base-sweep__body-pop"
23
+ v-if="isPreview"
24
+ >设置背景模式方便编辑(占位),在线上此模块不显</view
25
+ >
26
+ <view class="jfb-base-sweep__body-other" v-if="other">
27
+ <view>
28
+ <xd-font-icon
29
+ color="red"
30
+ size="240"
31
+ icon="iconmingchengtubiao"
32
+ ></xd-font-icon>
33
+ <view class="jfb-base-sweep__body-other-text">无法识别该界面</view>
34
+ </view>
35
+ <view class="jfb-base-sweep__body-footer" :style="prod_bottom">
36
+ <XdButton @click="scan" type="primary" radius="20" width="40%"
37
+ >重试</XdButton
38
+ >
39
+ </view>
40
+ </view>
41
+ </view>
42
+ </view>
43
+ </template>
44
+
45
+ <script>
46
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
47
+ import XdButton from "@/components/XdButton/XdButton";
48
+ import { jfbRootExec } from "@/utils/xd.event";
49
+ import JfbBaseSweepMixin from "./JfbBaseSweepMixin";
50
+ import { getContainerPropsValue } from "@/utils/xd.base";
51
+ import componentsMixins from "@/mixins/componentsMixins";
52
+ import extsMixins from "@/mixins/extsMixins";
53
+ import { mapState } from "vuex";
54
+ import { parseNetworkURL } from "@/utils/linkUrl";
55
+ const Color = require("color");
56
+
57
+ export default {
58
+ name: "JfbBaseSweep",
59
+ components: {
60
+ XdFontIcon,
61
+ XdButton,
62
+ },
63
+ mixins: [componentsMixins, extsMixins, JfbBaseSweepMixin],
64
+ data() {
65
+ return {
66
+ isPreview: false,
67
+ backgroundColor: "",
68
+ other: false,
69
+ };
70
+ },
71
+ computed: {
72
+ ...mapState({
73
+ jwxSDK: (state) => state.jwxSDK,
74
+ }),
75
+ prod_bottom() {
76
+ return this.fixedStyle({ height: 0, zIndex: 111 });
77
+ },
78
+ },
79
+ watch: {
80
+ container(value) {
81
+ this.init(value);
82
+ },
83
+ jwxSDK(value) {
84
+ //#ifdef H5
85
+ if (value) {
86
+ this.$xdHideLoading();
87
+ this.scan();
88
+ }
89
+ //#endif
90
+ },
91
+ },
92
+ created() {
93
+ console.log(this.layoutInfo, "layoutInfo");
94
+ this.backgroundColor = Color(this.warningColor).alpha(0.2).toString();
95
+ this.isPreview = this.$configProject["isPreview"];
96
+ this.init(this.container);
97
+
98
+ //todo
99
+ },
100
+ methods: {
101
+ onJfbLoad(options) {
102
+ if (!this.isPreview) {
103
+ this.$xdShowLoading({});
104
+ //#ifdef MP-WEIXIN
105
+ this.$xdHideLoading();
106
+ this.scan();
107
+ //#endif
108
+ }
109
+ },
110
+ extractDomain(hostname) {
111
+ // 匹配并提取顶级域名后的两个标签(例如:.com、.co.uk)
112
+ const matches = hostname.match(/[^.]+\.[^.]+$/);
113
+ return matches ? matches[0] : hostname;
114
+ },
115
+ handleH5() {
116
+ // 判断jwxSDK是否为空
117
+ if (this.jwxSDK !== null) {
118
+ // 调用jwxSDK的scanQRCode方法,扫描二维码
119
+ this.jwxSDK.scanQRCode({
120
+ // 需要返回结果
121
+ needResult: 1,
122
+ // 扫描类型为二维码
123
+ scanType: ["qrCode"],
124
+ // 扫描成功后的回调函数
125
+ success: (res) => {
126
+ // 定义一个变量params,将url按照"?"进行分割,获取到参数部分
127
+ let params = res.resultStr.split("?")[1]
128
+ ? res.resultStr.split("?")[1]
129
+ : "";
130
+ // 将参数部分按照"&"进行分割,获取到每个参数
131
+ const queryArr = params.split("&");
132
+ // 定义一个空对象queryobjArr,用于存储参数
133
+ let queryobjArr = {};
134
+ // 遍历参数数组,将参数名和参数值存储到queryobjArr中
135
+ queryArr.forEach((item, index) => {
136
+ const Strindex = item.indexOf("=");
137
+ queryobjArr[item.slice(0, Strindex)] = item.slice(Strindex + 1);
138
+ });
139
+ // 判断queryobjArr中是否存在"x-params"参数
140
+ if (queryobjArr["x-params"]) {
141
+ // 如果存在,则将参数拼接到url中,并跳转到该url
142
+ let path = `${this.change_url}?x-params=${queryobjArr["x-params"]}&refrom=official`;
143
+ this.$xdUniHelper.navigateTo({
144
+ url: path,
145
+ });
146
+ return;
147
+ }
148
+ if (queryobjArr["pa"]) {
149
+ // 如果queryobjArr中有pa属性,则获取pa属性的值,并将其拼接到bind_url后面,然后使用navigateTo方法跳转到该路径
150
+ let path = `${this.bind_url}?pa=${queryobjArr["pa"]}`;
151
+ this.$xdUniHelper.navigateTo({
152
+ url: path,
153
+ });
154
+ return;
155
+ }
156
+ // 如果res.resultStr是以http或https开头的字符串,则进行以下操作
157
+ if (/^https?:/.test(res.resultStr)) {
158
+ // 获取res.resultStr中的host属性
159
+ let host = this.$xdUniHelper.parseURL(res.resultStr).host;
160
+ // 获取当前页面的域名
161
+ let domain = document.domain;
162
+ // 如果host属性以当前页面的域名结尾,则进行以下操作
163
+ if (host.substr(-domain.length) === domain) {
164
+ // 获取res.resultStr的值
165
+ let path = res.resultStr;
166
+ // 使用navigateTo方法跳转到该路径
167
+ this.$xdUniHelper.navigateTo({
168
+ url: path,
169
+ });
170
+ return;
171
+ }
172
+ }
173
+ this.other = true;
174
+ },
175
+ // 扫描失败后的回调函数
176
+ fail: (error) => {
177
+ // 如果error是字符串类型,则将其转换为对象类型
178
+ if (typeof error === "string") error = { error: error };
179
+ // 如果window["jwxJfbSDKParams"]存在,则将error对象与window["jwxJfbSDKParams"]合并
180
+ if (window["jwxJfbSDKParams"])
181
+ error = Object.assign(error, window["jwxJfbSDKParams"]);
182
+ // 调用$xdLog的setARMSError方法,记录错误信息
183
+ this.$xdLog.setARMSError(error);
184
+ },
185
+ });
186
+ }
187
+ },
188
+ handleMP() {
189
+ // 调用uni.scanCode方法,扫描二维码
190
+ uni.scanCode({
191
+ scanType: ["qrCode"],
192
+ success: (res) => {
193
+ // 定义一个变量params,将url按照"?"进行分割,获取到参数部分
194
+ let params = res.result.split("?")[1] ? res.result.split("?")[1] : "";
195
+ // 将参数部分按照"&"进行分割,获取到每个参数
196
+ const queryArr = params.split("&");
197
+ // 定义一个空对象queryobjArr,用于存储参数
198
+ let queryobjArr = {};
199
+ // 遍历参数数组,将参数名和参数值存储到queryobjArr中
200
+ queryArr.forEach((item, index) => {
201
+ const Strindex = item.indexOf("=");
202
+ queryobjArr[item.slice(0, Strindex)] = item.slice(Strindex + 1);
203
+ });
204
+ // 判断queryobjArr中是否存在"x-params"参数
205
+ if (queryobjArr["x-params"]) {
206
+ // 如果存在,则将参数拼接到url中,并跳转到该url
207
+ let path = `${this.change_url}?x-params=${queryobjArr["x-params"]}&refrom=official`;
208
+ this.$xdUniHelper.navigateTo({
209
+ url: path,
210
+ });
211
+ return;
212
+ }
213
+ if (queryobjArr["pa"]) {
214
+ // 如果queryobjArr中有pa属性,则获取pa属性的值,并将其拼接到bind_url后面,然后使用navigateTo方法跳转到该路径
215
+ let path = `${this.bind_url}?pa=${queryobjArr["pa"]}`;
216
+ this.$xdUniHelper.navigateTo({
217
+ url: path,
218
+ });
219
+ return;
220
+ }
221
+ // 如果res.result是以http或https开头的字符串,则进行以下操作
222
+ if (/^https?:/.test(res.result)) {
223
+ // 获取res.result中的host属性
224
+ let host = parseNetworkURL(res.result).host;
225
+ // 获取当前页面的域名
226
+ console.log(host, 2222);
227
+ let domain = this.extractDomain(this.projectAttr.host);
228
+ console.log(this.extractDomain(this.projectAttr.host), 333);
229
+ // 如果host属性以当前页面的域名结尾,则进行以下操作
230
+ if (host.substr(-domain.length) === domain) {
231
+ // 获取res.resultStr的值
232
+ let path = res.result;
233
+ // 使用navigateTo方法跳转到该路径
234
+ this.$xdUniHelper.navigateTo({
235
+ url: path,
236
+ });
237
+ return;
238
+ }
239
+ }
240
+ this.other = true;
241
+ },
242
+ fail: (error) => {
243
+ // 如果扫描失败,则调用$xdLog.setARMSError方法记录错误信息
244
+ this.$xdLog.setARMSError(error);
245
+ },
246
+ });
247
+ },
248
+ scan() {
249
+ try {
250
+ //#ifdef H5
251
+ this.handleH5();
252
+ //#endif
253
+ //#ifdef MP-WEIXIN
254
+ this.handleMP();
255
+ //#endif
256
+ } catch (err) {
257
+ this.$xdLog.setARMSError(err);
258
+ }
259
+ },
260
+ /**
261
+ * @description 监听事件变化
262
+ * @param container {object} 业务组件对象自己
263
+ */
264
+ init(container) {
265
+ this.change_url = getContainerPropsValue(
266
+ container,
267
+ "content.change_url",
268
+ { value: "" }
269
+ ).value;
270
+ this.bind_url = getContainerPropsValue(container, "content.bind_url", {
271
+ value: "",
272
+ }).value;
273
+ },
274
+ onJfbShow(options) {
275
+ console.log("event.onJfbShow", options);
276
+ },
277
+ },
278
+ };
279
+ </script>
280
+
281
+ <style scoped lang="less">
282
+ @import "./JfbBaseSweepLess.less";
283
+
284
+ .jfb-base-sweep {
285
+ &__body {
286
+ min-height: 100rpx;
287
+ &-other {
288
+ display: flex;
289
+ justify-content: space-between;
290
+ padding-top: 300rpx;
291
+ align-items: center;
292
+ flex-direction: column;
293
+ height: 100%;
294
+ &-text {
295
+ margin-top: 40rpx;
296
+ color: #666;
297
+ font-size: unit(24, rpx);
298
+ text-align: center;
299
+ }
300
+ }
301
+ &-pop {
302
+ min-height: 100rpx;
303
+ text-align: center;
304
+ vertical-align: middle;
305
+ color: #666;
306
+ font-size: unit(24, rpx);
307
+ line-height: 100rpx;
308
+ }
309
+ &-footer {
310
+ position: fixed;
311
+ left: 0;
312
+ right: 0;
313
+ height: unit(110, rpx);
314
+ }
315
+ }
316
+ }
317
+ </style>
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @desc 获取绝对路径完整地址
3
+ * @param @path
4
+ **/
5
+ //例如:https://image.jufubao.cn/20220501010108/image/bg/default_gonghui_bg.png
6
+ @basePath: 'business/';
7
+ @doMain: '//sandbox-img.jufubao.cn/';
8
+
9
+ .getBusinessImageUrl(@path, @size: 'size8') {
10
+ @url: "@{doMain}@{basePath}@{path}?x-oss-process=style/@{size}";
11
+ background-image: url(@url);
12
+ }
13
+
14
+ //start
15
+ .jfb-base-sweep {
16
+ box-sizing: border-box;
17
+
18
+ &__body{
19
+ position: relative;
20
+ overflow: hidden;
21
+ z-index: 2
22
+ }
23
+
24
+ &.editx,&.editx:hover {
25
+ position: relative;
26
+ min-height: unit(100, rpx);
27
+ z-index: 3;
28
+ &::after {
29
+ border: 2rpx dashed blue;
30
+ content: " ";
31
+ position: absolute;
32
+ top:0;
33
+ left:0;
34
+ bottom:0;
35
+ right:0;
36
+ z-index: 4;
37
+ cursor: pointer;
38
+ }
39
+
40
+ }
41
+
42
+
43
+ &__edit {
44
+ cursor: pointer;
45
+ position: absolute;
46
+ right: unit(0, rpx);
47
+ top: unit(-52, rpx);
48
+ height: unit(50, rpx);
49
+ line-height: unit(50, rpx);
50
+ display: flex;
51
+ justify-content: center;
52
+ align-items: center;
53
+ background: rgba(0, 0, 0, .6);
54
+ border-radius: unit(10, rpx);
55
+ box-shadow: 0 0 10px rbga(0, 0, 0, 0.3);
56
+ color: #fff;
57
+ font-size: unit(22, rpx);
58
+
59
+ &-icon{
60
+ padding: 0 unit(20, rpx);
61
+ }
62
+
63
+ &.editx {
64
+ box-sizing: border-box;
65
+
66
+ }
67
+ }
68
+ }
69
+ //end
70
+
71
+
72
+ /**notPreview**/
73
+ .jfb-base-sweep {
74
+ //&:before {
75
+ //content: " ";
76
+ //display: table;
77
+ //}
78
+ }
79
+ /**endNotPreview**/
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+
4
+ //@AttrImport
5
+ import Attr from "./Attr";
6
+ //@EndAttrImport
7
+
8
+
9
+ export default {
10
+ data() {
11
+ return {
12
+ //#ifdef H5
13
+
14
+ //@AttrData
15
+ Attr:{}, //对外开发编辑属性
16
+ //@EndAttrData
17
+
18
+ // #endif
19
+ cssRoot: 'jfb-base-sweep'
20
+ }
21
+ },
22
+ created() {
23
+
24
+ //@AttrDataCreated
25
+ this.Attr = this.$xdUniHelper.customClone(Attr);
26
+ //@EndAttrDataCreated
27
+
28
+
29
+ },
30
+ }
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ module.exports = {}