wordpress企業(yè)主題教程seo優(yōu)化員
💕💕作者:計算機源碼社
💕💕個人簡介:本人 八年開發(fā)經(jīng)驗,擅長Java、Python、PHP、.NET、Node.js、Android、微信小程序、爬蟲、大數(shù)據(jù)、機器學(xué)習(xí)等,大家有這一塊的問題可以一起交流!
💕💕學(xué)習(xí)資料、程序開發(fā)、技術(shù)解答、文檔報告
💕💕如需要源碼,可以掃取文章下方二維碼聯(lián)系咨詢
💕💕Java項目
💕💕微信小程序項目
💕💕Android項目
💕💕Python項目
💕💕PHP項目
💕💕ASP.NET項目
💕💕Node.js項目
💕💕選題推薦
項目實戰(zhàn)|基于uniapp蛋糕訂購小程序蛋糕銷售小程序源碼
文章目錄
- 1、選題背景
- 2、研究目的和意義
- 3、系統(tǒng)功能設(shè)計
- 4、系統(tǒng)頁面設(shè)計
- 5、參考文獻
- 6、核心代碼
1、選題背景
??隨著移動互聯(lián)網(wǎng)的快速發(fā)展和智能手機的普及,消費者的購物習(xí)慣發(fā)生了顯著變化,線上訂購已成為許多人的首選方式。在此背景下,蛋糕行業(yè)也面臨著轉(zhuǎn)型升級的需求。傳統(tǒng)的蛋糕店營銷模式已難以滿足現(xiàn)代消費者對便捷性、個性化和即時服務(wù)的追求。同時,小程序作為一種輕量級應(yīng)用,因其使用方便、無需下載安裝等特點,正在成為商家觸達用戶的重要渠道。
uni-app作為一種跨平臺開發(fā)框架,能夠同時滿足多個平臺的開發(fā)需求,大大提高了開發(fā)效率。在這樣的技術(shù)和市場環(huán)境下,開發(fā)一個基于uni-app的蛋糕訂購小程序成為順應(yīng)時代潮流的選擇。這種模式不僅能為消費者提供更便捷的訂購體驗,還能幫助蛋糕店拓展銷售渠道、提高運營效率、增強用戶粘性。通過整合蛋糕展示、在線訂購、用戶互動等功能,小程序?qū)榈案庑袠I(yè)的數(shù)字化轉(zhuǎn)型提供有力支持。
2、研究目的和意義
??基于uni-app的蛋糕訂購小程序旨在打造一個全面、便捷、互動的蛋糕購買平臺。該小程序的主要目的是通過數(shù)字化手段整合蛋糕店的銷售、管理和客戶服務(wù)流程,為用戶提供從瀏覽、選購到評價的一站式服務(wù)體驗。對于用戶而言,系統(tǒng)致力于提供豐富的蛋糕信息展示、便捷的訂購流程、個性化的推薦服務(wù),以及積分兌換等增值功能,滿足現(xiàn)代消費者對便利性和個性化服務(wù)的需求。對于管理員,系統(tǒng)旨在提供全面的后臺管理工具,包括用戶管理、商品管理、訂單處理、客戶服務(wù)等,以提高運營效率,優(yōu)化業(yè)務(wù)流程。通過整合在線聊天、評價系統(tǒng)等互動功能,小程序還致力于增強用戶粘性,建立良好的客戶關(guān)系。最終,該系統(tǒng)的開發(fā)目的是為蛋糕店提供一個有力的數(shù)字化經(jīng)營工具,以應(yīng)對市場競爭,擴大客戶群體,提升品牌影響力。
??基于uni-app的蛋糕訂購小程序的開發(fā)具有重要的實際意義和長遠價值。首先,在移動互聯(lián)網(wǎng)時代,該小程序的開發(fā)順應(yīng)了消費者線上購物的趨勢,為蛋糕店提供了一個新的銷售渠道,有助于擴大市場份額,提高經(jīng)營效益。通過數(shù)字化平臺,蛋糕店可以更精準地了解客戶需求,優(yōu)化產(chǎn)品結(jié)構(gòu),提升服務(wù)質(zhì)量。其次,小程序的便捷性和跨平臺特性,使得用戶可以隨時隨地瀏覽和訂購蛋糕,大大提高了用戶體驗和購買轉(zhuǎn)化率。對于蛋糕店而言,小程序的開發(fā)有助于降低運營成本,提高管理效率,實現(xiàn)精準營銷。從長遠來看,這一系統(tǒng)的應(yīng)用將推動蛋糕行業(yè)的數(shù)字化轉(zhuǎn)型,促進行業(yè)標準化和規(guī)范化發(fā)展。此外,基于uni-app開發(fā)的跨平臺解決方案,為其他餐飲零售行業(yè)的移動應(yīng)用開發(fā)提供了借鑒,具有一定的技術(shù)創(chuàng)新意義??偟膩碚f,該小程序的開發(fā)不僅能夠滿足當前市場需求,還能為蛋糕行業(yè)的未來發(fā)展提供新的思路和動力。
3、系統(tǒng)功能設(shè)計
管理員功能模塊:
用戶管理:
查看、搜索和管理用戶信息
設(shè)置用戶權(quán)限,如禁用或啟用賬號
查看用戶的訂單歷史和消費記錄
蛋糕資訊管理:
發(fā)布、編輯和刪除蛋糕相關(guān)的新聞和活動信息
設(shè)置資訊的展示順序和可見性
管理資訊的分類和標簽
蛋糕信息管理:
添加新的蛋糕產(chǎn)品,包括名稱、描述、價格、圖片等
編輯現(xiàn)有蛋糕信息
管理蛋糕的上架/下架狀態(tài)和庫存
蛋糕分類管理:
創(chuàng)建、編輯和刪除蛋糕分類
設(shè)置分類的層級關(guān)系和展示順序
蛋糕口味管理:
添加、編輯和刪除蛋糕口味選項
管理口味與蛋糕的關(guān)聯(lián)
訂單管理:
查看所有訂單信息
處理訂單狀態(tài)變更(如確認訂單、安排配送等)
處理退款申請
查看評價信息:
瀏覽用戶對蛋糕的評價
回復(fù)用戶評價
管理評價的顯示狀態(tài)
聊天回復(fù):
回復(fù)用戶的在線咨詢
查看聊天歷史記錄
用戶功能模塊:
查看蛋糕信息:
瀏覽蛋糕列表和詳細信息
搜索特定蛋糕
查看蛋糕的評論
查看蛋糕資訊:
瀏覽蛋糕相關(guān)的新聞和活動信息
查看資訊詳情
收藏蛋糕:
將喜歡的蛋糕添加到收藏列表
管理收藏列表
添加購物車:
將選擇的蛋糕添加到購物車
管理購物車中的商品(修改數(shù)量、刪除等)
下單購買蛋糕:
選擇蛋糕和數(shù)量
填寫配送信息
選擇支付方式并完成支付
查看訂單狀態(tài)
評價蛋糕:
對購買過的蛋糕進行評分和評價
查看和管理自己的評價歷史
在線聊天:
與客服進行實時在線對話
查看聊天歷史記錄
積分兌換蛋糕:
查看可用積分
使用積分兌換指定蛋糕
查看積分兌換記錄
4、系統(tǒng)頁面設(shè)計
如需要源碼,可以掃取文章下方二維碼聯(lián)系咨詢
5、參考文獻
[1]閆嬌嬌.基于Think PHP+Vue商城管理系統(tǒng)的設(shè)計與實現(xiàn)[J].電腦知識與技術(shù),2023,19(34):59-62.DOI:10.14004/j.cnki.ckt.2023.1834.
[2]鄭妍,張未名,張潤園,等.基于云開發(fā)和微信小程序的愛寵家系統(tǒng)[J].電腦編程技巧與維護,2023,(06):79-81.DOI:10.16184/j.cnki.comprg.2023.06.050.
[3]韓本東.基于DeepFM的直播商城系統(tǒng)設(shè)計與實現(xiàn)[D].北京交通大學(xué),2023. DOI:10.26944/d.cnki.gbfju.2023.003274.
[4]李宇杰.基于微服務(wù)架構(gòu)的電商微信小程序的設(shè)計與實現(xiàn)[D].華東師范大學(xué),2023. DOI:10.27149/d.cnki.ghdsu.2023.003555.
[5]趙沖沖.基于Dubbo框架的購物商城的設(shè)計和實現(xiàn)[D].北京交通大學(xué),2022. DOI:10.26944/d.cnki.gbfju.2022.000794.
[6]焦自程.基于uni-app框架的購物商城小程序的設(shè)計與實現(xiàn)[J].信息與電腦(理論版),2022,34(08):168-170.
[7]杜雨荃,王曉菊,田立勤.基于微信小程序的網(wǎng)上購物系統(tǒng)的設(shè)計與實現(xiàn)[J].網(wǎng)絡(luò)安全技術(shù)與應(yīng)用,2022,(04):60-62.
[8]李常寶.基于微信小程序的電子商城的設(shè)計與開發(fā)[J].呂梁教育學(xué)院學(xué)報,2021,38(03):133-136.
[9]徐超.基于協(xié)同過濾的智能推薦商城系統(tǒng)的設(shè)計與實現(xiàn)[D].南昌大學(xué),2021. DOI:10.27232/d.cnki.gnchu.2021.002264.
[10]胡楊林.基于微服務(wù)和小程序的電子商城設(shè)計與實現(xiàn)[D].西北大學(xué),2021. DOI:10.27405/d.cnki.gxbdu.2021.000827.
[11]馬靜.基于微信小程序的購物商城系統(tǒng)的設(shè)計與實現(xiàn)[J].微型電腦應(yīng)用,2021,37(03):31-34.
[12]康嬌蘭.基于微信小程序的區(qū)塊鏈商城系統(tǒng)的設(shè)計與實現(xiàn)[D].華中科技大學(xué),2021. DOI:10.27157/d.cnki.ghzku.2021.004151.
6、核心代碼
<template>
<view class="content"><view :style='{"minHeight":"100vh","padding":"0px 0 80rpx","borderColor":"#21d5ae","background":"#fff","borderWidth":"0px 0 0","width":"100%","position":"relative","borderStyle":"dashed","height":"auto"}'><form :style='{"width":"100%","padding":"60rpx 40rpx","background":"none","height":"auto"}' class="app-update-pv"><view :style='{"padding":"0 20rpx 0px","boxShadow":"inset 0px 0px 0px 0px #f9edd9","margin":"0 0 32rpx","borderColor":"#e9be70","borderRadius":"0px","borderWidth":"0px","background":"url(http://codegen.caihongy.cn/20230303/adcda4c7311148a1913eb708c6fdebf0.png) no-repeat left top,url(http://codegen.caihongy.cn/20230303/41517a62f11849869c71aed71b75484e.png) no-repeat right bottom,#fffcf3","display":"flex","width":"100%","lineHeight":"88rpx","borderStyle":"solid","height":"auto"}' class=""><view :style='{"width":"160rpx","padding":"0 20rpx 0 0","fontSize":"28rpx","color":"#844819","textAlign":"right"}' class="title">蛋糕名稱</view><input :style='{"border":"0","padding":"0px 20rpx","margin":"0px","color":"#666","borderRadius":"8rpx","flex":"1","background":"rgba(255, 255, 255, 0)","fontSize":"28rpx"}' :disabled="ro.dangaomingcheng" v-model="ruleForm.dangaomingcheng" placeholder="蛋糕名稱"></input></view><view :style='{"padding":"0 20rpx 0px","boxShadow":"inset 0px 0px 0px 0px #f9edd9","margin":"0 0 32rpx","borderColor":"#e9be70","borderRadius":"0px","borderWidth":"0px","background":"url(http://codegen.caihongy.cn/20230303/adcda4c7311148a1913eb708c6fdebf0.png) no-repeat left top,url(http://codegen.caihongy.cn/20230303/41517a62f11849869c71aed71b75484e.png) no-repeat right bottom,#fffcf3","display":"flex","width":"100%","lineHeight":"88rpx","borderStyle":"solid","height":"auto"}' class=" select"><view :style='{"width":"160rpx","padding":"0 20rpx 0 0","fontSize":"28rpx","color":"#844819","textAlign":"right"}' class="title">蛋糕分類</view><picker :style='{"width":"100%","flex":"1","height":"auto"}' @change="dangaofenleiChange" :value="dangaofenleiIndex" :range="dangaofenleiOptions"><view :style='{"width":"100%","lineHeight":"80rpx","fontSize":"28rpx","color":"#666"}' class="uni-input">{{ruleForm.dangaofenlei?ruleForm.dangaofenlei:"請選擇蛋糕分類"}}</view></picker></view><view :style='{"padding":"0 20rpx 0px","boxShadow":"inset 0px 0px 0px 0px #f9edd9","margin":"0 0 32rpx","borderColor":"#e9be70","borderRadius":"0px","borderWidth":"0px","background":"url(http://codegen.caihongy.cn/20230303/adcda4c7311148a1913eb708c6fdebf0.png) no-repeat left top,url(http://codegen.caihongy.cn/20230303/41517a62f11849869c71aed71b75484e.png) no-repeat right bottom,#fffcf3","display":"flex","width":"100%","lineHeight":"88rpx","borderStyle":"solid","height":"auto"}' class=" select"><view :style='{"width":"160rpx","padding":"0 20rpx 0 0","fontSize":"28rpx","color":"#844819","textAlign":"right"}' class="title">口味</view><picker :style='{"width":"100%","flex":"1","height":"auto"}' @change="kouweiChange" :value="kouweiIndex" :range="kouweiOptions"><view :style='{"width":"100%","lineHeight":"80rpx","fontSize":"28rpx","color":"#666"}' class="uni-input">{{ruleForm.kouwei?ruleForm.kouwei:"請選擇口味"}}</view></picker></view><view :style='{"padding":"0 20rpx 0px","boxShadow":"inset 0px 0px 0px 0px #f9edd9","margin":"0 0 32rpx","borderColor":"#e9be70","borderRadius":"0px","borderWidth":"0px","background":"url(http://codegen.caihongy.cn/20230303/adcda4c7311148a1913eb708c6fdebf0.png) no-repeat left top,url(http://codegen.caihongy.cn/20230303/41517a62f11849869c71aed71b75484e.png) no-repeat right bottom,#fffcf3","display":"flex","width":"100%","lineHeight":"88rpx","borderStyle":"solid","height":"auto"}' class="" @tap="fengmianTap"><view :style='{"width":"160rpx","padding":"0 20rpx 0 0","fontSize":"28rpx","color":"#844819","textAlign":"right"}' class="title">封面</view><image :style='{"width":"72rpx","margin":"12rpx 0","borderRadius":"100%","objectFit":"cover","display":"block","height":"72rpx"}' class="avator" v-if="ruleForm.fengmian" :src="baseUrl+ruleForm.fengmian.split(',')[0]" mode="aspectFill"></image><image :style='{"width":"72rpx","margin":"12rpx 0","borderRadius":"100%","objectFit":"cover","display":"block","height":"72rpx"}' class="avator" v-else src="../../static/gen/upload.png" mode="aspectFill"></image></view><view :style='{"padding":"0 20rpx 0px","boxShadow":"inset 0px 0px 0px 0px #f9edd9","margin":"0 0 32rpx","borderColor":"#e9be70","borderRadius":"0px","borderWidth":"0px","background":"url(http://codegen.caihongy.cn/20230303/adcda4c7311148a1913eb708c6fdebf0.png) no-repeat left top,url(http://codegen.caihongy.cn/20230303/41517a62f11849869c71aed71b75484e.png) no-repeat right bottom,#fffcf3","display":"flex","width":"100%","lineHeight":"88rpx","borderStyle":"solid","height":"auto"}' class=""><view :style='{"width":"160rpx","padding":"0 20rpx 0 0","fontSize":"28rpx","color":"#844819","textAlign":"right"}' class="title">顏色</view><input :style='{"border":"0","padding":"0px 20rpx","margin":"0px","color":"#666","borderRadius":"8rpx","flex":"1","background":"rgba(255, 255, 255, 0)","fontSize":"28rpx"}' :disabled="ro.yanse" v-model="ruleForm.yanse" placeholder="顏色"></input></view><view :style='{"padding":"0 20rpx 0px","boxShadow":"inset 0px 0px 0px 0px #f9edd9","margin":"0 0 32rpx","borderColor":"#e9be70","borderRadius":"0px","borderWidth":"0px","background":"url(http://codegen.caihongy.cn/20230303/adcda4c7311148a1913eb708c6fdebf0.png) no-repeat left top,url(http://codegen.caihongy.cn/20230303/41517a62f11849869c71aed71b75484e.png) no-repeat right bottom,#fffcf3","display":"flex","width":"100%","lineHeight":"88rpx","borderStyle":"solid","height":"auto"}' class=""><view :style='{"width":"160rpx","padding":"0 20rpx 0 0","fontSize":"28rpx","color":"#844819","textAlign":"right"}' class="title">蛋糕尺寸</view><input :style='{"border":"0","padding":"0px 20rpx","margin":"0px","color":"#666","borderRadius":"8rpx","flex":"1","background":"rgba(255, 255, 255, 0)","fontSize":"28rpx"}' :disabled="ro.dangaochicun" v-model="ruleForm.dangaochicun" placeholder="蛋糕尺寸"></input></view><view :style='{"padding":"0 20rpx 0px","boxShadow":"inset 0px 0px 0px 0px #f9edd9","margin":"0 0 32rpx","borderColor":"#e9be70","borderRadius":"0px","borderWidth":"0px","background":"url(http://codegen.caihongy.cn/20230303/adcda4c7311148a1913eb708c6fdebf0.png) no-repeat left top,url(http://codegen.caihongy.cn/20230303/41517a62f11849869c71aed71b75484e.png) no-repeat right bottom,#fffcf3","display":"flex","width":"100%","lineHeight":"88rpx","borderStyle":"solid","height":"auto"}' class=" select"><view :style='{"width":"160rpx","padding":"0 20rpx 0 0","fontSize":"28rpx","color":"#844819","textAlign":"right"}' class="title">上架日期</view><picker :style='{"width":"100%","flex":"1","height":"auto"}' mode="date" :value="ruleForm.shangjiariqi" @change="shangjiariqiChange"><view :style='{"width":"100%","lineHeight":"80rpx","fontSize":"28rpx","color":"#666"}' class="uni-input">{{ruleForm.shangjiariqi?ruleForm.shangjiariqi:"請選擇上架日期"}}</view></picker></view><view :style='{"padding":"0 20rpx 0px","boxShadow":"inset 0px 0px 0px 0px #f9edd9","margin":"0 0 32rpx","borderColor":"#e9be70","borderRadius":"0px","borderWidth":"0px","background":"url(http://codegen.caihongy.cn/20230303/adcda4c7311148a1913eb708c6fdebf0.png) no-repeat left top,url(http://codegen.caihongy.cn/20230303/41517a62f11849869c71aed71b75484e.png) no-repeat right bottom,#fffcf3","display":"flex","width":"100%","lineHeight":"88rpx","borderStyle":"solid","height":"auto"}' class=""><view :style='{"width":"160rpx","padding":"0 20rpx 0 0","fontSize":"28rpx","color":"#844819","textAlign":"right"}' class="title">積分</view><input :style='{"border":"0","padding":"0px 20rpx","margin":"0px","color":"#666","borderRadius":"8rpx","flex":"1","background":"rgba(255, 255, 255, 0)","fontSize":"28rpx"}' :disabled="ro.jf" v-model="ruleForm.jf" placeholder="積分"></input></view><view :style='{"padding":"0 20rpx 0px","boxShadow":"inset 0px 0px 0px 0px #f9edd9","margin":"0 0 32rpx","borderColor":"#e9be70","borderRadius":"0px","borderWidth":"0px","background":"url(http://codegen.caihongy.cn/20230303/adcda4c7311148a1913eb708c6fdebf0.png) no-repeat left top,url(http://codegen.caihongy.cn/20230303/41517a62f11849869c71aed71b75484e.png) no-repeat right bottom,#fffcf3","display":"flex","width":"100%","lineHeight":"88rpx","borderStyle":"solid","height":"auto"}' class=""><view :style='{"width":"160rpx","padding":"0 20rpx 0 0","fontSize":"28rpx","color":"#844819","textAlign":"right"}' class="title">價格</view><input :style='{"border":"0","padding":"0px 20rpx","margin":"0px","color":"#666","borderRadius":"8rpx","flex":"1","background":"rgba(255, 255, 255, 0)","fontSize":"28rpx"}' :disabled="ro.price" v-model="ruleForm.price" placeholder="價格"></input></view><!-- 否 --><view :style='{"padding":"0 20rpx 0px","boxShadow":"inset 0px 0px 0px 0px #f9edd9","margin":"0 0 32rpx","borderColor":"#e9be70","borderRadius":"0px","borderWidth":"0px","background":"url(http://codegen.caihongy.cn/20230303/adcda4c7311148a1913eb708c6fdebf0.png) no-repeat left top,url(http://codegen.caihongy.cn/20230303/41517a62f11849869c71aed71b75484e.png) no-repeat right bottom,#fffcf3","display":"flex","width":"100%","lineHeight":"88rpx","borderStyle":"solid","height":"auto"}' class=""><view :style='{"width":"160rpx","padding":"0 20rpx 0 0","fontSize":"28rpx","color":"#844819","textAlign":"right"}' class="title">裝飾品</view><textarea :style='{"border":"0","minHeight":"240rpx","padding":"40rpx 40rpx","margin":"0px","color":"#666","borderRadius":"8rpx","flex":"1","background":"none","fontSize":"28rpx"}' v-model="ruleForm.zhuangshipin" placeholder="裝飾品"></textarea></view><view :style='{"padding":"12rpx 0","margin":"0 0 24rpx 0","borderColor":"#ccc","borderWidth":"0 0 0px 0","width":"100%","borderStyle":"solid","height":"auto"}' class=""><view :style='{"width":"100%","lineHeight":"80rpx","fontSize":"28rpx","color":"#844819","fontWeight":"500"}' class="title">蛋糕詳情</view><xia-editor ref="editor" :style='{"minHeight":"300rpx","padding":"24rpx 32rpx","boxShadow":"inset 0px 0px 0px 0px #f9edd9","borderColor":"#e9be70","borderRadius":"0px","background":"url(http://codegen.caihongy.cn/20230303/adcda4c7311148a1913eb708c6fdebf0.png) no-repeat left top,url(http://codegen.caihongy.cn/20230303/41517a62f11849869c71aed71b75484e.png) no-repeat right bottom,#fffcf3","borderWidth":"0px","width":"100%","borderStyle":"solid","height":"auto"}' v-model="ruleForm.dangaoxiangqing" placeholder="蛋糕詳情" @editorChange="dangaoxiangqingChange"></xia-editor></view><view :style='{"padding":"0px","margin":"40rpx 0 0 0","background":"none","display":"flex","width":"100%","justifyContent":"center","height":"auto"}' class="btn" ><button :style='{"padding":"0 40rpx","boxShadow":"0px 0px 0px #ccc","margin":"0 40rpx 0 0","borderColor":"#6dd5cb","color":"#fff","display":"inline","minWidth":"220rpx","borderRadius":"0px","background":"#ec9e69","borderWidth":"0px","width":"auto","lineHeight":"72rpx","fontSize":"28rpx","borderStyle":"solid","height":"80rpx"}' @tap="onSubmitTap" class="bg-red">提交</button></view></form><w-picker mode="dateTime" step="1" :current="false" :hasSecond="false" @confirm="clicktimeConfirm" ref="clicktime" themeColor="#333333"></w-picker></view>
</view>
</template><script>import wPicker from "@/components/w-picker/w-picker.vue";import xiaEditor from '@/components/xia-editor/xia-editor';export default {data() {return {cross:'',ruleForm: {dangaomingcheng: '',dangaofenlei: '',kouwei: '',fengmian: '',yanse: '',zhuangshipin: '',dangaochicun: '',shangjiariqi: '',dangaoxiangqing: '',jf: '',price: '',},dangaofenleiOptions: [],dangaofenleiIndex: 0,kouweiOptions: [],kouweiIndex: 0,// 登陸用戶信息user: {},ro:{dangaomingcheng : false,dangaofenlei : false,kouwei : false,fengmian : false,yanse : false,zhuangshipin : false,dangaochicun : false,shangjiariqi : false,dangaoxiangqing : false,clicktime : false,clicknum : false,jf : false,price : false,},}},components: {wPicker,xiaEditor},computed: {baseUrl() {return this.$base.url;},},async onLoad(options) {this.ruleForm.shangjiariqi = this.$utils.getCurDate();let table = uni.getStorageSync("nowTable");// 獲取用戶信息let res = await this.$api.session(table);this.user = res.data;// ss讀取// 下拉框res = await this.$api.option(`dangaofenlei`,`dangaofenlei`,{});this.dangaofenleiOptions = res.data;this.dangaofenleiOptions.unshift("請選擇蛋糕分類");// 下拉框res = await this.$api.option(`kouwei`,`kouwei`,{});this.kouweiOptions = res.data;this.kouweiOptions.unshift("請選擇口味");// 如果有登陸,獲取登陸后保存的useridthis.ruleForm.userid = uni.getStorageSync("userid")if (options.refid) {// 如果上一級頁面?zhèn)鬟f了refid,獲取改refid數(shù)據(jù)信息this.ruleForm.refid = options.refid;this.ruleForm.nickname = uni.getStorageSync("nickname");}// 如果是更新操作if (options.id) {this.ruleForm.id = options.id;// 獲取信息res = await this.$api.info(`dangaoxinxi`, this.ruleForm.id);this.ruleForm = res.data;}// 跨表this.cross = options.cross;if(options.cross){var obj = uni.getStorageSync('crossObj');for (var o in obj){if(o=='dangaomingcheng'){this.ruleForm.dangaomingcheng = obj[o];this.ro.dangaomingcheng = true;continue;}if(o=='dangaofenlei'){this.ruleForm.dangaofenlei = obj[o];this.ro.dangaofenlei = true;continue;}if(o=='kouwei'){this.ruleForm.kouwei = obj[o];this.ro.kouwei = true;continue;}if(o=='fengmian'){this.ruleForm.fengmian = obj[o].split(",")[0];this.ro.fengmian = true;continue;}if(o=='yanse'){this.ruleForm.yanse = obj[o];this.ro.yanse = true;continue;}if(o=='zhuangshipin'){this.ruleForm.zhuangshipin = obj[o];this.ro.zhuangshipin = true;continue;}if(o=='dangaochicun'){this.ruleForm.dangaochicun = obj[o];this.ro.dangaochicun = true;continue;}if(o=='shangjiariqi'){this.ruleForm.shangjiariqi = obj[o];this.ro.shangjiariqi = true;continue;}if(o=='dangaoxiangqing'){this.ruleForm.dangaoxiangqing = obj[o];this.ro.dangaoxiangqing = true;continue;}if(o=='clicktime'){this.ruleForm.clicktime = obj[o];this.ro.clicktime = true;continue;}if(o=='clicknum'){this.ruleForm.clicknum = obj[o];this.ro.clicknum = true;continue;}if(o=='jf'){this.ruleForm.jf = obj[o];this.ro.jf = true;continue;}if(o=='price'){this.ruleForm.price = obj[o];this.ro.price = true;continue;}}}this.styleChange()},methods: {dangaoxiangqingChange(e) {this.ruleForm.dangaoxiangqing = e},styleChange() {this.$nextTick(()=>{// document.querySelectorAll('.app-update-pv . .uni-input-input').forEach(el=>{// el.style.backgroundColor = this.addUpdateForm.input.content.backgroundColor// })})},// 多級聯(lián)動參數(shù)shangjiariqiChange(e) {this.ruleForm.shangjiariqi = e.target.value;this.$forceUpdate();},// 日長控件選擇日期時間clicktimeConfirm(val) {console.log(val)this.ruleForm.clicktime = val.result;this.$forceUpdate();},// 下拉變化dangaofenleiChange(e) {this.dangaofenleiIndex = e.target.valuethis.ruleForm.dangaofenlei = this.dangaofenleiOptions[this.dangaofenleiIndex]},// 下拉變化kouweiChange(e) {this.kouweiIndex = e.target.valuethis.ruleForm.kouwei = this.kouweiOptions[this.kouweiIndex]},fengmianTap() {let _this = this;this.$api.upload(function(res) {_this.ruleForm.fengmian = 'upload/' + res.file;_this.$forceUpdate();_this.$nextTick(()=>{_this.styleChange()})});},getUUID () {return new Date().getTime();},async onSubmitTap() {//跨表計算判斷var obj;if((!this.ruleForm.dangaomingcheng)){this.$utils.msg(`蛋糕名稱不能為空`);return}if((!this.ruleForm.dangaofenlei)){this.$utils.msg(`蛋糕分類不能為空`);return}if(this.ruleForm.clicknum&&(!this.$validate.isIntNumer(this.ruleForm.clicknum))){this.$utils.msg(`點擊次數(shù)應(yīng)輸入整數(shù)`);return}if(this.ruleForm.jf&&(!this.$validate.isIntNumer(this.ruleForm.jf))){this.$utils.msg(`積分應(yīng)輸入整數(shù)`);return}if((!this.ruleForm.price)){this.$utils.msg(`價格不能為空`);return}if(this.ruleForm.price&&(!this.$validate.isNumber(this.ruleForm.price))){this.$utils.msg(`價格應(yīng)輸入數(shù)字`);return}//更新跨表屬性var crossuserid;var crossrefid;var crossoptnum;if(this.cross){var statusColumnName = uni.getStorageSync('statusColumnName');var statusColumnValue = uni.getStorageSync('statusColumnValue');if(statusColumnName!='') {if(!obj) {obj = uni.getStorageSync('crossObj');}if(!statusColumnName.startsWith("[")) {for (var o in obj){if(o==statusColumnName){obj[o] = statusColumnValue;}}var table = uni.getStorageSync('crossTable');await this.$api.update(`${table}`, obj);} else {crossuserid=Number(uni.getStorageSync('userid'));crossrefid=obj['id'];crossoptnum=uni.getStorageSync('statusColumnName');crossoptnum=crossoptnum.replace(/\[/,"").replace(/\]/,"");}}}if(crossrefid && crossuserid) {this.ruleForm.crossuserid=crossuserid;this.ruleForm.crossrefid=crossrefid;let params = {page: 1,limit:10,crossuserid:crossuserid,crossrefid:crossrefid,}let res = await this.$api.list(`dangaoxinxi`, params);if (res.data.total >= crossoptnum) {this.$utils.msg(uni.getStorageSync('tips'));return false;} else {//跨表計算if(this.ruleForm.id){await this.$api.update(`dangaoxinxi`, this.ruleForm);}else{await this.$api.add(`dangaoxinxi`, this.ruleForm);}this.$utils.msgBack('提交成功');}} else {//跨表計算if(this.ruleForm.id){await this.$api.update(`dangaoxinxi`, this.ruleForm);}else{await this.$api.add(`dangaoxinxi`, this.ruleForm);}this.$utils.msgBack('提交成功');}},optionsChange(e) {this.index = e.target.value},bindDateChange(e) {this.date = e.target.value},getDate(type) {const date = new Date();let year = date.getFullYear();let month = date.getMonth() + 1;let day = date.getDate();if (type === 'start') {year = year - 60;} else if (type === 'end') {year = year + 2;}month = month > 9 ? month : '0' + month;;day = day > 9 ? day : '0' + day;return `${year}-${month}-${day}`;},toggleTab(str) {this.$refs[str].show();}}}
</script><style lang="scss" scoped>.content {min-height: calc(100vh - 44px);box-sizing: border-box;}
</style>
💕💕作者:計算機源碼社
💕💕個人簡介:本人 八年開發(fā)經(jīng)驗,擅長Java、Python、PHP、.NET、Node.js、Android、微信小程序、爬蟲、大數(shù)據(jù)、機器學(xué)習(xí)等,大家有這一塊的問題可以一起交流!
💕💕學(xué)習(xí)資料、程序開發(fā)、技術(shù)解答、文檔報告
💕💕如需要源碼,可以掃取文章下方二維碼聯(lián)系咨詢