pageOne.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <template>
  2. <view class="page-itemOne">
  3. <u-row justify="space-between" customStyle="margin-bottom: 10px">
  4. <u-col span="3">
  5. <div class="page-itemOne-title">图片资料</div>
  6. </u-col>
  7. <u-col span="3.5">
  8. <u-button size="small" @click="copyAllImages"
  9. style="border-radius: 20rpx;border-color: #007AFF;color: #007AFF;">复制全部图片</u-button>
  10. </u-col>
  11. </u-row>
  12. <!-- 实物图卡片 -->
  13. <view class="card_wrap">
  14. <view class="card-title">实物图</view>
  15. <view class="image-upload-container">
  16. <view class="image-list">
  17. <view class="image-item" v-for="(item, index) in trueUploadList" :key="'truePic-' + index">
  18. <pic-comp :src="item.fileUrl"></pic-comp>
  19. <view class="delete-btn" @click="deleteImage(item)">×</view>
  20. </view>
  21. <view class="upload-btn" @click="uploadImage('truePic')">
  22. <u-icon name="plus" size="40" color="#999"></u-icon>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <!-- 聊天记录卡片 -->
  28. <view class="card_wrap">
  29. <view class="card-title">聊天记录</view>
  30. <view class="image-upload-container">
  31. <view class="image-list">
  32. <view class="image-item" v-for="(item, index) in chatRecordsUploadList"
  33. :key="'chatRecords-' + index">
  34. <pic-comp :src="item.fileUrl"></pic-comp>
  35. <view class="delete-btn" @click="deleteImage(item)">×</view>
  36. </view>
  37. <view class="upload-btn" @click="uploadImage('chatRecords')">
  38. <u-icon name="plus" size="40" color="#999"></u-icon>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <!-- 基本信息卡片 -->
  44. <view class="info-card">
  45. <view class="info-card-title">基本信息</view>
  46. <u-row class="info-row">
  47. <u-col span="6">
  48. <view class="info-label">发单人</view>
  49. <view class="info-value">{{ orderDetail.createNickName || '未填写' }}</view>
  50. </u-col>
  51. <u-col span="6">
  52. <view class="info-label">型号</view>
  53. <view class="info-value">{{ orderDetail.model || '未填写' }}</view>
  54. </u-col>
  55. </u-row>
  56. <u-row class="info-row">
  57. <u-col span="6">
  58. <view class="info-label">上门时间</view>
  59. <view class="info-value">{{ orderDetail.visitTime || '未填写' }}</view>
  60. </u-col>
  61. <u-col span="6">
  62. <view class="info-label">地址</view>
  63. <view class="info-value">{{ orderDetail.address || '未填写' }}</view>
  64. </u-col>
  65. </u-row>
  66. </view>
  67. <!-- 联系方式卡片 -->
  68. <view class="connect">
  69. <view class="connect-card phone-card" @click="handlePhoneClick">
  70. <u-icon name="phone" size="40" color="#07C160" style="margin-bottom: 10rpx;"></u-icon>
  71. <view class="connect-title">电话</view>
  72. <!-- 小红点 -->
  73. <view v-if="orderDetail.phone" class="red-dot"></view>
  74. </view>
  75. <view class="connect-card wechat-card" @click="handleWechatClick">
  76. <u-icon name="chat" size="40" color="#07C160" style="margin-bottom: 10rpx;"></u-icon>
  77. <view class="connect-title">微信</view>
  78. <!-- 小红点 -->
  79. <view v-if="orderDetail.wechat" class="red-dot"></view>
  80. </view>
  81. </view>
  82. <u-button @click="handleNextClick" type="primary" size="middle" style="border-radius: 20rpx;">下一步</u-button>
  83. </view>
  84. </template>
  85. <script>
  86. import picComp from './picComp.vue'
  87. import imgUploadAndDownLoad from '../mixin/imgUploadAndDownLoad.js'
  88. export default {
  89. mixins: [imgUploadAndDownLoad],
  90. props: {
  91. orderDetail: {
  92. type: Object,
  93. default: () => { },
  94. },
  95. orderId: {
  96. type: String,
  97. default: '',
  98. }
  99. },
  100. components: {
  101. picComp
  102. },
  103. data() {
  104. return {
  105. //展示的图片列表
  106. trueUploadList: [],
  107. chatRecordsUploadList: [],
  108. // 待绑定的图片列表
  109. bindList: [],
  110. }
  111. },
  112. watch: {
  113. // 监听 props 变化,触发请求
  114. orderDetail: {
  115. handler(newVal) {
  116. if (newVal) { // 确保 props 有值再执行
  117. this.getList('2', '1');
  118. this.getList('2', '2');
  119. }
  120. }
  121. }
  122. },
  123. methods: {
  124. // 电话卡片点击事件
  125. handlePhoneClick() {
  126. console.log('电话卡片被点击', '电话号码:', this.orderDetail.phone)
  127. if (this.orderDetail.phone) {
  128. //拨打电话
  129. uni.makePhoneCall({
  130. phoneNumber: this.orderDetail.phone,
  131. success: () => {
  132. this.$store.commit("call/SET_FORM", {
  133. clueId: this.orderDetail.clueId,
  134. type: "3",
  135. callee: this.orderDetail.phone,
  136. });
  137. },
  138. });
  139. } else {
  140. uni.showToast({
  141. title: '该订单暂时没有电话号码',
  142. icon: 'none'
  143. })
  144. }
  145. },
  146. // 微信卡片点击事件
  147. handleWechatClick() {
  148. console.log('微信卡片被点击', '微信号:', this.orderDetail.wechat)
  149. if (this.orderDetail.wechat) {
  150. //复制微信号
  151. uni.setClipboardData({
  152. data: this.orderDetail.wechat,
  153. success: () => {
  154. uni.showToast({
  155. title: '微信号已复制',
  156. icon: 'none'
  157. })
  158. }
  159. })
  160. } else {
  161. uni.showToast({
  162. title: '该订单暂时没有微信号',
  163. icon: 'none'
  164. })
  165. }
  166. },
  167. // 下一步
  168. handleNextClick() {
  169. // 校验表单
  170. if (!this.form.truePic.length) {
  171. uni.showToast({
  172. title: '请上传实物图',
  173. icon: 'none'
  174. })
  175. return
  176. }
  177. if (!this.form.chatRecords.length) {
  178. uni.showToast({
  179. title: '请上传聊天记录',
  180. icon: 'none'
  181. })
  182. return
  183. }
  184. this.$emit('handleNextClick', {
  185. nowPage: 'formOne',
  186. form: this.form,
  187. })
  188. },
  189. //一键复制
  190. copyAllImages() {
  191. // 合并所有图片
  192. const allImages = [...this.trueUploadList, ...this.chatRecordsUploadList];
  193. //取出所有图的url
  194. const allUrls = allImages.map(item => item.fileUrl);
  195. console.log('所有图片:', allUrls)
  196. console.log('合并后的图片列表:', allUrls)
  197. if (allUrls.length > 0) {
  198. // 复制到剪贴板
  199. uni.setClipboardData({
  200. data: JSON.stringify(allUrls),
  201. success: () => {
  202. uni.showToast({
  203. title: '所有图片已复制',
  204. icon: 'none'
  205. })
  206. }
  207. })
  208. } else {
  209. uni.showToast({
  210. title: '没有图片可复制',
  211. icon: 'none'
  212. })
  213. }
  214. },
  215. },
  216. }
  217. </script>
  218. <style scoped lang="scss">
  219. // 导入公共样式
  220. @import './common.scss';
  221. // 主样式
  222. .page-itemOne {
  223. @extend .page-container;
  224. }
  225. .page-itemOne-title {
  226. @include font-styles($size: title, $weight: bold, $color: primary);
  227. }
  228. .page-itemOne-form {
  229. @include font-styles($size: tiny, $weight: semi-bold, $color: secondary);
  230. text-wrap: nowrap;
  231. }
  232. .image-upload-container {
  233. padding: map-get($sizes, padding-sm) map-get($sizes, padding);
  234. }
  235. .image-list {
  236. display: flex;
  237. flex-wrap: wrap;
  238. gap: 20rpx;
  239. }
  240. .image-item {
  241. position: relative;
  242. width: 200rpx;
  243. height: 200rpx;
  244. box-sizing: border-box;
  245. }
  246. .delete-btn {
  247. position: absolute;
  248. top: -10rpx;
  249. right: -10rpx;
  250. width: 40rpx;
  251. height: 40rpx;
  252. background-color: #ff4d4f;
  253. color: #fff;
  254. border-radius: 50%;
  255. display: flex;
  256. align-items: center;
  257. justify-content: center;
  258. @include font-styles($size: tiny, $weight: bold);
  259. z-index: 10;
  260. }
  261. .upload-btn {
  262. width: 200rpx;
  263. height: 200rpx;
  264. border: 8rpx dashed #ddd;
  265. border-radius: 30rpx;
  266. display: flex;
  267. align-items: center;
  268. justify-content: center;
  269. background-color: #f9f9f9;
  270. box-sizing: border-box;
  271. }
  272. /* 基本信息卡片样式 */
  273. .info-card {
  274. @include card;
  275. margin-top: 20rpx;
  276. margin-bottom: 20rpx;
  277. padding: map-get($sizes, padding-sm) map-get($sizes, padding);
  278. &:hover {
  279. @include shadow(2);
  280. }
  281. }
  282. .info-card-title {
  283. @include font-styles($size: title, $weight: bold, $color: primary);
  284. margin-bottom: 25rpx;
  285. padding-bottom: 15rpx;
  286. border-bottom: 1rpx solid map-get($colors, border);
  287. }
  288. .info-row {
  289. margin-bottom: 20rpx;
  290. }
  291. .info-label {
  292. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  293. margin-bottom: 8rpx;
  294. }
  295. .info-value {
  296. @include font-styles($size: small, $weight: regular, $color: secondary, $line-height: small);
  297. word-break: break-all;
  298. }
  299. /* 联系方式卡片样式 */
  300. .connect {
  301. display: flex;
  302. justify-content: space-between;
  303. margin: 20rpx 0;
  304. gap: 20rpx;
  305. }
  306. .connect-card {
  307. flex: 1;
  308. @include card;
  309. padding: 30rpx;
  310. display: flex;
  311. flex-direction: column;
  312. align-items: center;
  313. box-sizing: border-box;
  314. position: relative;
  315. &:hover {
  316. @include shadow(2);
  317. }
  318. }
  319. .connect-title {
  320. @include font-styles($size: tiny, $weight: regular, $color: tertiary);
  321. margin-bottom: 8rpx;
  322. }
  323. .connect-value {
  324. @include font-styles($size: small, $weight: medium, $color: secondary);
  325. }
  326. /* 小红点样式 */
  327. .red-dot {
  328. position: absolute;
  329. top: 15rpx;
  330. right: 15rpx;
  331. width: 25rpx;
  332. height: 25rpx;
  333. background-color: #ff4d4f;
  334. border-radius: 50%;
  335. box-shadow: 0 0 4rpx rgba(255, 77, 79, 0.3);
  336. }
  337. </style>